/* ============================================
   私人教練健身管理系統 - 高端簡約專業風格
   ============================================ */

:root {
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5541D9;
    --bg-dark: #1A1A2E;
    --bg-card: #FFFFFF;
    --bg-sidebar: #16213E;
    --bg-input: #F8F9FC;
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-light: #B2BEC3;
    --text-white: #FFFFFF;
    --border: #EAECF0;
    --shadow: 0 2px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #E17055;
    --info: #74B9FF;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Noto Sans TC', -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== 側邊欄 ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: var(--bg-sidebar);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

.sidebar-header {
    padding: 28px 24px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 1px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-list {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-list li {
    margin-bottom: 4px;
}

.nav-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 400;
    transition: var(--transition);
}

.nav-list a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-white);
}

.nav-list a.active {
    background: var(--primary);
    color: var(--text-white);
    font-weight: 500;
}

.nav-icon {
    font-size: 8px;
    opacity: 0.6;
}

.nav-list a.active .nav-icon {
    opacity: 1;
}

.nav-logout {
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 12px !important;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.coach-label {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.coach-name {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
}

/* ===== 主要內容區 ===== */
.main-content {
    margin-left: 240px;
    min-height: 100vh;
    background: #F5F6FA;
    padding: 32px 40px;
}

/* ===== 頁面標題 ===== */
.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== 卡片 ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== 統計卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.stat-value .unit {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 4px;
}

.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: #E17055; }
.stat-value.info { color: var(--info); }

/* ===== 表格 ===== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover td {
    background: #FAFBFF;
}

/* ===== 按鈕 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108,92,231,0.3);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: var(--text-white);
}

.btn-success:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-white);
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ===== 表單 ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.1);
    background: var(--text-white);
}

.form-control::placeholder {
    color: var(--text-light);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23636E72' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ===== 狀態標籤 ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-scheduled {
    background: #EBE8FD;
    color: var(--primary);
}

.badge-in_progress {
    background: #FFF3CD;
    color: #856404;
}

.badge-completed {
    background: #E0F7F4;
    color: var(--success);
}

.badge-cancelled {
    background: #FEE8E0;
    color: var(--danger);
}

/* ===== 登入頁面 ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 48px 40px 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .logo-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    font-size: 24px;
    margin: 0 auto 16px;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-control {
    padding: 12px 16px;
    font-size: 15px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    margin-top: 8px;
}

.login-error {
    background: #FFF5F5;
    border: 1px solid #FED7D7;
    color: #E53E3E;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
}

/* ===== 空狀態 ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 14px;
}

/* ===== 訊息提示 ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
}

.alert-success {
    background: #E0F7F4;
    color: #006B5E;
    border: 1px solid #B2DFDB;
}

.alert-danger {
    background: #FFF5F5;
    color: #C53030;
    border: 1px solid #FED7D7;
}

.alert-info {
    background: #EBF4FF;
    color: #2B6CB0;
    border: 1px solid #C3D9FF;
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 32px;
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-input);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--border);
}

/* ===== 行事曆 - iOS 26 風格 ===== */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.calendar-nav h3 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.calendar-nav button,
.calendar-nav .btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
    color: var(--text-secondary);
}

.calendar-nav button:hover,
.calendar-nav .btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--primary-light);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-header {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    padding: 8px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-day {
    min-height: 108px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border-radius: 14px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 1px solid var(--border);
    background: var(--bg-card);
    padding: 8px;
    overflow: hidden;
}

.calendar-day:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 20px rgba(0,122,255,0.08);
    transform: translateY(-2px);
}

.calendar-day:active {
    transform: scale(0.97);
}

.calendar-day.other-month {
    background: #F8F9FC;
    border-color: transparent;
    color: var(--text-light);
    min-height: 108px;
    opacity: 0.5;
}

.calendar-day.other-month:hover {
    border-color: var(--border);
    box-shadow: none;
    transform: none;
}

