/* ══════════════════════════════════════════════════════
   VALVES SECURITY — Design System v2.0
   Elite auditor training platform
   ══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

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

:root {
    /* ── Surfaces ── */
    --bg:        #08090e;
    --surface:   #0e1018;
    --surface2:  #141722;
    --surface3:  #1a1e2e;
    /* ── Borders ── */
    --border:    #1a1e2e;
    --border2:   #232840;
    --border3:   #2d3355;
    /* ── Accent ── */
    --purple:    #7c3aed;
    --purple-l:  #a78bfa;
    --purple-d:  #2d1f6e;
    --purple-bg: rgba(124, 58, 237, 0.08);
    /* ── Text ── */
    --text:      #e8eaf0;
    --muted:     #8b92a8;
    --dim:       #4a5068;
    /* ── Severity ── */
    --crit-bg:   #7f1d1d; --crit-fg: #fca5a5; --crit-bd: #991b1b;
    --high-bg:   #7c2d12; --high-fg: #fdba74; --high-bd: #9a3412;
    --med-bg:    #713f12; --med-fg:  #fcd34d; --med-bd:  #854d0e;
    --low-bg:    #1a2e1a; --low-fg:  #86efac; --low-bd:  #166534;
    /* ── Type ── */
    --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:      'JetBrains Mono', 'Fira Code', monospace;
    /* ── Layout ── */
    --max-w:     1120px;
    --nav-h:     76px;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ══════════════════════════════════════════════════════
   NAV
   ══════════════════════════════════════════════════════ */

nav {
    position: sticky; top: 0; z-index: 100;
    background: rgba(8, 9, 14, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    height: var(--nav-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px;
    max-width: 100%;
}

.nav-brand {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
}

.nav-brand .logo {
    width: 28px; height: 28px;
    object-fit: contain;
    filter: brightness(1.1);
}

.nav-brand span {
    font-size: 15px; font-weight: 600; color: var(--text);
    letter-spacing: 0.2px;
}

.nav-links {
    display: flex; align-items: center; gap: 4px;
}

.nav-links a {
    font-size: 16px; color: var(--muted); padding: 10px 20px;
    border-radius: 6px; transition: all 0.12s; font-weight: 500;
}

.nav-links a:hover { color: var(--text); background: var(--surface2); }
.nav-links a.active { color: var(--purple-l); }

.nav-right a {
    font-size: 11px; font-weight: 600; font-family: var(--mono);
    color: var(--purple-l); padding: 5px 12px;
    border: 1px solid var(--border2); border-radius: 5px;
    transition: all 0.12s; letter-spacing: 0.2px;
}

.nav-right a:hover {
    border-color: var(--purple); background: var(--purple-bg);
}

/* ══════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════ */

.container {
    max-width: var(--max-w); margin: 0 auto; padding: 0 24px;
}

footer {
    border-top: 1px solid var(--border);
    padding: 24px;
    text-align: center;
    font-size: 11px; color: var(--dim);
    font-family: var(--mono);
}

footer a { color: var(--purple-l); }
footer a:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════ */

.badge {
    font-size: 10px; font-weight: 700; font-family: var(--mono);
    padding: 2px 8px; border-radius: 3px;
    letter-spacing: 0.5px; text-transform: uppercase;
    display: inline-block; line-height: 1.4;
}

.badge-CRITICAL { background: var(--crit-bg); color: var(--crit-fg); }
.badge-HIGH     { background: var(--high-bg); color: var(--high-fg); }
.badge-MEDIUM   { background: var(--med-bg);  color: var(--med-fg); }
.badge-LOW      { background: var(--low-bg);  color: var(--low-fg); }

.badge-outline {
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--muted);
}

/* ══════════════════════════════════════════════════════
   PATTERN BADGE (monospace)
   ══════════════════════════════════════════════════════ */

.pattern-badge {
    font-family: var(--mono); font-size: 10px; font-weight: 500;
    padding: 3px 10px; border-radius: 3px;
    background: var(--purple-bg); border: 1px solid var(--border2);
    color: var(--purple-l); display: inline-block;
    letter-spacing: 0.3px;
}

/* ══════════════════════════════════════════════════════
   RISK PILL
   ══════════════════════════════════════════════════════ */

.risk-pill {
    font-size: 11px; font-weight: 700; font-family: var(--mono);
    color: var(--purple-l);
    background: var(--purple-bg); border: 1px solid var(--border2);
    border-radius: 12px; padding: 2px 10px;
}

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════ */

.btn {
    font-family: var(--font); font-weight: 600; font-size: 13px;
    padding: 10px 20px; border-radius: 6px;
    cursor: pointer; transition: all 0.12s;
    border: none; display: inline-flex; align-items: center; gap: 6px;
}

.btn-primary {
    background: var(--purple); color: #fff;
}
.btn-primary:hover { background: #6d28d9; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-secondary {
    background: var(--surface2); color: var(--muted);
    border: 1px solid var(--border2);
}
.btn-secondary:hover { border-color: var(--purple); color: var(--text); }

.btn-ghost {
    background: transparent; color: var(--muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--purple); color: var(--purple-l); }

/* ══════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.card-hover {
    cursor: pointer; transition: all 0.12s;
}
.card-hover:hover {
    border-color: var(--border2);
    background: var(--surface2);
}

/* ══════════════════════════════════════════════════════
   INPUTS
   ══════════════════════════════════════════════════════ */

.input {
    background: var(--surface);
    border: 1px solid var(--border2);
    color: var(--text); padding: 8px 12px;
    border-radius: 5px; font-size: 13px;
    font-family: var(--font);
    outline: none; transition: border-color 0.12s;
    width: 100%;
}

.input:focus { border-color: var(--purple); }
.input::placeholder { color: var(--dim); }

select.input {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a5068' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

textarea.input {
    font-family: var(--font);
    resize: vertical; min-height: 64px;
}

/* ══════════════════════════════════════════════════════
   TAGS
   ══════════════════════════════════════════════════════ */

.tag {
    font-family: var(--mono); font-size: 10px; font-weight: 500;
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--dim); padding: 2px 8px; border-radius: 3px;
    display: inline-block;
}

/* ══════════════════════════════════════════════════════
   CODE BLOCKS
   ══════════════════════════════════════════════════════ */

.code-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--purple);
    border-radius: 0 6px 6px 0;
    padding: 14px 16px;
    font-family: var(--mono); font-size: 12px;
    color: var(--muted); line-height: 1.6;
    overflow-x: auto; white-space: pre-wrap;
    tab-size: 4;
}

