/* ═══════════════════════════════════════
   RNIT Happiness Index — Amber & Black
   ═══════════════════════════════════════ */

:root {
    --black:     #0a0a0a;
    --bg:        #0d0d0d;
    --surface:   #161616;
    --surface2:  #1e1e1e;
    --surface3:  #262626;
    --border:    #2a2a2a;
    --border-hi: #3a3a3a;
    --text:      #e8e0d4;
    --text-dim:  #8a8278;
    --text-muted:#5c574f;
    --amber:     #f59e0b;
    --amber-hi:  #fbbf24;
    --amber-dim: #d97706;
    --amber-bg:  rgba(245,158,11,.08);
    --amber-glow:rgba(245,158,11,.25);
    --green:     #34d399;
    --red:       #f87171;
    --mono:      'JetBrains Mono', monospace;
    --sans:      'DM Sans', system-ui, sans-serif;
}

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

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ── LOGIN ───────────────────────────── */

.login-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--black);
    position: relative;
    overflow: hidden;
}

.login-glow {
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(245,158,11,.12) 0%, transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.login-card {
    position: relative;
    width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px 32px;
    text-align: center;
    animation: fadeUp .5s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-logo { margin-bottom: 20px; }
.rnit-logo  {
    height: 42px;
    filter: drop-shadow(0 0 18px rgba(255,255,255,.7)) drop-shadow(0 0 6px rgba(255,255,255,.5)) drop-shadow(0 0 2px rgba(255,255,255,.8));
}
.topbar-logo {
    height: 26px;
    filter: drop-shadow(0 0 14px rgba(255,255,255,.6)) drop-shadow(0 0 5px rgba(255,255,255,.45)) drop-shadow(0 0 2px rgba(255,255,255,.7));
}
.footer-logo {
    height: 14px;
    filter: drop-shadow(0 0 10px rgba(255,255,255,.55)) drop-shadow(0 0 3px rgba(255,255,255,.5));
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--amber);
}

.login-sub {
    font-size: 13px;
    color: var(--text-dim);
    margin: 4px 0 28px;
}

.field { text-align: left; margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.field input {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}
.field input:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-bg);
}

.login-error {
    font-size: 13px;
    color: var(--red);
    min-height: 20px;
    margin-bottom: 4px;
}

.btn-login {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, var(--amber-dim), var(--amber));
    color: var(--black);
    border: none;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s;
}
.btn-login:hover { filter: brightness(1.1); }

.login-footer {
    margin-top: 28px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
/* footer-logo styled above */

/* ── TOPBAR ──────────────────────────── */

.topbar {
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 10px; }
/* topbar-logo styled above */
.topbar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--amber);
    letter-spacing: -.2px;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.btn-upload {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    background: linear-gradient(135deg, var(--amber-dim), var(--amber));
    color: var(--black);
    border: none; border-radius: 7px;
    font-family: var(--sans); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: filter .15s;
}
.btn-upload:hover { filter: brightness(1.1); }

.btn-logout {
    background: none; border: 1px solid var(--border); border-radius: 7px;
    padding: 6px 8px; cursor: pointer; color: var(--text-dim);
    display: flex; align-items: center; transition: all .15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ── LAYOUT ──────────────────────────── */

.layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

.sidebar {
    width: 280px;
    border-right: 1px solid var(--border);
    padding: 12px;
    overflow-y: auto;
    flex-shrink: 0;
    background: var(--surface);
}

.main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--bg);
}

/* ── UPLOAD ZONE ─────────────────────── */

.upload-zone {
    border: 1px dashed var(--border-hi);
    border-radius: 10px;
    padding: 18px 14px;
    display: flex; align-items: center; gap: 10px;
    cursor: pointer;
    transition: all .2s;
    margin-bottom: 14px;
    font-size: 12px;
    color: var(--text-dim);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--amber);
    background: var(--amber-bg);
    color: var(--amber);
}
.upload-zone input { display: none; }

.sidebar-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 4px 4px 8px;
}

/* ── SESSION LIST ────────────────────── */

.session-list { display: flex; flex-direction: column; gap: 4px; }

.session-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    position: relative;
}
.session-item:hover { background: var(--surface2); }
.session-item.active { background: var(--surface2); border-color: var(--amber-dim); }

.session-item .name {
    font-size: 12px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-right: 20px;
}
.session-item .meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.session-item .status {
    display: inline-block; padding: 1px 5px; border-radius: 3px;
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    font-family: var(--mono);
}
.status-processing { background: rgba(245,158,11,.15); color: var(--amber); }
.status-complete   { background: rgba(52,211,153,.12);  color: var(--green); }
.status-failed     { background: rgba(248,113,113,.12); color: var(--red); }

