/* ============================================================
   ipinsights.io — Stylesheet
   Themes: Light, Dark, VT100 Terminal
   ============================================================ */

/* ---- CSS Variables — Light Theme (Default) ---- */
:root,
[data-theme="light"] {
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef1f6;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-navbar: rgba(255,255,255,0.92);
    --text-primary: #1a1d29;
    --text-secondary: #5a6178;
    --text-muted: #8b90a0;
    --border-color: #dfe2ea;
    --border-light: #eef1f6;
    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-success: #059669;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;
    --accent-info: #0891b2;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --threat-low: #059669;
    --threat-medium: #d97706;
    --threat-high: #ea580c;
    --threat-critical: #dc2626;
    --badge-bg: #eef1f6;
    --badge-text: #5a6178;
    --scrollbar-bg: #eef1f6;
    --scrollbar-thumb: #c1c5d0;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
    --bg-primary: #0f1117;
    --bg-secondary: #181b25;
    --bg-tertiary: #1e2231;
    --bg-card: #1a1e2b;
    --bg-input: #1e2231;
    --bg-navbar: rgba(15,17,23,0.92);
    --text-primary: #e8eaf0;
    --text-secondary: #a0a5b8;
    --text-muted: #6b7089;
    --border-color: #2a2f40;
    --border-light: #1e2231;
    --accent-primary: #3b82f6;
    --accent-primary-hover: #60a5fa;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #06b6d4;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
    --threat-low: #10b981;
    --threat-medium: #f59e0b;
    --threat-high: #f97316;
    --threat-critical: #ef4444;
    --badge-bg: #1e2231;
    --badge-text: #a0a5b8;
    --scrollbar-bg: #1e2231;
    --scrollbar-thumb: #3a4058;
}

/* ---- VT100 Terminal Theme ---- */
[data-theme="vt100"] {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #111111;
    --bg-card: #0a0a0a;
    --bg-input: #000000;
    --bg-navbar: rgba(0,0,0,0.95);
    --text-primary: #33ff33;
    --text-secondary: #22cc22;
    --text-muted: #118811;
    --border-color: #1a5c1a;
    --border-light: #0d3d0d;
    --accent-primary: #33ff33;
    --accent-primary-hover: #66ff66;
    --accent-success: #33ff33;
    --accent-warning: #ffff33;
    --accent-danger: #ff3333;
    --accent-info: #33ffff;
    --shadow-sm: 0 0 4px rgba(51,255,51,0.15);
    --shadow-md: 0 0 12px rgba(51,255,51,0.1);
    --shadow-lg: 0 0 30px rgba(51,255,51,0.08);
    --font-body: 'VT323', monospace;
    --font-mono: 'VT323', monospace;
    --threat-low: #33ff33;
    --threat-medium: #ffff33;
    --threat-high: #ff9933;
    --threat-critical: #ff3333;
    --badge-bg: #0d3d0d;
    --badge-text: #33ff33;
    --scrollbar-bg: #0a0a0a;
    --scrollbar-thumb: #1a5c1a;
    --radius-sm: 0;
    --radius-md: 0;
    --radius-lg: 0;
}

/* ============================================================
   Base & Reset
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-bg); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
    background: var(--bg-navbar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.65rem 0;
    z-index: 1050;
}

.brand-icon {
    font-size: 1.4rem;
    color: var(--accent-primary);
}

.brand-text {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.navbar .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.08);
}

.navbar-toggler {
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Dropdown Menus */
.navbar .dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 0.35rem 0;
    min-width: 12rem;
}

.navbar .dropdown-item {
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    transition: all 0.15s ease;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.08);
}

.navbar .dropdown-item.active {
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.08);
}

.navbar .dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
}

.navbar .dropdown-item:hover i,
.navbar .dropdown-item.active i {
    color: var(--accent-primary);
}

.navbar .dropdown-divider {
    border-color: var(--border-light);
    margin: 0.25rem 0;
}

/* Theme Switcher */
.theme-switcher .theme-btn {
    border-color: var(--border-color);
    color: var(--text-muted);
    background: transparent;
    padding: 0.25rem 0.55rem;
    font-size: 0.8rem;
}

.theme-switcher .theme-btn:hover,
.theme-switcher .theme-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

[data-theme="vt100"] .theme-switcher .theme-btn.active {
    color: #000;
}

/* ============================================================
   Cards & Panels
   ============================================================ */
.card,
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.75rem 1.25rem;
}

/* ============================================================
   Hero / Lookup Section
   ============================================================ */
.hero-section {
    padding: 4rem 0 3rem;
    text-align: center;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    line-height: 1.15;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem;
    line-height: 1.5;
}

