/* ============================================================
   StuTrack — Main Stylesheet
   Aesthetic: Clean academic with warm editorial accents.
   Typography: Playfair Display (headings) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
    --clr-bg:           #f4f2ee;
    --clr-surface:      #ffffff;
    --clr-surface-alt:  #faf8f5;
    --clr-border:       #e4e0d8;
    --clr-text:         #2c2825;
    --clr-text-muted:   #7a756c;
    --clr-accent:       #2d4a3e;
    --clr-accent-light: #e8f0ec;
    --clr-accent2:      #c2703a;
    --clr-accent2-light:#fef1e8;
    --clr-blue:         #3b6ca7;
    --clr-blue-light:   #eaf2fc;
    --clr-red:          #c0392b;
    --clr-red-light:    #fdecea;
    --clr-gold:         #c9a227;
    --clr-gold-light:   #fdf8e8;

    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    16px;
    --radius-xl:    22px;

    --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:    0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg:    0 8px 30px rgba(0,0,0,.09), 0 4px 8px rgba(0,0,0,.05);

    --font-head:    'Playfair Display', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;

    --transition:   200ms cubic-bezier(.4,0,.2,1);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-body);
    background: var(--clr-bg);
    color: var(--clr-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--clr-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ── Layout Shell ───────────────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

/* ── Top Bar ────────────────────────────────────────────────── */
.topbar {
    grid-column: 1 / -1;
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding: 0 24px;
    height: 62px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar .logo {
    font-family: var(--font-head);
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--clr-accent);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.topbar .logo span { color: var(--clr-accent2); }

.search-wrap {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.search-wrap input {
    width: 100%;
    padding: 9px 16px 9px 38px;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-md);
    font-size: .875rem;
    background: var(--clr-surface-alt);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-wrap input:focus { outline: none; border-color: var(--clr-accent); box-shadow: 0 0 0 3px var(--clr-accent-light); }
.search-wrap .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--clr-text-muted); pointer-events: none;
}

.search-results-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    max-height: 380px; overflow-y: auto; z-index: 200;
    display: none;
}
.search-results-dropdown.open { display: block; }
.search-result-item {
    padding: 10px 16px; display: flex; align-items: center; gap: 12px;
    cursor: pointer; border-bottom: 1px solid var(--clr-border);
    transition: background var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--clr-surface-alt); }
.search-result-item .sr-badge {
    font-size: .7rem; font-weight: 600; text-transform: uppercase;
    padding: 3px 7px; border-radius: 99px; white-space: nowrap;
}
.search-result-item .sr-title { font-size: .875rem; font-weight: 500; }
.search-result-item .sr-sub { font-size: .775rem; color: var(--clr-text-muted); }
.sr-no-results { padding: 20px; text-align: center; color: var(--clr-text-muted); font-size: .85rem; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    background: var(--clr-surface);
    border-right: 1px solid var(--clr-border);
    padding: 20px 0;
    overflow-y: auto;
    height: calc(100vh - 62px);
    position: sticky;
    top: 62px;
}

.nav-section-label {
    font-size: .7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1px; color: var(--clr-text-muted);
    padding: 16px 22px 6px; margin-top: 4px;
}
.nav-section-label:first-child { margin-top: 0; }

