/* ── TutorPlan Web — CSS ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
    --primary: #6C5CE7;
    --primary-light: #A855F7;
    --success: #00B894;
    --danger: #E17055;
    --warning: #FDCB6E;
    --info: #0984E3;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --transition: 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --max-width: 1200px;
}

/* ── Dark Theme (default) ── */
.theme-dark {
    --bg: #13131F;
    --bg-card: #1E1E2E;
    --bg-input: rgba(255,255,255,0.06);
    --bg-hover: rgba(255,255,255,0.08);
    --border: rgba(255,255,255,0.08);
    --text: #F0F0FF;
    --text-secondary: #8888a8;
    --text-muted: #555;
    --modal-overlay: rgba(15,15,25,0.7);
}

/* ── Light Theme ── */
.theme-light {
    --bg: #F5F7FA;
    --bg-card: #FFFFFF;
    --bg-input: rgba(0,0,0,0.04);
    --bg-hover: rgba(0,0,0,0.06);
    --border: rgba(0,0,0,0.1);
    --text: #1a1a2e;
    --text-secondary: #666;
    --text-muted: #aaa;
    --modal-overlay: rgba(0,0,0,0.4);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

.app-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
    gap: 0;
}

@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
    .sidebar { display: none !important; }
    .sidebar-overlay { display: none !important; }
    .mobile-header { display: flex !important; max-height: 50px; }
    .mobile-nav { display: flex !important; }
    .main-content { padding: 12px 16px 70px; }
    .burger { display: none; }
    .page-title { font-size: 20px; margin-bottom: 14px; }
}

/* ── Sidebar ── */
.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--primary), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-link.active { background: rgba(108,92,231,0.12); color: var(--primary); font-weight: 600; }
.nav-link .icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-bottom { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Mobile Header ── */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 0;
    max-height: 50px;
    overflow: hidden;
}

.burger { background: none; border: none; font-size: 24px; color: var(--text); cursor: pointer; padding: 4px; }


/* ── Mobile Bottom Nav ── */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    padding: 6px 0 10px;
    z-index: 100;
}
.mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: var(--text-muted);
    padding: 4px 8px;
}
.mobile-nav a.active { color: var(--primary); }
.mobile-nav a .icon { font-size: 18px; }

/* ── Main Content ── */
.main-content { padding: 24px 32px; overflow-y: auto; }
@media (max-width: 768px) { .main-content { padding: 16px; } }

.page-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.card:hover { border-color: rgba(108,92,231,0.3); }
.card-clickable { cursor: pointer; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.15);
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
@media (max-width: 480px) { .form-row { flex-direction: column; } }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; box-shadow: 0 4px 16px rgba(108,92,231,0.3); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(108,92,231,0.4); transform: translateY(-1px); }
.btn-success { background: linear-gradient(135deg, #0984E3, var(--success)); color: #fff; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #E84393); color: #fff; }
.btn-ghost { background: var(--bg-input); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); }

/* ── Tabs ── */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 4px;
}
.tab-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}
.tab-btn.active { background: var(--bg-card); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

/* ── Day Selector ── */
.day-selector { display: flex; gap: 6px; margin-bottom: 16px; }
.day-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    color: var(--text-secondary);
}
.day-btn:hover { border-color: var(--primary); }
.day-btn.active { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; border-color: transparent; }
.day-btn .day-name { font-size: 11px; font-weight: 500; }
.day-btn .day-num { font-size: 16px; font-weight: 700; }
.day-btn .day-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.day-btn.active .day-dot { background: #fff; }

/* ── Lesson Card ── */
.lesson-card {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
    align-items: center;
}
.lesson-card:hover { border-color: rgba(108,92,231,0.4); transform: translateX(2px); }
.lesson-bar { width: 4px; border-radius: 2px; align-self: stretch; min-height: 40px; }
.lesson-time { font-size: 15px; font-weight: 600; white-space: nowrap; }
.lesson-duration { font-size: 12px; color: var(--text-secondary); }
.lesson-name { font-size: 14px; font-weight: 500; }
.lesson-subject { font-size: 12px; color: var(--text-secondary); }
.lesson-price {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Student / Group Card ── */
.entity-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}
.entity-card:hover { border-color: rgba(108,92,231,0.4); }
.entity-bar { width: 4px; border-radius: 2px; align-self: stretch; min-height: 36px; }
.entity-info { flex: 1; }
.entity-name { font-size: 15px; font-weight: 600; }
.entity-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.entity-badge {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

/* ── Attendance ── */
.att-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.att-buttons { display: flex; gap: 6px; }
.att-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.att-btn.present { border-color: var(--success); background: rgba(0,184,148,0.12); color: var(--success); }
.att-btn.absent { border-color: var(--danger); background: rgba(225,112,85,0.12); color: var(--danger); }
.att-btn.late { border-color: var(--warning); background: rgba(253,203,110,0.12); color: var(--warning); }

/* ── Payment Card ── */
.pay-card {
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.pay-card.unpaid { border-left: 3px solid var(--danger); }
.pay-card.paid { border-left: 3px solid var(--success); }

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}
.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: scaleIn 0.2s;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Color Picker ── */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}
.color-dot.active { border-color: var(--text); transform: scale(1.1); }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 2000;
    font-size: 14px;
    animation: toastIn 0.3s;
}

/* ── Progress Bar ── */
.progress-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--bg-input);
    overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }

/* ── Auth Pages ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}
.auth-logo {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-subtitle { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }
.auth-error { background: rgba(225,112,85,0.12); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.auth-link { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-secondary); }

/* ── Settings ── */
.settings-section { margin-bottom: 32px; }
.settings-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.subject-list { display: flex; flex-direction: column; gap: 8px; }
.subject-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}
.subject-dot { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.subject-name { flex: 1; font-size: 14px; }

/* ── Eye Toggle ── */
.eye-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.4;
    transition: var(--transition);
    padding: 4px;
}
.eye-toggle.active { opacity: 1; }

/* ── Week Nav ── */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.week-label { font-size: 15px; font-weight: 600; text-align: center; }
.week-sub { font-size: 12px; color: var(--text-secondary); }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.3); border-radius: 3px; }

/* ── Utilities ── */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-secondary); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ── Fix select/option colors ── */
.form-select option,
select option {
    background: #1E1E2E;
    color: #F0F0FF;
}
.theme-light .form-select option,
.theme-light select option {
    background: #FFFFFF;
    color: #1a1a2e;
}