.hero-title .accent {
    color: var(--accent-primary);
}

/* VT100 hero adjustments */
[data-theme="vt100"] .hero-title {
    font-size: 3.2rem;
    text-shadow: 0 0 8px rgba(51,255,51,0.5);
}

[data-theme="vt100"] .hero-subtitle::before {
    content: "> ";
}

/* Search Box */
.search-box {
    max-width: 680px;
    margin: 0 auto;
}

.search-box .input-group {
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.search-box .form-control {
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    padding: 0.85rem 1.25rem;
    border-right: none;
}

.search-box .form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}

.search-box .form-control::placeholder {
    color: var(--text-muted);
}

.search-box .btn-primary {
    background: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    padding: 0.85rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}

.search-box .btn-primary:hover {
    background: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
}

[data-theme="vt100"] .search-box .form-control {
    border: 1px solid var(--accent-primary);
    caret-color: var(--accent-primary);
}

[data-theme="vt100"] .search-box .btn-primary {
    color: #000;
    font-weight: 700;
}

/* ============================================================
   Stats Bar
   ============================================================ */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.1rem;
}

/* ============================================================
   Results Section
   ============================================================ */
.results-section {
    padding: 2rem 0 3rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.25rem;
}

.result-card {
    padding: 1.25rem;
}

.result-card .card-title {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.result-card .card-title i {
    color: var(--accent-primary);
    margin-right: 0.4rem;
    width: 16px;
    text-align: center;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.35rem 0;
    font-size: 0.88rem;
}

.data-row:not(:last-child) {
    border-bottom: 1px solid var(--border-light);
}

.data-label {
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
    margin-right: 1rem;
}

.data-value {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    word-break: break-all;
}

/* ============================================================
   Threat Assessment
   ============================================================ */
.threat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.threat-badge.threat-low       { background: rgba(5,150,105,0.12); color: var(--threat-low); }
.threat-badge.threat-medium    { background: rgba(217,119,6,0.12); color: var(--threat-medium); }
.threat-badge.threat-high      { background: rgba(234,88,12,0.12); color: var(--threat-high); }
.threat-badge.threat-critical  { background: rgba(220,38,38,0.12); color: var(--threat-critical); }

.threat-score-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.threat-score-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.threat-score-fill.threat-low      { background: var(--threat-low); }
.threat-score-fill.threat-medium   { background: var(--threat-medium); }
.threat-score-fill.threat-high     { background: var(--threat-high); }
.threat-score-fill.threat-critical { background: var(--threat-critical); }

/* Blacklist badges */
.blacklist-tag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    background: var(--badge-bg);
    color: var(--badge-text);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin: 0.15rem;
}

.blacklist-tag.listed {
    background: rgba(220,38,38,0.1);
    color: var(--accent-danger);
    border-color: rgba(220,38,38,0.25);
}

/* ISP lookup links */
.isp-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.15s ease;
}
.isp-link:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

/* ============================================================
   Forms
   ============================================================ */
.form-control,
.form-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-input);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-label {
    font-weight: 500;
    font-size: 0.88rem;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
}

[data-theme="vt100"] .form-control,
[data-theme="vt100"] .form-select {
    border: 1px solid var(--accent-primary);
    font-family: 'VT323', monospace;
    font-size: 1.05rem;
}

/* ============================================================
   Buttons (extending Bootstrap)
   ============================================================ */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
}

.btn-outline-primary {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
    background: var(--accent-primary);
    color: #fff;
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline-danger {
    color: var(--accent-danger);
    border-color: var(--accent-danger);
}

.btn-outline-danger:hover {
    background: var(--accent-danger);
    color: #fff;
}

[data-theme="vt100"] .btn-primary {
    background: var(--accent-primary);
    color: #000;
    border-color: var(--accent-primary);
}

[data-theme="vt100"] .btn-outline-primary {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

[data-theme="vt100"] .btn-outline-primary:hover {
    color: #000;
}

/* ============================================================
   API Key Display
   ============================================================ */
.api-key-display {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    word-break: break-all;
    position: relative;
}

.api-key-display .copy-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.api-key-display .copy-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid;
}

.alert-success {
    background: rgba(5,150,105,0.08);
    color: var(--accent-success);
    border-color: rgba(5,150,105,0.2);
}

.alert-danger {
    background: rgba(220,38,38,0.08);
    color: var(--accent-danger);
    border-color: rgba(220,38,38,0.2);
}

.alert-info {
    background: rgba(8,145,178,0.08);
    color: var(--accent-info);
    border-color: rgba(8,145,178,0.2);
}

/* ============================================================
   Profile / Auth Pages
   ============================================================ */
.auth-container {
    max-width: 480px;
    margin: 3rem auto;
}

.auth-card {
    padding: 2rem;
}

.auth-card .auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-card .auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.profile-container {
    max-width: 760px;
    margin: 2rem auto;
}

/* ============================================================
   Documentation Page
   ============================================================ */
.docs-section {
    padding: 2rem 0 3rem;
}

.docs-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-primary);
    display: inline-block;
}

