/* ── COHAF Brand Variables ── */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap');

:root {
    /* COHAF Brand Colours */
    --cohaf-blue:   #0677bd;
    --cohaf-yellow: #fde500;
    --cohaf-dark:   #31333d;
    --cohaf-white:  #ffffff;

    /* Dark mode (default) */
    --bg:           #1a1c24;
    --bg2:          #0f1118;
    --surface:      #21242f;
    --surface2:     #2a2e3d;
    --border:       #333748;
    --accent:       var(--cohaf-blue);
    --accent2:      var(--cohaf-yellow);
    --text:         #e8eaf0;
    --text2:        #8b90a8;
    --text-inv:     #ffffff;
    --success:      #22c55e;
    --danger:       #ef4444;
    --warning:      var(--cohaf-yellow);
    --header-bg:    #0677bd;
    --login-bg:     #0f1118;

    --mono: 'Roboto Mono', monospace;
    --sans: 'Roboto', sans-serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

/* ── LIGHT MODE ── */
body.light {
    --bg:        #f0f2f7;
    --bg2:       #e4e8f0;
    --surface:   #ffffff;
    --surface2:  #f5f7fc;
    --border:    #dde2ee;
    --text:      #1e2130;
    --text2:     #6b7494;
    --text-inv:  #ffffff;
    --header-bg: #0677bd;
    --login-bg:  #f0f2f7;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}


/* ── Logo Images ── */
.login-logo-img {
    height: 90px;
    width: auto;
    object-fit: contain;
    display: block;
    border-radius: 12px;
    background: transparent;
    padding: 0;
}
.header-logo-img {
    height: 52px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    background: transparent;
    border-radius: 0;
    padding: 0;
}

/* ── THEME TOGGLE BUTTON ── */
#theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text2);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
}
#theme-toggle:hover {
    background: var(--accent);
    color: var(--text-inv);
    border-color: var(--accent);
    transform: scale(1.08);
}