.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 22px; font-size: .875rem; color: var(--clr-text);
    transition: background var(--transition), color var(--transition);
    cursor: pointer; border-radius: 0;
    position: relative;
}
.nav-item:hover { background: var(--clr-surface-alt); }
.nav-item.active {
    background: var(--clr-accent-light);
    color: var(--clr-accent);
    font-weight: 600;
}
.nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 4px; bottom: 4px;
    width: 3px; background: var(--clr-accent); border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 18px; height: 18px; opacity: .65; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    padding: 28px 32px;
    overflow-y: auto;
    min-height: calc(100vh - 62px);
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 {
    font-family: var(--font-head);
    font-size: 1.75rem; font-weight: 700;
    color: var(--clr-accent); line-height: 1.2;
}
.page-header .page-subtitle { font-size: .825rem; color: var(--clr-text-muted); margin-top: 3px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 18px; border-radius: var(--radius-md);
    font-size: .84rem; font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary {
    background: var(--clr-accent); color: #fff;
}
.btn-primary:hover { background: #255a4a; box-shadow: var(--shadow-sm); }
.btn-secondary {
    background: var(--clr-surface); color: var(--clr-text);
    border: 1.5px solid var(--clr-border);
}
.btn-secondary:hover { border-color: var(--clr-accent); color: var(--clr-accent); }
.btn-danger { background: var(--clr-red); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn-icon:hover { background: var(--clr-surface-alt); }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--clr-border);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-header h3 { font-size: .925rem; font-weight: 600; }
.card-body { padding: 18px 20px; }

/* ── Calendar Grid ──────────────────────────────────────────── */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--clr-surface);
    box-shadow: var(--shadow-sm);
}

.cal-day-header {
    background: var(--clr-accent);
    color: #fff;
    text-align: center;
    padding: 10px 4px;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-day {
    border-right: 1px solid var(--clr-border);
    border-bottom: 1px solid var(--clr-border);
    min-height: 110px;
    padding: 6px;
    position: relative;
    transition: background var(--transition);
}
.cal-day:hover { background: var(--clr-surface-alt); }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.today { background: var(--clr-accent-light); }
.cal-day.today .cal-date { 
    background: var(--clr-accent); color: #fff; 
    border-radius: 50%; width: 24px; height: 24px; 
    display: flex; align-items: center; justify-content: center;
}
.cal-date { font-size: .8rem; font-weight: 600; margin-bottom: 4px; color: var(--clr-text-muted); }
.cal-day.today .cal-date { color: #fff; }

.cal-event {
    font-size: .7rem; font-weight: 500;
    padding: 2px 5px; border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer;
    transition: opacity var(--transition);
    color: #fff;
}
.cal-event:hover { opacity: .8; }

/* ── Today's Classes (horizontal strip) ─────────────────────── */
.today-strip {
    display: flex; gap: 12px; overflow-x: auto;
    padding-bottom: 6px; margin-bottom: 24px;
}
.today-strip::-webkit-scrollbar { height: 4px; }
.today-strip::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 2px; }

.today-class-card {
    flex-shrink: 0;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    min-width: 200px;
    max-width: 260px;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--clr-blue);
}
.today-class-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.today-class-card .tcc-code { font-size: .7rem; font-weight: 600; text-transform: uppercase; color: var(--clr-text-muted); letter-spacing: 0.5px; }
.today-class-card .tcc-name { font-size: .9rem; font-weight: 600; margin: 3px 0; }
.today-class-card .tcc-time { font-size: .78rem; color: var(--clr-text-muted); }
.today-class-card .tcc-room { font-size: .75rem; color: var(--clr-text-muted); }

/* ── GPA Card ───────────────────────────────────────────────── */
.gpa-card {
    background: linear-gradient(135deg, var(--clr-accent), #3a6b56);
    border-radius: var(--radius-xl);
    padding: 24px 28px;
    color: #fff;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.gpa-card::before {
    content: '';
    position: absolute; top: -30px; right: -30px;
    width: 140px; height: 140px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
}
.gpa-card::after {
    content: '';
    position: absolute; bottom: -50px; left: -40px;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,.04);
}
.gpa-card .gpa-label { font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; opacity: .75; position: relative; z-index: 1; }
.gpa-card .gpa-value { font-family: var(--font-head); font-size: 3.2rem; font-weight: 800; line-height: 1; position: relative; z-index: 1; margin: 6px 0; }
.gpa-card .gpa-sub { font-size: .8rem; opacity: .7; position: relative; z-index: 1; }
.gpa-card .gpa-semester-select {
    background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
    color: #fff; padding: 5px 10px; border-radius: var(--radius-sm);
    font-size: .8rem; cursor: pointer;
    position: absolute; top: 18px; right: 22px; z-index: 1;
}
.gpa-card .gpa-semester-select option { color: var(--clr-text); background: var(--clr-surface); }