.code-block {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.5;
}

[data-theme="vt100"] .code-block {
    font-size: 1rem;
    border-color: var(--accent-primary);
}

/* ============================================================
   VT100 Scanline effect
   ============================================================ */
[data-theme="vt100"] body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0,0,0,0.03) 0px,
        rgba(0,0,0,0.03) 1px,
        transparent 1px,
        transparent 3px
    );
}

[data-theme="vt100"] * {
    text-shadow: 0 0 3px rgba(51,255,51,0.3);
}

[data-theme="vt100"] .navbar-brand .brand-text::before {
    content: "[";
}
[data-theme="vt100"] .navbar-brand .brand-text::after {
    content: "]";
}

/* ============================================================
   Footer
   ============================================================ */
.app-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* ============================================================
   Loading spinner
   ============================================================ */
.spinner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.spinner-overlay.active {
    display: flex;
}

.spinner-ring {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Network Map — AS Tree Diagram
   ============================================================ */
.as-tree {
    padding: 1.5rem;
}

.as-tree-root {
    display: flex;
    justify-content: center;
}

.as-node {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--accent-primary);
    color: #fff;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    font-family: var(--font-mono);
}

.as-node .as-number {
    font-weight: 400;
    opacity: 0.8;
    font-size: 0.82rem;
}

[data-theme="vt100"] .as-node {
    color: #000;
}

.as-tree-connector {
    width: 2px;
    height: 24px;
    background: var(--border-color);
    margin: 0 auto;
}

.as-tree-children {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
    position: relative;
}

.as-tree-children::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 2px;
    background: var(--border-color);
    width: calc(100% - 80px);
    max-width: 100%;
}

.as-tree-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.75rem;
    position: relative;
}

.as-branch-connector {
    width: 2px;
    height: 20px;
    background: var(--border-color);
}

.ip-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 2px solid;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    min-width: 140px;
    margin-bottom: 0.75rem;
}

.ip-node:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ip-node-ip {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.88rem;
}

.ip-node-score {
    font-size: 0.75rem;
    margin-top: 0.2rem;
    opacity: 0.85;
}

.ip-node-low {
    background: rgba(5,150,105,0.08);
    border-color: var(--threat-low);
    color: var(--threat-low);
}

.ip-node-medium {
    background: rgba(217,119,6,0.08);
    border-color: var(--threat-medium);
    color: var(--threat-medium);
}

.ip-node-high {
    background: rgba(234,88,12,0.08);
    border-color: var(--threat-high);
    color: var(--threat-high);
}

.ip-node-critical {
    background: rgba(220,38,38,0.08);
    border-color: var(--threat-critical);
    color: var(--threat-critical);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .hero-title { font-size: 1.9rem; }
    .hero-subtitle { font-size: 1rem; }
    .result-grid { grid-template-columns: 1fr; }
    .stats-bar { gap: 1.5rem; }
    .auth-container { margin: 1.5rem; }
    .profile-container { margin: 1rem; }
    .as-tree-children { flex-direction: column; align-items: center; }
    .as-tree-children::before { display: none; }
    .ip-node { min-width: 120px; }
}

/* ============================================================
   Threat Intelligence Dashboard
   ============================================================ */
.dashboard-chart-wrap {
    position: relative;
    height: 320px;
    width: 100%;
}

.dashboard-sparkline-wrap {
    position: relative;
    height: 150px;
    width: 100%;
}

.dashboard-map-wrap {
    position: relative;
    width: 100%;
    height: 420px;
}

.dashboard-map-wrap #worldMap {
    width: 100%;
    height: 100%;
}

.dashboard-table-wrap {
    max-height: 320px;
    overflow-y: auto;
}

.dashboard-table-wrap .table {
    color: var(--text-primary);
}

.dashboard-table-wrap .table th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-color);
}

/* Drill-down modal table */
.drilldown-table {
    color: var(--text-primary);
}

.drilldown-table th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-color);
}

.drilldown-table td {
    border-color: var(--border-light);
}

#drilldownModal .modal-content {
    color: var(--text-primary);
}

#drilldownModal .btn-close {
    filter: var(--btn-close-filter, none);
}