/* ══════════════════════════════════════════════════════
   SECTION LABEL
   ══════════════════════════════════════════════════════ */

.section-label {
    font-family: var(--mono);
    font-size: 10px; font-weight: 600;
    color: var(--dim); text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 10px;
}

/* ══════════════════════════════════════════════════════
   SKELETON / LOADING
   ══════════════════════════════════════════════════════ */

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 5px;
}

/* ══════════════════════════════════════════════════════
   STATE
   ══════════════════════════════════════════════════════ */

.state-empty {
    text-align: center; padding: 48px 20px; color: var(--dim);
    font-size: 13px;
}

/* ══════════════════════════════════════════════════════
   MARKDOWN RENDERED CONTENT
   ══════════════════════════════════════════════════════ */

.md-content h1, .md-content h2, .md-content h3 {
    color: var(--text); margin: 16px 0 8px; font-weight: 700;
}
.md-content h1 { font-size: 18px; }
.md-content h2 { font-size: 15px; }
.md-content h3 { font-size: 13px; }
.md-content p { margin: 6px 0; color: var(--muted); line-height: 1.7; font-size: 13px; }
.md-content ul, .md-content ol { padding-left: 20px; margin: 6px 0; color: var(--muted); font-size: 13px; }
.md-content li { margin: 3px 0; }
.md-content code {
    font-family: var(--mono); font-size: 12px;
    background: var(--surface2); padding: 1px 5px; border-radius: 3px;
    color: var(--purple-l);
}
.md-content pre {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--purple);
    border-radius: 0 6px 6px 0;
    padding: 12px 16px; margin: 8px 0;
    overflow-x: auto;
}
.md-content pre code {
    background: none; padding: 0; color: var(--muted);
    font-size: 12px; line-height: 1.6;
}
.md-content a { color: var(--purple-l); }
.md-content blockquote {
    border-left: 3px solid var(--border2);
    padding-left: 12px; margin: 8px 0;
    color: var(--dim); font-style: italic;
}

/* ══════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════ */

.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 10px; margin-top: 20px;
}

.pagination button {
    background: var(--surface); border: 1px solid var(--border);
    color: var(--muted); padding: 6px 14px; border-radius: 5px;
    font-size: 12px; font-family: var(--mono); cursor: pointer;
    transition: all 0.12s;
}
.pagination button:disabled { opacity: 0.25; cursor: not-allowed; }
.pagination button:not(:disabled):hover {
    border-color: var(--purple); color: var(--purple-l);
}
.pagination span { font-size: 11px; color: var(--dim); font-family: var(--mono); }

/* ══════════════════════════════════════════════════════
   WALLET AUTH
   ══════════════════════════════════════════════════════ */

.btn-connect-wallet {
    font-family: var(--mono); font-size: 14px; font-weight: 600;
    color: var(--purple-l); background: transparent;
    border: 1px solid var(--border2); border-radius: 8px;
    padding: 10px 20px; cursor: pointer;
    transition: all 0.12s; display: flex; align-items: center; gap: 8px;
}
.btn-connect-wallet:hover {
    border-color: var(--purple); background: var(--purple-bg);
}
.wallet-icon { font-size: 14px; }

.wallet-connected {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; padding: 5px 12px;
    border: 1px solid var(--border2); border-radius: 6px;
    transition: all 0.12s; position: relative;
}
.wallet-connected:hover { border-color: var(--purple); }

.wallet-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #4ade80; flex-shrink: 0;
}
.wallet-addr {
    font-family: var(--mono); font-size: 12px;
    color: var(--text); font-weight: 500;
}

.wallet-dropdown {
    position: absolute; top: calc(var(--nav-h) - 4px); right: 24px;
    background: var(--surface); border: 1px solid var(--border2);
    border-radius: 8px; min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 200; display: none;
    overflow: hidden;
}
.wallet-dropdown.visible { display: block; }

.wallet-dropdown-addr {
    padding: 12px 16px; font-family: var(--mono); font-size: 12px;
    color: var(--muted); border-bottom: 1px solid var(--border);
}
.wallet-dropdown-item {
    display: block; padding: 10px 16px;
    font-size: 13px; color: var(--text);
    cursor: pointer; transition: background 0.1s;
    text-decoration: none;
}
.wallet-dropdown-item:hover { background: var(--surface2); }
.wallet-disconnect { color: var(--crit-fg); }
.wallet-disconnect:hover { background: rgba(248,113,113,0.06); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .nav-links { display: none; }
    nav { padding: 0 16px; }
    .container { padding: 0 16px; }
}
