/* ==========================================================================
   CyberNova Student Portal - stylesheet
   Modern European university portal look: fixed sidebar, top bar, cards.
   ========================================================================== */

:root {
    --navy: #12233f;
    --navy-2: #1b3358;
    --navy-3: #24426e;
    --accent: #2f6fed;
    --accent-soft: #e8f0fe;
    --amber: #b7791f;
    --green: #1f7a4d;
    --red: #b3261e;
    --bg: #f4f6fa;
    --card: #ffffff;
    --line: #e2e7f0;
    --text: #1c2430;
    --muted: #667085;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(18, 35, 63, .06), 0 6px 18px rgba(18, 35, 63, .05);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

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

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 246px;
    flex: 0 0 246px;
    background: var(--navy);
    color: #cdd8ea;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand img { width: 32px; height: 32px; }
.brand-text { line-height: 1.15; }
.brand-text strong { display: block; color: #fff; font-size: 15px; letter-spacing: .2px; }
.brand-text span { font-size: 11px; color: #8fa4c4; text-transform: uppercase; letter-spacing: .8px; }

.nav { padding: 12px 8px 20px; }
.nav-section {
    padding: 14px 12px 6px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a9c9;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 1px 4px;
    border-radius: 8px;
    color: #cdd8ea;
    font-size: 14px;
}
.nav a:hover { background: var(--navy-2); text-decoration: none; color: #fff; }
.nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav a .ico { width: 18px; text-align: center; opacity: .85; }
.nav a .pill {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 12px 26px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: var(--muted); }
.topbar .who strong { color: var(--text); }

.bell { position: relative; font-size: 18px; }
.bell .dot {
    position: absolute; top: -3px; right: -5px;
    background: var(--red); color: #fff; font-size: 10px;
    border-radius: 9px; padding: 0 5px; line-height: 15px; height: 15px;
}

.content { padding: 24px 26px 60px; }

/* ---------- cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 18px;
}
.card > h2 {
    font-size: 15px;
    margin: 0 0 14px;
    font-weight: 650;
    letter-spacing: .2px;
}
.card.tight { padding: 14px 18px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.stat .v { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.stat .s { font-size: 12px; color: var(--muted); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding: 9px 10px;
    font-weight: 600;
}
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
table.zebra tbody tr:nth-child(odd) td { background: #fafbfe; }
th.num, td.num { text-align: right; }

/* ---------- dashboard widgets ---------- */
.msg {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 0; border-bottom: 1px solid var(--line);
}
.msg:last-of-type { border-bottom: none; }
.msg-subject { font-weight: 600; font-size: 13.5px; }
.dot-new {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); flex: 0 0 auto; margin-top: 6px;
}

.svc { display: grid; gap: 8px; }
.svc-item {
    display: block; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 8px;
    color: inherit; text-decoration: none;
}
.svc-item:hover { background: #f7f9fd; border-color: #cfd9ea; text-decoration: none; }
.svc-item strong { font-size: 13.5px; }
.svc-item span { display: block; font-size: 12.5px; color: var(--muted); }

/* ---------- confidential archive (the loot layer) ---------- */
.loot-bar { height: 10px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.loot-fill { height: 100%; background: linear-gradient(90deg, #2f6fed, #1f7a4d); }

.exhibit {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 0; border-bottom: 1px solid var(--line);
}
.exhibit:last-child { border-bottom: none; }
.exhibit-title { font-weight: 600; font-size: 14px; }
.exhibit-seal {
    flex: 0 0 auto; min-width: 76px; text-align: center;
    font-size: 9.5px; font-weight: 800; letter-spacing: .8px;
    padding: 4px 8px; border-radius: 3px; border: 1px solid;
}
.exhibit-seal.high { color: #8d1d17; border-color: #f3c4c0; background: #fdf3f2; }
.exhibit-seal.mid  { color: #7a4f0d; border-color: #f0d9a8; background: #fffaf0; }
.exhibit-seal.low  { color: #145c3a; border-color: #bfe5d0; background: #effaf4; }

.loot-banner {
    border: 1px solid #bfe5d0; border-left: 5px solid #1f7a4d;
    background: linear-gradient(180deg, #effaf4, #ffffff);
    border-radius: 10px; padding: 16px 18px; margin-bottom: 18px;
}
.loot-banner-seal { font-size: 10.5px; font-weight: 800; letter-spacing: 2px; color: #1f7a4d; }
.loot-banner-title { font-size: 17px; font-weight: 700; color: var(--navy); margin: 4px 0 2px; }
.loot-banner-sub { font-size: 13px; color: #475467; }

.classified {
    border: 2px solid var(--navy); border-radius: 8px;
    overflow: hidden; background: #fff; margin-bottom: 18px;
}
.classified-bar {
    background: var(--navy); color: #fff; font-size: 10px; font-weight: 800;
    letter-spacing: 2px; padding: 5px 12px; text-align: center;
}
.classified-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.classified-title { font-size: 16px; font-weight: 700; color: var(--navy); }
.classified-body {
    margin: 0; padding: 16px; background: #fff;
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px; line-height: 1.55; white-space: pre-wrap; color: #1c2430;
    overflow-x: auto;
}
.exhibit-meta {
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 10.5px; color: #8b95a5; margin-top: 6px; word-break: break-all;
}

/* ---------- footer ---------- */
.footer {
    padding: 0 26px 26px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}
.footer .links {
    display: flex; flex-wrap: wrap; gap: 16px;
    border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 6px;
}

/* ---------- forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: #344054; margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=file], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #cfd6e4;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .13);
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #2360d8; text-decoration: none; color: #fff; }
.btn.secondary { background: #fff; color: var(--navy); border-color: #cfd6e4; }
.btn.secondary:hover { background: #f3f6fb; color: var(--navy); }
.btn.small { padding: 5px 11px; font-size: 13px; }

.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; }

/* ---------- messages / badges ---------- */
.flash {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    border: 1px solid;
}
.flash.success { background: #eaf7f0; border-color: #bfe5d0; color: #145c3a; }
.flash.error { background: #fdecea; border-color: #f3c4c0; color: #8d1d17; }
.flash.info { background: var(--accent-soft); border-color: #c6dbfb; color: #1c4fa8; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .2px;
}
.badge.easy { background: #e6f6ee; color: var(--green); }
.badge.medium { background: #fdf3e0; color: var(--amber); }
.badge.hard { background: #fdecea; color: var(--red); }
.badge.neutral { background: #eef1f6; color: #475467; }
.badge.admin { background: #f0e9ff; color: #5b34c9; }
.badge.done { background: #e6f6ee; color: var(--green); }

/* ---------- avatars ---------- */
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--navy-3); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 650; flex: 0 0 auto;
}
.avatar.lg { width: 76px; height: 76px; font-size: 26px; }
.avatar.xl { width: 104px; height: 104px; font-size: 34px; }
.avatar-row { display: flex; align-items: center; gap: 12px; }

/* ---------- comments ---------- */
.comment { border-top: 1px solid var(--line); padding: 14px 0; }
.comment:first-of-type { border-top: none; }
.comment-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.comment-head .meta { font-size: 12px; color: var(--muted); }
.comment-body { font-size: 14px; }

/* ---------- challenge list ---------- */
.challenge {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    border: 1px solid var(--line);
    border-left: 4px solid var(--line);
    background: #fff;
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.challenge.solved { border-left-color: var(--green); }
.challenge.triggered { border-left-color: var(--amber); }
.challenge .num {
    font-size: 13px; font-weight: 700; color: var(--muted);
    min-width: 34px; padding-top: 2px;
}
.challenge h3 { margin: 0 0 4px; font-size: 15px; }
.challenge p { margin: 0 0 6px; font-size: 13.5px; color: #475467; }
.challenge .pts { font-weight: 700; color: var(--navy); white-space: nowrap; }
details.hint { margin: 6px 0 2px; }
details.hint summary {
    cursor: pointer; font-size: 13px; color: var(--accent);
    list-style: none; display: inline-block;
}
details.hint summary::-webkit-details-marker { display: none; }
details.hint summary::before { content: "▸ "; }
details.hint[open] summary::before { content: "▾ "; }

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.code {
    background: #0f1b2d; color: #d7e3f4; border-radius: 8px;
    padding: 14px 16px; overflow-x: auto; white-space: pre-wrap;
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px; line-height: 1.5;
}
.code.light { background: #f6f8fc; color: #1c2430; border: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(150deg, var(--navy) 0%, #1d3a63 55%, #26507f 100%);
    padding: 30px;
}
.auth-card {
    background: #fff; border-radius: 14px; padding: 34px 36px;
    width: 100%; max-width: 430px;
    box-shadow: 0 22px 60px rgba(6, 16, 33, .35);
}
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.helper { font-size: 12.5px; color: var(--muted); margin-top: 14px; }

.notice {
    border: 1px solid #f0d9a8; background: #fffaf0; color: #7a4f0d;
    border-radius: 8px; padding: 12px 14px; font-size: 13.5px;
}
.notice.danger { border-color: #f3c4c0; background: #fdf3f2; color: #8d1d17; }
.notice.ok { border-color: #bfe5d0; background: #effaf4; color: #145c3a; }

@media (max-width: 960px) {
    .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .layout { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; }
    .nav { display: flex; flex-wrap: wrap; }
    .nav-section { width: 100%; }
}
@media (max-width: 640px) {
    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
    .content { padding: 18px 14px 50px; }
    .kv { grid-template-columns: 1fr; }
}