[data-theme="dark"] #drilldownModal .btn-close,
[data-theme="vt100"] #drilldownModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.dashboard-country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.4rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.dashboard-country-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease;
    color: var(--text-primary);
}

.dashboard-country-option:hover {
    background: var(--bg-tertiary);
}

/* ============================================================
   ASM Dashboard (§5)
   ============================================================ */

/* §5.1 — Summary Statistic Cards */
.asm-stat-card {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.asm-stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.asm-stat-card.asm-stat-critical {
    border-left: 4px solid var(--threat-critical);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(220,38,38,0.06) 100%);
}

.asm-stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.asm-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.asm-stat-denominator {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.asm-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* §5.2 — Charts */
.asm-chart-wrap {
    position: relative;
    width: 100%;
    height: 260px;
}

.asm-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* §5.4 — Exposure Timeline Heatmap */
.asm-heatmap-wrap {
    width: 100%;
    overflow-x: auto;
    padding: 0.25rem 0;
}

.asm-heatmap {
    display: inline-flex;
    gap: 2px;
}

.asm-heatmap-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.asm-heatmap-cell {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    background: var(--bg-tertiary);
    cursor: default;
    position: relative;
}

.asm-heatmap-cell[data-count="0"] {
    background: var(--bg-tertiary);
}

.asm-heatmap-cell.asm-heat-1 {
    background: rgba(5,150,105,0.25);
}

.asm-heatmap-cell.asm-heat-2 {
    background: rgba(5,150,105,0.50);
}

.asm-heatmap-cell.asm-heat-3 {
    background: rgba(5,150,105,0.75);
}

.asm-heatmap-cell.asm-heat-4 {
    background: var(--accent-success);
}

/* Dark theme heatmap uses accent colours */
[data-theme="dark"] .asm-heatmap-cell.asm-heat-1 { background: rgba(59,130,246,0.20); }
[data-theme="dark"] .asm-heatmap-cell.asm-heat-2 { background: rgba(59,130,246,0.40); }
[data-theme="dark"] .asm-heatmap-cell.asm-heat-3 { background: rgba(59,130,246,0.65); }
[data-theme="dark"] .asm-heatmap-cell.asm-heat-4 { background: var(--accent-primary); }

/* VT100 theme heatmap */
[data-theme="vt100"] .asm-heatmap-cell.asm-heat-1 { background: rgba(51,255,51,0.15); }
[data-theme="vt100"] .asm-heatmap-cell.asm-heat-2 { background: rgba(51,255,51,0.35); }
[data-theme="vt100"] .asm-heatmap-cell.asm-heat-3 { background: rgba(51,255,51,0.60); }
[data-theme="vt100"] .asm-heatmap-cell.asm-heat-4 { background: #33ff33; }

.asm-heatmap-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    pointer-events: none;
    color: var(--text-primary);
}

.asm-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.asm-heatmap-legend-cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.asm-heatmap-day-labels {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 4px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.asm-heatmap-day-labels span {
    height: 14px;
    line-height: 14px;
}

@media (max-width: 768px) {
    .asm-stat-value { font-size: 1.4rem; }
    .asm-chart-wrap { height: 200px; }
    .asm-heatmap-cell { width: 11px; height: 11px; }
}

/* ---- Community Score ---- */
.community-score-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
    display: flex;
}

.community-score-fill {
    height: 100%;
    transition: width 0.6s ease;
}

.community-score-fill.community-malicious {
    background: var(--accent-danger);
    border-radius: 3px 0 0 3px;
}

.community-score-fill.community-clean {
    background: var(--accent-success);
    border-radius: 0 3px 3px 0;
}

.community-vote-buttons {
    display: flex;
    gap: 0.5rem;
}

.community-vote-btn {
    flex: 1;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.community-vote-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.community-vote-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.community-vote-btn.vote-malicious.active {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
    color: #fff;
}

.community-vote-btn.vote-clean.active {
    background: var(--accent-success);
    border-color: var(--accent-success);
    color: #fff;
}

/* ---- Blog article body ---- */
.blog-article-body h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.blog-article-body h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.blog-article-body p {
    margin-bottom: 1rem;
}

.blog-article-body ul,
.blog-article-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.blog-article-body pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.blog-article-body code {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    background: var(--bg-tertiary);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.blog-article-body pre code {
    background: none;
    padding: 0;
}

.blog-article-body blockquote {
    border-left: 4px solid var(--accent-primary);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background: var(--bg-tertiary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.blog-article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
}

.blog-article-body a {
    color: var(--accent-primary);
    text-decoration: underline;
}

.blog-article-body a:hover {
    color: var(--accent-primary-hover);
}
