/* 基礎設定 */
body {
    background-color: #1e293b;
    color: #f1f5f9;
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
}

[v-cloak] {
    display: none;
}

/* 滾動條美化 (暗色系) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* 排班表核心樣式 */
.excel-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.excel-table th,
.excel-table td {
    border: 1px solid #334155;
    text-align: center;
    transition: background-color 0.2s;
    height: 40px !important;
    padding: 0 !important;
    vertical-align: middle;

}


td {
    text-align: center;
    vertical-align: middle;
}

td .flex {
    gap: 4px;
    /* 班別之間的間距 */
}

.excel-table tbody tr {
    height: 40px !important;
}

/* 讓右側統計表的表頭高度與左表一致，方便垂直對齊 */
.stat-table thead th {
    height: 60px !important;
}

/* 人員管理表格樣式 */
.staff-table {
    table-layout: fixed;
}

.staff-table th {
    padding: 1rem;
    text-align: left;
    vertical-align: middle;
}

.staff-table td {
    padding: 1rem;
    vertical-align: middle;
}

.staff-table td:not(:last-child) {
    text-align: left;
}

.staff-table th:last-child,
.staff-table td:last-child {
    text-align: center;
}

/* 人員姓名欄位：固定在左側 */
.name-col {
    position: sticky;
    left: 0;
    z-index: 25;
    background-color: #1e293b !important;
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 10px 4px;
    font-size: 12px;
    font-weight: bold;
    color: #f1f5f9;
    border-right: 2px solid #3b82f6 !important;
}

/* 日期格子 */
.date-cell {
    width: 28px;
    min-width: 28px;
    font-size: 11px;
}

.date-cell.weekend {
    background-color: #450a0a !important;
    color: #f87171;
}

/* 右側統計欄位 */
.stat-col {
    min-width: 28px;
    max-width: 28px;
    width: 28px !important;
    height: 40px !important;
    background-color: #0f172a !important;
    color: #38bdf8;
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 0 !important;
    display: table-cell;
    vertical-align: middle;
}


/* 統計表左欄（姓名） */
.name-col-stat {
    position: sticky;
    left: 0;
    z-index: 20;
    background-color: #1e293b !important;
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 10px 4px;
    font-size: 12px;
    font-weight: bold;
    color: #f1f5f9;
    border-right: 2px solid #3b82f6 !important;
    text-align: left;
}

/* 特殊日期（假日出勤）樣式 */
.date-cell.special-day {
    background-color: #7c3aed !important;
    color: #e9d5ff !important;
}

/* 國定假日表頭樣式 */
.date-cell.holiday-cell {
    background-color: #dc2626 !important;
    color: #fecaca !important;
}
/* 讓 input type="date" 的日曆圖標變白色 */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1); /* 將圖標顏色反轉（黑變白） */
    cursor: pointer;
}

/* 值班人員單元格樣式 */
.on-duty-cell {
    background-color: #b45309 !important;
    color: #fef3c7 !important;
    box-shadow: inset 0 0 0 1px #d97706 !important;
}

/* 班別文字顏色 */
.shift-A {
    color: #60a5fa;
    font-weight: 900;
}

.shift-B {
    color: #34d399;
    font-weight: 900;
}

.shift-C {
    color: #fbbf24;
    font-weight: 900;
}

/* 請假標記 X */
.shift-X {
    color: #f87171;
    font-weight: 900;
}

/* 拖曳清單樣式 */
.drag-item {
    cursor: grab;
}

.drag-item:active {
    cursor: grabbing;
}

.ghost {
    opacity: 0.5;
    background: #3b82f6;
}

/* 班別卡片區域 */
.shift-group-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 12px;
}

/* 班別卡片 */
.shift-card {
    border: 1px solid #24303f;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.6));
}

/* 拖放高亮 */
.shift-card.drag-over {
    outline: 2px dashed rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.06);
}

.shift-card input {
    border: none;
}

/* 拖曳把手 */
.drag-handle {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(148, 163, 184, 0.04);
    border-radius: 6px;
    color: #94a3b8;
    cursor: grab;
    font-size: 14px;
}

.drag-handle:active {
    cursor: grabbing;
}

.shift-card {
    position: relative;
}