.progress-bar { height: 3px; background: var(--surface3); border-radius: 2px; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 2px; background: var(--amber); transition: width .4s; }

.delete-btn {
    position: absolute; top: 8px; right: 8px;
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 14px; padding: 0 4px; border-radius: 3px; line-height: 1;
}
.delete-btn:hover { color: var(--red); }

/* ── EMPTY STATE ─────────────────────── */

.empty-state {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 100px 32px; text-align: center;
}
.empty-icon { margin-bottom: 16px; opacity: .6; }
.empty-state h2 { font-size: 18px; color: var(--text); margin-bottom: 6px; }
.empty-state p  { color: var(--text-dim); font-size: 14px; max-width: 340px; }

/* ── PROCESSING VIEW ─────────────────── */

.processing-view {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 100px 32px; text-align: center;
}
.processing-view h2 { font-size: 18px; margin-bottom: 4px; }
.processing-view p  { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }

.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--surface3);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.processing-bar { width: 260px; height: 5px; background: var(--surface3); border-radius: 3px; }
.processing-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--amber-dim), var(--amber)); transition: width .5s; }
.processing-pct  { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--amber); font-family: var(--mono); }

/* ── RESULTS ─────────────────────────── */

.results-header { margin-bottom: 20px; }
.results-header h2 { font-size: 18px; font-weight: 700; }
.results-header .info { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px; margin-bottom: 20px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.stat-card .value {
    font-size: 26px; font-weight: 700;
    font-family: var(--mono);
}
.stat-card .label {
    font-size: 10px; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: .6px; margin-top: 2px;
}

/* ── VIDEO ───────────────────────────── */

.video-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px; margin-bottom: 20px;
}
.video-section video { width: 100%; border-radius: 8px; display: block; }

/* ── TIMELINE ────────────────────────── */

.timeline-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px; margin-bottom: 20px;
}
.timeline-container { display: flex; gap: 10px; }
.timeline-chart { flex: 1; min-width: 0; }
.timeline-chart img { width: 100%; border-radius: 8px; display: block; }

.timeline-legend {
    width: 170px; flex-shrink: 0; overflow-y: auto;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px;
}
.legend-item {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 6px; border-radius: 4px; cursor: pointer;
    font-size: 11px; transition: background .1s;
}
.legend-item:hover { background: var(--surface2); }
.legend-color { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.legend-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-hi    { font-weight: 600; font-size: 10px; flex-shrink: 0; font-family: var(--mono); }

/* ── STUDENT CARDS ───────────────────── */

.students-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px;
}

.student-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.student-card:hover {
    border-color: var(--amber-dim);
    box-shadow: 0 0 20px rgba(245,158,11,.06);
}

.card-header { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.card-thumb {
    width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
    border: 2px solid var(--border); background: var(--surface2);
}
.card-title { flex: 1; }
.card-title h3 { font-size: 13px; font-weight: 600; }
.card-title .rank { color: var(--text-dim); font-weight: 400; font-size: 11px; }
.card-hi { font-size: 22px; font-weight: 700; font-family: var(--mono); margin-top: 2px; }
.hi-bar  { height: 3px; background: var(--surface3); border-radius: 2px; margin-top: 4px; }
.hi-fill { height: 100%; border-radius: 2px; }

.card-metrics {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px;
}
.card-metric {
    background: var(--bg); border-radius: 6px; padding: 6px 8px;
    border: 1px solid var(--border);
}
.card-metric .m-label {
    font-size: 9px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .3px;
}
.card-metric .m-value { font-size: 13px; font-weight: 600; font-family: var(--mono); }
.mini-bar  { height: 2px; background: var(--surface3); border-radius: 1px; margin-top: 3px; }
.mini-fill { height: 100%; border-radius: 1px; }

.card-chart { width: 100%; border-radius: 6px; margin-top: 2px; }

/* ── HELPERS ─────────────────────────── */

.no-sessions { color: var(--text-muted); font-size: 12px; text-align: center; padding: 24px 8px; }

/* ── HI COLORS ───────────────────────── */

.hi-high  { color: var(--green); }
.hi-mid   { color: var(--amber); }
.hi-low   { color: var(--red); }

/* ── RESPONSIVE ──────────────────────── */

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%; border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 220px;
    }
    .students-grid { grid-template-columns: 1fr; }
    .timeline-container { flex-direction: column; }
    .timeline-legend { width: 100%; max-height: 120px; }
}
