/* ============================================================
   오늘의 현황 플로팅 패널 (v3.30)
   - 예약관리 페이지 우측 하단 플로팅 버튼 + 확장 패널
   - 드래그앤드롭 배정 UI + Undo 토스트
   ============================================================ */

/* ---------- 1. 플로팅 버튼 (FAB) ---------- */
.today-status-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 28px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}
.today-status-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(99, 102, 241, 0.45);
}
.today-status-fab:active {
    transform: translateY(0);
}

.today-status-fab .fab-icon { font-size: 18px; }
.today-status-fab .fab-label { white-space: nowrap; }

.today-status-fab .fab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: #fff;
    color: #111827;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 4px;
}

/* 상태별 색상 */
.today-status-fab.fab-ok {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.today-status-fab.fab-warn {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}
.today-status-fab.fab-warn .fab-badge { background: #fff; color: #92400e; }

.today-status-fab.fab-alert {
    background: linear-gradient(135deg, #f97316, #ea580c);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
}
.today-status-fab.fab-alert .fab-badge { background: #fff; color: #9a3412; }

.today-status-fab.fab-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    animation: fab-pulse 1.8s ease-in-out infinite;
}
.today-status-fab.fab-danger .fab-badge { background: #fff; color: #991b1b; }

@keyframes fab-pulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5); }
    50%      { box-shadow: 0 6px 28px rgba(239, 68, 68, 0.85); }
}

/* 모바일에서는 버튼 약간 축소 */
@media (max-width: 768px) {
    .today-status-fab {
        right: 16px;
        bottom: 16px;
        padding: 10px 14px;
        font-size: 13px;
    }
    .today-status-fab .fab-label { display: none; }  /* 모바일은 아이콘만 */
    .today-status-fab .fab-icon { font-size: 20px; }
}


/* ---------- 2. 플로팅 패널 본체 ---------- */
.today-status-panel {
    position: fixed;
    right: 24px;
    bottom: 92px;
    z-index: 9997;
    width: min(720px, calc(100vw - 48px));
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: tsp-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tsp-slide-in {
    0%   { opacity: 0; transform: translateY(12px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
    .today-status-panel {
        right: 8px; left: 8px; bottom: 76px;
        width: auto;
        max-height: calc(100vh - 110px);
    }
}

/* --- 헤더 --- */
.tsp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    flex-shrink: 0;
}
.tsp-title { font-size: 15px; font-weight: 700; }
.tsp-title .tsp-date {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.88;
}
.tsp-close {
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    width: 28px; height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}
.tsp-close:hover { background: rgba(255,255,255,0.3); }

/* --- 바디 --- */
.tsp-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    flex: 1;
}

/* --- 상단 2열 (OFF / 미배정) --- */
.tsp-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}
@media (max-width: 640px) {
    .tsp-top-row { grid-template-columns: 1fr; }
}

.tsp-box {
    padding: 12px 14px;
    border-radius: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    min-height: 70px;
}
.tsp-box-title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}
.tsp-box.tsp-off .tsp-box-title    { color: #991b1b; }
.tsp-box.tsp-unassigned .tsp-box-title { color: #92400e; }

.tsp-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tsp-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}
.tsp-chip-off {
    background: #fee2e2;
    color: #991b1b;
}

/* --- 미배정 투어 드래그 칩 --- */
.tsp-tour-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: grab;
    user-select: none;
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}
.tsp-tour-chip:active { cursor: grabbing; }
.tsp-tour-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}
.tsp-tour-chip.tsp-dragging {
    opacity: 0.4;
    transform: scale(0.96);
}

.tsp-empty {
    font-size: 11px;
    color: #9ca3af;
    padding: 4px 0;
}

/* --- 섹션 타이틀 --- */
.tsp-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 10px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.tsp-hint {
    font-size: 11px;
    font-weight: 400;
    color: #6b7280;
}

/* --- 선생님 카드 그리드 (드롭존) --- */
.tsp-teacher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}
@media (max-width: 640px) {
    .tsp-teacher-grid { grid-template-columns: repeat(2, 1fr); }
}

.tsp-teacher-card {
    position: relative;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left-width: 3px;
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
    min-height: 70px;
}

/* 상태별 좌측 테두리 색 */
.tsp-teacher-card.tsp-tc-free      { border-left-color: #d1d5db; }
.tsp-teacher-card.tsp-tc-assigned  { border-left-color: #10b981; }
.tsp-teacher-card.tsp-tc-partial   { border-left-color: #f59e0b; }
.tsp-teacher-card.tsp-tc-off       { border-left-color: #ef4444; background: #fef2f2; }
.tsp-teacher-card.tsp-tc-conflict  { border-left-color: #dc2626; background: #fef2f2; box-shadow: 0 0 0 1px #fecaca; }

.tsp-tc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.tsp-tc-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}
.tsp-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}
.tsp-badge-red   { background: #fee2e2; color: #991b1b; }
.tsp-badge-amber { background: #fef3c7; color: #92400e; }

.tsp-tc-tours {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tsp-tc-tour {
    font-size: 11px;
    padding: 3px 6px;
    background: #d1fae5;
    color: #065f46;
    border-radius: 4px;
    cursor: grab;
    user-select: none;
    transition: transform 0.1s, box-shadow 0.1s, opacity 0.1s;
}
.tsp-tc-tour:active { cursor: grabbing; }
.tsp-tc-tour:hover {
    transform: translateX(1px);
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}
.tsp-tc-tour.tsp-dragging {
    opacity: 0.4;
}
.tsp-tc-tour-conflict {
    background: #fecaca !important;
    color: #991b1b !important;
    font-weight: 600;
}

.tsp-tc-empty {
    font-size: 11px;
    color: #9ca3af;
}

/* --- 드롭존 활성 시각 피드백 --- */
.tsp-teacher-card.tsp-droppable {
    border-style: dashed;
    background: #f8fafc;
}
.tsp-teacher-card.tsp-drop-hover {
    border: 2px solid #3b82f6 !important;
    background: #eff6ff !important;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}
/* OFF 카드에 드롭 시도 중 (경고색) */
.tsp-teacher-card.tsp-tc-off.tsp-drop-hover,
.tsp-teacher-card.tsp-tc-conflict.tsp-drop-hover {
    border: 2px solid #ef4444 !important;
    background: #fef2f2 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}


/* ---------- 3. Undo 토스트 ---------- */
.undo-toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;  /* ✅ 기존 teamSelectOverlay(10000), 모달(10001) 위로 */
    pointer-events: none;
}

.undo-toast {
    pointer-events: auto;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: #111827;
    color: #f9fafb;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-size: 13px;
    overflow: hidden;
    animation: undo-toast-in 0.25s ease-out;
}
.undo-toast.undo-toast-out {
    animation: undo-toast-out 0.3s ease-in forwards;
}

@keyframes undo-toast-in {
    0%   { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes undo-toast-out {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(12px); }
}

.undo-toast-msg {
    font-weight: 500;
}
.undo-toast-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.undo-toast-btn:hover { background: #2563eb; }

.undo-toast-timer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    width: 100%;
}
@keyframes undo-countdown {
    0%   { width: 100%; }
    100% { width: 0%; }
}

@media (max-width: 640px) {
    .undo-toast-container { left: 12px; right: 12px; transform: none; }
    .undo-toast { width: 100%; box-sizing: border-box; justify-content: space-between; }
}