.drag-handle {
    position: absolute;
    right: 10px;
    bottom: 8px;
}

/* row handle for staff list */
.row-handle {
    cursor: grab;
    color: #94a3b8;
    padding: 6px;
    border-radius: 6px;
}

.row-handle:active {
    cursor: grabbing;
}


/* Modal */
.modal-backdrop {
    background: rgba(2, 6, 23, 0.6);
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
}

.modal {
    background: #0b1220;
    border: 1px solid #22303f;
    padding: 18px;
    border-radius: 12px;
    width: 420px;
    color: #e6eef8;
}

.cell-picker-modal {
    width: 720px;
}

/* picker grid inside modal: two columns */
.cell-picker-modal .picker-grid {
    display: flex;
    gap: 16px;
}

.cell-picker-modal .picker-grid .col {
    display: flex;
    flex-direction: column;
}

.cell-picker-modal select {
    min-width: 320px;
    max-width: 340px;
}

.modal h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.modal .row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.modal select,
.modal input {
    background: #0f1722;
    border: 1px solid #213243;
    padding: 8px;
    color: #e6eef8;
    border-radius: 6px;
}

.modal select {
    color: #e6eef8;
}

.modal input[type="date"] {
    color: #e6eef8;
}

.modal select option {
    background: #0f1722;
    color: #e6eef8;
}

.modal select option:checked {
    background: #1e40af;
    color: #e6eef8;
    font-weight: bold;
}

.modal .actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

/* 與主表格的統計欄做視覺分隔 */
.excel-table th.stat-col:first-of-type,
.excel-table td.stat-col:first-of-type {
    border-left: 5px solid #334155;
    padding-left: 4px;
}

/* TIP 樣式 */
.schedule-tip {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(34, 197, 94, 0.05));
    border-left: 4px solid #3b82f6;
    color: #cbd5e1;
    font-size: 13px;
    padding: 12px 16px;
    margin: 0 0 8px 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 下拉選單樣式 */
.select-dropdown {
    background-color: #1e293b !important;
    /* 深色背景 */
    color: #cbd5e1 !important;
    /* 淡色文字 */
    border: 1px solid #334155 !important;
    /* 邊框顏色 */
    border-radius: 0.5rem !important;
    /* 圓角 */
    padding: 0.5rem !important;
    /* 內距 */
    font-size: 0.875rem !important;
    /* 字體大小 */
    transition: border-color 0.2s, box-shadow 0.2s !important;
    /* 過渡效果 */
}

.select-dropdown:focus {
    border-color: #3b82f6 !important;
    /* 聚焦時的邊框顏色 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5) !important;
    /* 聚焦時的光暈效果 */
    outline: none !important;
    /* 移除預設的聚焦框 */
}

/* 隱藏數字輸入框的上下按鈕 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* 報支頁面專用樣式 */
.report-page .name-col {
    width: 120px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.report-page .stat-col {
    min-width: 56px;
    max-width: 56px;
    width: 56px !important;
}

/* 編輯狀態: 高亮列與可編輯欄位樣式 */
.editing-row {
    background: rgba(59,130,246,0.04) !important; /* subtle blue tint */
}

.editing-row td {
    transition: background-color 0.15s;
}

.staff-edit-input {
    background: linear-gradient(180deg, rgba(59,130,246,0.06), rgba(59,130,246,0.02));
    border: 1px solid rgba(59,130,246,0.18);
    padding: 6px 8px;
    border-radius: 6px;
    color: #e6eef8;
    outline: none;
    transition: box-shadow 0.12s, border-color 0.12s;
}

.staff-edit-input:focus,
.staff-edit-input:active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 6px rgba(59,130,246,0.06);
}

/* small helpers to ensure selects look consistent when editing */
.staff-edit-input.select-dropdown {
    padding: 6px 10px !important;
}

/* --- Toast 彈窗過渡動畫 --- */
.fade-enter-active, .fade-leave-active {
    transition: all 0.4s ease;
}
/* 離開時加上 pointer-events-none 確保不擋滑鼠 */
.fade-leave-to {
    transform: translate(-50%, -30px) !important;
    opacity: 0 !important;
    pointer-events: none; 
}
.fade-enter-from {
    transform: translate(-50%, -30px) !important;
    opacity: 0;
}