.calendar-day .day-number {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 14px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.calendar-day.today .day-number {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.calendar-day.other-month .day-number {
    color: var(--text-light);
}

.calendar-day .day-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.calendar-day .day-events::-webkit-scrollbar {
    width: 0;
}

/* 手機板：壓縮日曆格子到 iPhone 風格大小 */
@media (max-width: 1024px) {
    .calendar-day {
        min-height: 0;
        padding: 3px;
        border-radius: 10px;
        font-size: 12px;
        align-items: center;
        gap: 0;
    }

    .calendar-day .day-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
        margin-bottom: 0;
    }

    .calendar-day.other-month {
        min-height: 0;
    }

    .calendar-day .day-events {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 4px;
        padding: 2px 0 0;
        flex: none;
        overflow: visible;
    }

    .calendar-day .event-item {
        width: 7px;
        height: 7px;
        min-width: 7px;
        border-radius: 50%;
        padding: 0 !important;
        border: none !important;
        background: var(--dot) !important;
        opacity: 1 !important;
        text-decoration: none !important;
        white-space: normal;
        overflow: visible;
    }

    .calendar-day .event-item .event-time,
    .calendar-day .event-item .event-name,
    .calendar-day .event-item span {
        display: none;
    }

    .calendar-day .day-more {
        display: none;
    }

    .calendar-grid {
        gap: 3px;
    }

    .calendar-header {
        font-size: 10px;
        padding: 4px 0 2px;
    }
}

.event-item {
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 6px;
    line-height: 1.3;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-item:hover {
    transform: translateX(2px);
}

.event-item .event-time {
    font-weight: 600;
    flex-shrink: 0;
    font-size: 9px;
    opacity: 0.8;
    font-feature-settings: "tnum";
}

.event-item .event-name {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.event-item.status-scheduled {
    background: #EBE8FD;
    color: var(--primary-dark);
    border-left: 3px solid var(--primary);
}

.event-item.status-completed {
    background: #E0F7F4;
    color: #006B5E;
    border-left: 3px solid var(--success);
    opacity: 0.7;
    text-decoration: line-through;
}

.event-item.status-cancelled {
    background: #FEE8E0;
    color: #C53030;
    border-left: 3px solid var(--danger);
    opacity: 0.6;
    text-decoration: line-through;
}

.calendar-day .day-more {
    font-size: 9px;
    color: var(--text-light);
    text-align: center;
    padding: 1px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.calendar-day .day-more:hover {
    color: var(--primary);
}

/* 選中的日子（手機板高亮） */
.calendar-day.selected {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    box-shadow: 0 2px 12px rgba(108,92,231,0.3);
    transform: translateY(-1px);
}

.calendar-day.selected .day-events .event-item {
    opacity: 0.9 !important;
}

/* ===== 手機板當日行程（日曆下方） ===== */
.mobile-day-detail {
    display: none;
}

@media (max-width: 1024px) {
    .mobile-day-detail.active {
        display: block;
        margin-top: 20px;
        background: var(--bg-card);
        border-radius: var(--radius);
        border: 1px solid var(--border);
        padding: 20px;
    }
}

.mobile-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid var(--border);
}

.mobile-day-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-day-events {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 60px;
}

/* 手機板遮住 Modal 左欄（行程列表已顯示在下方） */
@media (max-width: 640px) {
    .day-modal-left {
        display: none;
    }
}

/* 行事曆今天按鈕 - iOS 風格 */
.calendar-today-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.calendar-today-btn:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0,122,255,0.2);
}

/* ===== 雙欄當日詳情 Modal - iOS 26 風格 ===== */
.day-modal {
    max-width: 780px !important;
    padding: 28px !important;
    border-radius: 20px !important;
}

.day-modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-top: 4px;
}

.day-modal-left,
.day-modal-right {
    min-height: 200px;
}

.day-modal-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid var(--border);
    letter-spacing: 0.3px;
}

/* ===== iPhone 風格色票選擇器 ===== */
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid transparent;
    flex-shrink: 0;
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px white, 0 0 0 4px currentColor;
    transform: scale(1.1);
}

.color-swatch.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ===== 當日預約卡片列表 - iOS 風格 ===== */
.day-events-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.day-events-list::-webkit-scrollbar {
    width: 0;
}

.day-event-card {
    background: var(--bg-input);
    border-radius: 14px;
    padding: 14px 16px;
    border-left: 4px solid var(--primary);
    transition: all 0.2s ease;
}

.day-event-card:hover {
    background: #F0F1F8;
    transform: translateY(-1px);
}

.day-event-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.day-event-student {
    font-size: 14px;
    font-weight: 600;
}

.day-event-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
    font-feature-settings: "tnum";
}

.day-event-content {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.day-event-note {
    font-size: 12px;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 6px;
}

.day-event-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.day-event-actions .btn {
    border-radius: 8px;
    font-size: 11px;
    padding: 5px 12px;
}

@media (max-width: 640px) {
    .day-modal-body {
        grid-template-columns: 1fr;
    }
    .day-modal-left {
        order: 2;
    }
    .day-modal-right {
        order: 1;
    }
}

/* ===== 時間軸檢視模式 (Timeline View) ===== */
.view-mode-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    padding: 3px;
    border-radius: 10px;
}

.view-mode-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.view-mode-btn:hover {
    color: var(--text-primary);
}

.view-mode-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* 時間軸容器 */
.timeline-container {
    display: none;
    margin-top: 8px;
}

.timeline-container.active {
    display: block;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.timeline-date-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.timeline-nav-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1;
}

.timeline-nav-btn:hover {
    background: var(--bg-input);
    color: var(--primary);
    border-color: var(--primary-light);
}

.timeline-today-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.timeline-today-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 時間軸本體 */
.timeline-body {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-card);
}

/* 時間刻度行 */
.timeline-hour-row {
    display: flex;
    min-height: 56px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.timeline-hour-row:last-child {
    border-bottom: none;
}

.timeline-hour-row:hover {
    background: var(--bg-input);
}

.timeline-hour-label {
    width: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6px 8px 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-light);
    font-feature-settings: "tnum";
    border-right: 1px solid var(--border);
    background: var(--bg-input);
    user-select: none;
}