/* ── LOGIN ── */
#login-screen {
    position: fixed; inset: 0; background: var(--login-bg);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    background-image: radial-gradient(circle at 30% 20%, rgba(6,119,189,0.12) 0%, transparent 60%),
                      radial-gradient(circle at 80% 80%, rgba(253,229,0,0.06) 0%, transparent 60%);
}
.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: var(--shadow-lg);
}
.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    width: 100%;
}
.login-brand-mark {
    width: 40px;
    height: 40px;
    background: var(--cohaf-blue);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.login-brand-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.login-brand-tag {
    font-size: 0.7rem;
    color: var(--text2);
    font-family: var(--mono);
}
.login-title { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.login-subtitle { font-size: 0.82rem; color: var(--text2); margin-top: 0.35rem; line-height: 1.5; }
.login-input {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-input:focus {
    border-color: var(--cohaf-blue);
    box-shadow: 0 0 0 3px rgba(6,119,189,0.15);
}
.login-btn {
    background: var(--cohaf-blue);
    color: #fff;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 0.9rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    font-family: var(--sans);
    letter-spacing: 0.02em;
}
.login-btn:hover { opacity: 0.9; transform: translateY(-1px); border-color: var(--cohaf-yellow); }
.login-btn:active { transform: translateY(0); }
.login-error { color: var(--danger); font-size: 0.83rem; display: none; }
.login-footer {
    font-size: 0.72rem;
    color: var(--text2);
    text-align: center;
    font-family: var(--mono);
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: -0.5rem;
}
#dashboard { display: none; }

/* ── HEADER ── */
header {
    border-bottom: none;
    border-top: none;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    background: var(--header-bg);
    z-index: 100;
    box-shadow: var(--shadow-sm);
    gap: 1rem;
}
.header-left { display: flex; align-items: center; gap: 0.875rem; min-width: 0; }
.logo-mark {
    width: 38px;
    height: 38px;
    background: var(--cohaf-blue);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 0.72rem;
    color: #fff;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.logo-divider {
    width: 3px;
    height: 3px;
    background: var(--cohaf-yellow);
    border-radius: 50%;
}
.header-title { font-size: 0.95rem; font-weight: 700; color: #ffffff; white-space: nowrap; }
.header-subtitle { font-size: 0.7rem; color: rgba(255,255,255,0.6); font-family: var(--mono); }
.header-right .btn-ghost { color: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.2); }
.header-right .btn-ghost:hover { color: #ffffff; border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.1); }
body.light .header-title { color: #ffffff; }
body.light .header-subtitle { color: rgba(255,255,255,0.7); }
body.light .header-right .btn-ghost { color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.3); }
body.light .header-right .btn-ghost:hover { color: #ffffff; background: rgba(255,255,255,0.15); }
.header-right { display: flex; align-items: center; gap: 0.875rem; flex-shrink: 0; }
.status-dot {
    width: 8px; height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(34,197,94,0.2);
    animation: pulse 2.5s infinite;
}
.system-status { font-size: 0.75rem; color: rgba(255,255,255,0.6); font-family: var(--mono); }
body.light .system-status { color: rgba(255,255,255,0.7); }
@keyframes pulse { 0%,100% { opacity:1; box-shadow: 0 0 0 2px rgba(34,197,94,0.3); } 50% { opacity:0.7; box-shadow: 0 0 0 5px rgba(34,197,94,0.1); } }

/* ── BUTTONS ── */
.btn {
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.18s;
    font-family: var(--sans);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}
.btn-primary { background: var(--cohaf-blue); color: #fff; }
.btn-primary:hover { background: #0560a0; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(6,119,189,0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text2); background: var(--surface2); }
.btn-sm { padding: 0.28rem 0.65rem; font-size: 0.75rem; }
.btn-sms { background: rgba(6,119,189,0.12); color: var(--cohaf-blue); border: 1px solid rgba(6,119,189,0.25); }
.btn-sms:hover { background: rgba(6,119,189,0.22); }
.btn-warn { background: rgba(253,229,0,0.12); color: #b8a200; border: 1px solid rgba(253,229,0,0.3); }
.btn-warn:hover { background: rgba(253,229,0,0.22); }
body.light .btn-warn { color: #8a7800; }

/* ── FLAG BUTTONS ── */
.flag-btn { padding: 5px 10px; border-radius: 6px; font-size: 0.78rem; cursor: pointer; font-family: inherit; font-weight: 600; border: none; transition: opacity 0.15s; }
.flag-btn:hover { opacity: 0.85; }
.flag-btn-secondary { background: var(--surface); border: 1px solid var(--border) !important; color: var(--text); border: none; }
.flag-btn-primary { background: var(--accent); color: #000; }
.flag-btn-yellow { background: var(--cohaf-yellow); color: #31333d; }
.flag-btn-blue { background: #0677bd; color: #fff; }
.flag-btn-red { background: var(--danger); color: #fff; }

/* ── STATS BAR ── */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(6,1fr);
    gap: 1px;
    border-bottom: 1px solid var(--border);
    background: var(--border);
}
.stat-card {
    background: var(--bg);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: background 0.15s;
}
.stat-card:hover { background: var(--surface); }
.stat-label { font-size: 0.67rem; color: var(--text2); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; }
.stat-value { font-size: 1.8rem; font-weight: 700; font-family: var(--mono); color: var(--text); line-height: 1; }
.stat-value.accent  { color: var(--cohaf-blue); }
.stat-value.warning { color: #b8a200; }
body.light .stat-value.warning { color: #8a7800; }
.stat-value.danger  { color: var(--danger); }
.stat-bar-accent {
    height: 2px;
    width: 28px;
    background: var(--cohaf-blue);
    border-radius: 2px;
    margin-top: 0.25rem;
    opacity: 0.8;
}

/* ── DASHBOARD LAYOUT ── */
main { max-width: 100%; margin: 0; }
.dashboard-layout { display: flex; min-height: calc(100vh - 220px); }

/* ── SIDEBAR ── */
.sidebar {
    width: 180px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    flex: 1;
}
.tab-btn {
    padding: 0.85rem 1.25rem;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: var(--text2);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    font-family: var(--sans);
    white-space: nowrap;
    letter-spacing: 0.01em;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
}
.tab-btn:hover { color: var(--text); background: var(--surface2); }
.tab-btn.active { color: #ffffff; border-left-color: var(--cohaf-yellow); background: var(--cohaf-blue); font-weight: 600; }
.tab-btn span { flex: 1; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── CONTENT AREA ── */
.content-area { flex: 1; min-width: 0; overflow-x: auto; }
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
}
.panel-title {
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.panel-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: var(--cohaf-yellow);
    border-radius: 2px;
}
.filter-select, .filter-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.32rem 0.65rem;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.76rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.18s;
}
.filter-select:focus, .filter-input:focus { border-color: var(--cohaf-blue); }
.filter-input { width: 220px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.data-table th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: 0.67rem;
    font-family: var(--mono);
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface);
    font-weight: 500;
}
.data-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.loading-cell { color: var(--text2); font-family: var(--mono); font-size: 0.78rem; text-align: center; padding: 2rem; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 0.18rem 0.5rem;
    border-radius: 4px;
    font-size: 0.67rem;
    font-family: var(--mono);
    font-weight: 500;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.04em;
}
.badge-green  { background: rgba(34,197,94,0.12);   color: #22c55e; }
.badge-yellow { background: rgba(253,229,0,0.15);   color: #b8a200; }
body.light .badge-yellow { color: #8a7800; }
.badge-red    { background: rgba(239,68,68,0.12);   color: var(--danger); }
.badge-purple { background: rgba(139,92,246,0.12);  color: #8b5cf6; }
.badge-grey   { background: rgba(139,144,168,0.12); color: var(--text2); }
.badge-blue   { background: rgba(6,119,189,0.12);   color: var(--cohaf-blue); }

/* ── CALL LOG ── */
.tab-panel#tab-calls .content-grid { display: grid; grid-template-columns: 1fr 390px; gap: 1.5rem; padding: 1.5rem; }
.call-list { overflow-y: auto; max-height: 620px; }
.call-item {
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: start;
}
.call-item:hover { background: var(--surface2); }
.call-item.active { background: var(--surface2); border-left: 3px solid var(--cohaf-yellow); padding-left: calc(1.5rem - 3px); }
.call-item-name { font-size: 0.88rem; font-weight: 500; }
.call-item-sub { font-size: 0.73rem; color: var(--text2); font-family: var(--mono); margin-top: 0.2rem; }
.call-item-time { font-size: 0.73rem; color: var(--text2); font-family: var(--mono); text-align: right; }

/* ── DETAIL PANEL ── */
.detail-panel { display: flex; flex-direction: column; gap: 1rem; }
.detail-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.detail-section-header {
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.67rem;
    font-family: var(--mono);
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--surface2);
}
.detail-section-body { padding: 1.1rem; }
.output-grid { display: grid; gap: 0.7rem; }
.output-item { display: flex; flex-direction: column; gap: 0.2rem; }
.output-key { font-size: 0.66rem; font-family: var(--mono); color: var(--text2); text-transform: uppercase; letter-spacing: 0.08em; }
.output-value { font-size: 0.83rem; font-family: var(--mono); }
.output-section-header { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent); padding: 8px 0 4px; border-top: 1px solid var(--border); margin-top: 4px; grid-column: 1 / -1; }
.transcript-box {
    background: var(--surface2);
    border-radius: var(--radius-sm);
    padding: 0.9rem;
    font-size: 0.78rem;
    font-family: var(--mono);
    color: var(--text2);
    max-height: 250px;
    overflow-y: auto;
    line-height: 1.65;
    white-space: pre-wrap;
}
.transcript-line { margin-bottom: 0.5rem; }
.transcript-line .speaker { color: var(--cohaf-blue); font-weight: 500; }
.transcript-line .speaker.user { color: #8b5cf6; }

/* ── GRADUATES TAB ── */
.graduates-layout { padding: 1.5rem; }
.grad-stats-row {
    display: grid;
    grid-template-columns: repeat(5,1fr);
    gap: 1px;
    border-bottom: 1px solid var(--border);
    background: var(--border);
    margin-bottom: 0;
}
.grad-stat { background: var(--surface); padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.3rem; }
.grad-stat:hover { background: var(--surface2); }
.grad-stat-label { font-size: 0.66rem; color: var(--text2); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.grad-stat-value { font-size: 1.4rem; font-weight: 700; font-family: var(--mono); color: var(--text); }
.grad-stat-value.warning { color: #b8a200; }
body.light .grad-stat-value.warning { color: #8a7800; }
.grad-stat-value.accent  { color: var(--cohaf-blue); }

/* ── SIMULATE FORMS ── */
.simulate-grid { display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; padding: 1.5rem; }
.sim-form { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.sim-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.sim-field { display: flex; flex-direction: column; gap: 0.35rem; }
.sim-field label { font-size: 0.72rem; color: var(--text2); font-family: var(--mono); font-weight: 500; }
.sim-field input, .sim-field select {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.58rem 0.85rem;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.83rem;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    width: 100%;
}
.sim-field input:focus, .sim-field select:focus {
    border-color: var(--cohaf-blue);
    box-shadow: 0 0 0 3px rgba(6,119,189,0.12);
}
.sim-result { font-size: 0.78rem; font-family: var(--mono); color: var(--text2); min-height: 1.2rem; }
.sim-result.success { color: #22c55e; }
.sim-result.error   { color: var(--danger); }

/* ── QUEUE & STUDENTS ── */
#tab-queue .panel, #tab-students .panel { margin: 1.5rem; }

/* ── LOADING STATE ── */
.loading { color: var(--text2); font-family: var(--mono); font-size: 0.78rem; text-align: center; padding: 2.5rem; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) { .stats-bar { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 900px) {
    .tab-panel#tab-calls .content-grid,
    .simulate-grid { grid-template-columns: 1fr; }
    .sim-row { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: repeat(2,1fr); }
    .grad-stats-row { grid-template-columns: repeat(3,1fr); }
    header { padding: 0 1rem; }
    .tabs-bar { padding: 0 1rem; }
    .system-status { display: none; }
}