/* ── Grade Breakdown ────────────────────────────────────────── */
.grade-row {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 0; border-bottom: 1px solid var(--clr-border);
}
.grade-row:last-child { border-bottom: none; }
.grade-row .gr-color { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.grade-row .gr-name { flex: 1; font-size: .82rem; }
.grade-row .gr-pct { font-size: .82rem; color: var(--clr-text-muted); width: 56px; text-align: right; }
.grade-row .gr-letter { font-size: .82rem; font-weight: 700; width: 36px; text-align: center;
    background: var(--clr-accent-light); color: var(--clr-accent); padding: 2px 6px; border-radius: var(--radius-sm); }

/* ── Class Detail Panel ─────────────────────────────────────── */
.detail-panel-overlay {
    position: fixed; inset: 0; background: rgba(44,40,37,.45);
    z-index: 500; display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(3px);
}
.detail-panel-overlay.open { display: flex; }

.detail-panel {
    background: var(--clr-surface);
    border-radius: var(--radius-xl);
    width: 90%; max-width: 780px;
    max-height: 88vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: panelSlideIn .25s cubic-bezier(.4,0,.2,1);
}
@keyframes panelSlideIn {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.detail-panel-header {
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--clr-border);
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.detail-panel-header h2 { font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; }
.detail-panel-header .dp-code { font-size: .78rem; color: var(--clr-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-panel-header .dp-close {
    color: var(--clr-text-muted); font-size: 1.4rem; line-height: 1;
    padding: 4px 8px; border-radius: var(--radius-sm); flex-shrink: 0;
}
.detail-panel-header .dp-close:hover { background: var(--clr-red-light); color: var(--clr-red); }

.detail-panel-body { padding: 22px 26px; }

.dp-tabs {
    display: flex; gap: 4px; margin-bottom: 18px;
    border-bottom: 2px solid var(--clr-border); padding-bottom: 2px;
}
.dp-tab {
    font-size: .82rem; font-weight: 600; padding: 6px 14px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    color: var(--clr-text-muted); cursor: pointer;
    transition: color var(--transition), background var(--transition);
    position: relative; top: 2px;
}
.dp-tab:hover { color: var(--clr-text); }
.dp-tab.active { color: var(--clr-accent); background: var(--clr-accent-light); }

.dp-tab-content { display: none; }
.dp-tab-content.active { display: block; }

/* ── Forms / Modals ─────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(44,40,37,.4);
    z-index: 600; display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--clr-surface);
    border-radius: var(--radius-xl);
    width: 90%; max-width: 520px;
    max-height: 85vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: panelSlideIn .22s cubic-bezier(.4,0,.2,1);
}
.modal-header {
    padding: 20px 24px 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--clr-border);
}
.modal-header h3 { font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; }
.modal-close { color: var(--clr-text-muted); font-size: 1.3rem; padding: 2px 7px; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--clr-red-light); color: var(--clr-red); }
.modal-body { padding: 20px 24px 24px; }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: .8rem; font-weight: 600; color: var(--clr-text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-row input,
.form-row select,
.form-row textarea {
    width: 100%; padding: 9px 12px;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-md);
    font-size: .87rem; color: var(--clr-text);
    background: var(--clr-surface-alt);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none; border-color: var(--clr-accent);
    box-shadow: 0 0 0 3px var(--clr-accent-light);
    background: #fff;
}
.form-row textarea { resize: vertical; min-height: 80px; }
.form-row .form-hint { font-size: .74rem; color: var(--clr-text-muted); margin-top: 4px; }
.form-row-inline { display: flex; gap: 12px; }
.form-row-inline .form-row { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ── Rich Text Editor (contenteditable) ─────────────────────── */
.note-editor-toolbar {
    display: flex; gap: 4px; padding: 8px 12px;
    background: var(--clr-surface-alt);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.note-editor-toolbar button {
    width: 30px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); font-size: .85rem; color: var(--clr-text-muted);
    transition: background var(--transition), color var(--transition);
}
.note-editor-toolbar button:hover { background: var(--clr-border); color: var(--clr-text); }
.note-editor-toolbar button.active { background: var(--clr-accent-light); color: var(--clr-accent); }
.note-editor-toolbar .toolbar-sep { width: 1px; height: 24px; background: var(--clr-border); margin: 0 4px; }

.note-editor {
    min-height: 200px; padding: 14px 16px;
    border: 1px solid var(--clr-border); border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: .87rem; line-height: 1.7;
    outline: none; background: #fff;
}
.note-editor:focus { border-color: var(--clr-accent); box-shadow: 0 0 0 3px var(--clr-accent-light); }

/* ── List Items ─────────────────────────────────────────────── */
.list-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--clr-border);
    transition: background var(--transition);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--clr-surface-alt); }

.list-item .li-check {
    width: 20px; height: 20px; border: 2px solid var(--clr-border);
    border-radius: var(--radius-sm); flex-shrink: 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); margin-top: 1px;
}
.list-item .li-check:hover { border-color: var(--clr-accent); }
.list-item .li-check.checked { background: var(--clr-accent); border-color: var(--clr-accent); }
.list-item .li-check.checked::after { content: '✓'; color: #fff; font-size: .75rem; font-weight: 700; }
.list-item.completed .li-title { text-decoration: line-through; color: var(--clr-text-muted); }

.li-content { flex: 1; min-width: 0; }
.li-title { font-size: .86rem; font-weight: 500; }
.li-meta { font-size: .74rem; color: var(--clr-text-muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }

.priority-badge {
    font-size: .68rem; font-weight: 600; text-transform: uppercase;
    padding: 2px 7px; border-radius: 99px; letter-spacing: .3px;
}
.priority-badge.urgent { background: var(--clr-red-light); color: var(--clr-red); }
.priority-badge.high   { background: var(--clr-accent2-light); color: var(--clr-accent2); }
.priority-badge.medium { background: var(--clr-gold-light); color: var(--clr-gold); }
.priority-badge.low    { background: var(--clr-blue-light); color: var(--clr-blue); }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-bar {
    height: 6px; background: var(--clr-border); border-radius: 3px; overflow: hidden;
    flex-shrink: 0; width: 100px;
}
.progress-bar-fill {
    height: 100%; background: var(--clr-accent); border-radius: 3px;
    transition: width .4s ease;
}
.progress-bar-fill.low { background: var(--clr-red); }
.progress-bar-fill.mid { background: var(--clr-accent2); }
.progress-bar-fill.high { background: var(--clr-accent); }

/* ── Status Badges (Tasks) ─────────────────────────────────── */
.status-badge {
    font-size: .68rem; font-weight: 600; text-transform: uppercase;
    padding: 2px 8px; border-radius: 99px; letter-spacing: .3px;
}
.status-badge.not_started { background: #f0efee; color: var(--clr-text-muted); }
.status-badge.in_progress { background: var(--clr-blue-light); color: var(--clr-blue); }
.status-badge.review       { background: var(--clr-gold-light); color: var(--clr-gold); }
.status-badge.completed    { background: var(--clr-accent-light); color: var(--clr-accent); }

/* ── Upload Drop Zone ───────────────────────────────────────── */
.dropzone {
    border: 2px dashed var(--clr-border);
    border-radius: var(--radius-lg);
    padding: 28px; text-align: center;
    cursor: pointer; transition: all var(--transition);
    background: var(--clr-surface-alt);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--clr-accent);
    background: var(--clr-accent-light);
}
.dropzone .dz-icon { font-size: 1.8rem; color: var(--clr-text-muted); margin-bottom: 6px; }
.dropzone .dz-text { font-size: .82rem; color: var(--clr-text-muted); }
.dropzone .dz-text strong { color: var(--clr-accent); }

/* ── Exam Type Badges ───────────────────────────────────────── */
.exam-type-badge {
    font-size: .68rem; font-weight: 600; text-transform: uppercase;
    padding: 2px 7px; border-radius: 99px;
}
.exam-type-badge.exam       { background: var(--clr-red-light); color: var(--clr-red); }
.exam-type-badge.midterm    { background: var(--clr-accent2-light); color: var(--clr-accent2); }
.exam-type-badge.final      { background: #efe8f5; color: #6a3d9a; }
.exam-type-badge.quiz       { background: var(--clr-blue-light); color: var(--clr-blue); }
.exam-type-badge.test       { background: var(--clr-gold-light); color: var(--clr-gold); }
.exam-type-badge.assignment { background: var(--clr-accent-light); color: var(--clr-accent); }

/* ── Link Type Icons ────────────────────────────────────────── */
.link-type-icon {
    width: 32px; height: 32px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; flex-shrink: 0;
}
.link-type-icon.youtube    { background: #fee2e2; color: #dc2626; }
.link-type-icon.webpage    { background: var(--clr-blue-light); color: var(--clr-blue); }
.link-type-icon.pdf        { background: var(--clr-red-light); color: var(--clr-red); }
.link-type-icon.google_drive { background: #e8f7e8; color: #16a34a; }
.link-type-icon.other      { background: var(--clr-surface-alt); color: var(--clr-text-muted); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { padding: 20px 18px; }
    .calendar-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .25s ease forwards; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #ccc8c0; }

/* ── Empty States ───────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 40px 20px;
    color: var(--clr-text-muted);
}
.empty-state .es-icon { font-size: 2.2rem; margin-bottom: 10px; opacity: .5; }
.empty-state .es-text { font-size: .85rem; }

/* ── Toast Notifications ────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: var(--clr-text); color: #fff;
    padding: 11px 18px; border-radius: var(--radius-md);
    font-size: .82rem; box-shadow: var(--shadow-md);
    animation: toastSlideIn .25s ease forwards;
    display: flex; align-items: center; gap: 10px; max-width: 320px;
}
.toast.success { background: var(--clr-accent); }
.toast.error   { background: var(--clr-red); }
@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
/* === 1. Hide all pages by default === */
.page-view {
    display: none;
}

/* === 2. Show only the page with the 'active' class === */
.page-view.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

/* === 3. Style the active Sidebar Item === */
.nav-item.active {
    background-color: #e0e7ff; /* Change this to match your theme */
    color: #4338ca;
    font-weight: 600;
    border-right: 3px solid #4338ca;
}

/* Simple animation for page switching */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
.view-btn {
    background: transparent;
    border: none;
    padding: 4px 12px;
    font-size: .8rem;
    color: var(--clr-text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all .2s;
}
.view-btn:hover { color: var(--clr-text); }
.view-btn.active {
    background: #fff;
    color: var(--clr-accent);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
/* ============================================================
   THEMES
   Apply these attributes to <body> to switch themes
   ============================================================ */

/* 1. Dark Theme */
body[data-theme="dark"] {
    --clr-bg: #1a1a1a;
    --clr-surface: #2d2d2d;
    --clr-surface-alt: #363636;
    --clr-border: #444;
    --clr-text: #e0e0e0;
    --clr-text-muted: #aaa;
    --clr-accent: #4dabf7; /* Bright Blue */
    --clr-accent-light: rgba(77, 171, 247, 0.15);
}

/* 2. Grey / Minimalist Theme */
body[data-theme="grey"] {
    --clr-bg: #e5e5e5;
    --clr-surface: #f3f3f3;
    --clr-surface-alt: #fff;
    --clr-border: #d4d4d4;
    --clr-text: #171717;
    --clr-text-muted: #737373;
    --clr-accent: #404040;
    --clr-accent-light: #d4d4d4;
}

/* 3. Pink Theme */
body[data-theme="pink"] {
    --clr-bg: #fff0f5;
    --clr-surface: #fff;
    --clr-surface-alt: #fff5f8;
    --clr-border: #fecdd3;
    --clr-text: #831843;
    --clr-accent: #db2777;
    --clr-accent-light: #fce7f3;
}

/* 4. Blue Theme */
body[data-theme="blue"] {
    --clr-bg: #eff6ff;
    --clr-surface: #fff;
    --clr-surface-alt: #f0f9ff;
    --clr-border: #bae6fd;
    --clr-text: #0c4a6e;
    --clr-accent: #0284c7;
    --clr-accent-light: #e0f2fe;
}

/* 5. Purple Theme */
body[data-theme="purple"] {
    --clr-bg: #faf5ff;
    --clr-surface: #fff;
    --clr-surface-alt: #fdf4ff;
    --clr-border: #e9d5ff;
    --clr-text: #581c87;
    --clr-accent: #7e22ce;
    --clr-accent-light: #f3e8ff;
}

/* ============================================================
   POMODORO TIMER WIDGET
   ============================================================ */
.pomo-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.pomo-display {
    font-family: var(--font-head);
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--clr-text);
    margin: 10px 0;
    font-variant-numeric: tabular-nums;
}

.pomo-status {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--clr-text-muted);
    margin-bottom: 5px;
}

.pomo-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

/* ============================================================
   DUE TODAY WIDGETS
   ============================================================ */
.due-today-section {
    margin-bottom: 20px;
}
.due-today-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.dt-label {
    font-size: .78rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; color: var(--clr-text-muted);
}
.dt-count {
    font-size: .7rem; background: var(--clr-red); color: #fff;
    padding: 2px 6px; border-radius: 99px; font-weight: 600;
}

.dt-list {
    display: flex; flex-direction: column; gap: 8px;
}

.dt-item {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all .2s;
}
.dt-item:hover { transform: translateX(3px); border-color: var(--clr-accent); }
.dt-item .dt-check { width: 18px; height: 18px; border: 2px solid var(--clr-border); border-radius: 4px; flex-shrink:0; }
.dt-item.completed { opacity: .5; text-decoration: line-through; }
.dt-content { flex: 1; font-size: .85rem; font-weight: 500; }
.dt-meta { font-size: .7rem; color: var(--clr-text-muted); margin-left: auto; }

/* Quick check toggle styling */
.dt-check.checked { background: var(--clr-accent); border-color: var(--clr-accent); position: relative; }
.dt-check.checked::after { content: '✓'; color: #fff; font-size: .7rem; position: absolute; top:50%; left:50%; transform:translate(-50%,-50%); }
/* Auth Styles */
#auth-view {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; background: var(--clr-bg);
}
.auth-card {
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius-xl); padding: 40px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg); text-align: center;
}
.auth-toggle {
    margin-top: 20px; font-size: .85rem; color: var(--clr-blue);
    cursor: pointer; text-decoration: underline;
}

/* Admin Table */
.admin-table {
    width: 100%; border-collapse: collapse; margin-top: 10px;
}
.admin-table th, .admin-table td {
    text-align: left; padding: 12px; border-bottom: 1px solid var(--clr-border);
}
.admin-table th {
    color: var(--clr-text-muted); font-size: .8rem; text-transform: uppercase;
}
.role-badge {
    font-size: .7rem; padding: 2px 8px; border-radius: 99px; font-weight: 600; text-transform: uppercase;
}
.role-admin { background: var(--clr-accent-light); color: var(--clr-accent); }
.role-user { background: #eee; color: #666; }