/* 時間軸事件區（每個小時行內的插槽） */
.timeline-hour-slot {
    flex: 1;
    position: relative;
    min-height: 56px;
    padding: 0;
}

/* 時間軸事件卡片 */
.timeline-event {
    position: absolute;
    left: 4px;
    right: 4px;
    border-radius: 10px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    z-index: 2;
    min-height: 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    justify-content: center;
}

.timeline-event:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 3;
}

.timeline-event .tl-top-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
}

.timeline-event .tl-event-title {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.timeline-event .tl-event-time {
    font-size: 10px;
    opacity: 0.75;
    font-weight: 500;
    font-feature-settings: "tnum";
    flex-shrink: 0;
}

.timeline-event .tl-event-sub {
    font-size: 10px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.timeline-event .tl-event-content {
    font-size: 10px;
    opacity: 0.7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.timeline-event .tl-event-sep {
    font-size: 10px;
    opacity: 0.35;
    flex-shrink: 0;
}

/* 整日事件（公眾假期） */
.timeline-all-day-section {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
}

.timeline-all-day-header {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
}

.timeline-all-day-events {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
}

.timeline-all-day-event {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeline-all-day-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 時間軸空狀態 */
.timeline-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--text-light);
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: var(--bg-card);
}

.timeline-empty p {
    margin: 4px 0;
    font-size: 14px;
}

.timeline-empty .tl-empty-icon {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* 手機板時間軸 */
@media (max-width: 1024px) {
    .timeline-hour-label {
        width: 48px;
        font-size: 10px;
        padding: 6px 4px 0;
    }
    .timeline-event {
        padding: 3px 6px;
    }
    .timeline-event .tl-event-title {
        font-size: 11px;
    }
    .timeline-event .tl-event-time {
        font-size: 9px;
    }
    .timeline-event .tl-event-sub {
        font-size: 9px;
    }
    .timeline-date-title {
        font-size: 15px;
    }
    .timeline-hour-row {
        min-height: 48px;
    }
    .timeline-hour-slot {
        min-height: 48px;
    }
}

/* ===== 漢堡選單按鈕 ===== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    border: none;
    background: var(--primary);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(108,92,231,0.3);
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.menu-toggle:hover {
    background: var(--primary-dark);
}

/* 選單開啟時隱藏漢堡按鈕 */
.menu-toggle.hidden {
    display: none !important;
}

/* ===== 側欄關閉按鈕 ===== */
.sidebar-close {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    color: rgba(255,255,255,0.6);
    font-size: 20px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 5;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.06);
}

.sidebar-close:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    transform: rotate(90deg) scale(1.1);
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 0 20px rgba(255,255,255,0.05);
}

.sidebar-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* ===== 側欄遮罩 ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    display: block;
}

/* ===== 響應式（含 iPad） ===== */
@media (max-width: 1024px) {
    .menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        position: fixed;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar.open .sidebar-close {
        display: flex;
    }
    
    .sidebar-close {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-top: 76px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .page-header {
        margin-bottom: 20px;
    }
    
    .page-title {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 16px;
        padding-top: 72px;
    }
    
    .card {
        padding: 16px;
    }
    
    .modal {
        padding: 24px 20px;
    }
}

/* ===== 學員卡片佈局（手機/平板） ===== */
.student-cards {
    display: none;
}

.student-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.student-card:hover {
    box-shadow: var(--shadow);
}

.student-card-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #F5F5F8;
}

.student-card-row:last-of-type {
    border-bottom: none;
}

.student-card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 72px;
    flex-shrink: 0;
}

.student-card-value {
    font-size: 14px;
    color: var(--text-primary);
}

.student-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}

.student-card-actions .btn {
    font-size: 12px;
    padding: 5px 12px;
}

/* 手機版及 iPad：隱藏表格，顯示卡片 */
@media (max-width: 1024px) {
    .desktop-table {
        display: none;
    }
    .student-cards {
        display: block;
    }
}

/* 大螢幕：隱藏卡片，顯示表格 */
@media (min-width: 1025px) {
    .student-cards,
    .dashboard-cards {
        display: none;
    }
    .desktop-table {
        display: table;
    }
}

/* ===== 儀表板卡片（手機/平板） ===== */
.dashboard-cards {
    display: none;
}

.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.dash-card:hover {
    box-shadow: var(--shadow);
}

.dash-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid #F5F5F8;
    flex-wrap: wrap;
}

.dash-card-date {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.dash-card-time {
    font-size: 13px;
    color: var(--text-secondary);
    font-feature-settings: "tnum";
}

.dash-card-name {
    font-size: 15px;
    color: var(--text-primary);
    flex: 1;
}

.dash-card-top .btn {
    margin-left: auto;
}

.dash-card-body {
    display: flex;
    align-items: center;
    padding: 5px 0;
}

.dash-card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 68px;
    flex-shrink: 0;
}

.dash-card-value {
    font-size: 14px;
    color: var(--text-primary);
}

@media (max-width: 1024px) {
    .dashboard-cards {
        display: block;
    }
}

/* ===== 工具類 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
