/* ============================================
   EDX Security Hub — Unified Design System
   ============================================
   One file to rule them all. Every page links this
   and adds only page-specific styles in <style> tags.
   ============================================ */

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

:root {
    /* Brand */
    --primary: #ff2a2a;
    --primary-dark: #cc0000;
    --primary-light: #ff5555;
    --primary-glow: rgba(255, 42, 42, 0.3);

    /* Surfaces */
    --bg-dark: #0a0a0a;
    --bg-darker: #050505;
    --bg-card: #111111;
    --bg-elevated: #1a1a1a;
    --bg-input: #0d0d0d;

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #6b7280;
    --text-dim: #444444;

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(255, 42, 42, 0.3);
    --border-hover: rgba(255, 42, 42, 0.5);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 42, 42, 0.2);

    /* Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --t-fast: 0.15s ease;
    --t: 0.25s ease;
    --t-slow: 0.4s ease;
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #060606;
    color: var(--text-primary);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

/* Ambient glow — removed, was causing overlay issue */
body::before { display: none; }

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-darker); }
::-webkit-scrollbar-thumb { background: var(--primary-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============================================
   Protection Banner
   ============================================ */

.protection-message {
    text-align: center;
    padding: 10px 16px;
    font-size: 13px;
    color: #ff8888;
    background: #1a0101;
    border-bottom: 1px solid var(--primary);
    letter-spacing: 1px;
    font-weight: 500;
    position: relative;
    z-index: 10;
}

.protection-message i { margin-right: 8px; }

/* ============================================
   Navbar
   ============================================ */

.navbar {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-glow);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.nav-brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.nav-brand .logo {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.nav-brand .sub {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--t);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-links a.active {
    color: var(--primary);
    background: rgba(255, 42, 42, 0.1);
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    text-align: center;
    padding: 24px 16px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 40px;
    position: relative;
    z-index: 5;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--t);
}

.footer a:hover { color: var(--primary); }

/* ============================================
   Content Container
   ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 24px;
    position: relative;
    z-index: 5;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--t);
}

.card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i { color: var(--primary); }

/* ============================================
   Grid System
   ============================================ */

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--t);
    text-decoration: none;
}

.btn-primary {
    background: #ff2a2a;
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 4px 15px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(255, 0, 0, 0.1);
    color: #ff6666;
    border: 1px solid rgba(255, 0, 0, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 0, 0, 0.2);
}

/* ============================================
   Inputs
   ============================================ */

.input, textarea.input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--t);
}

.input:focus, textarea.input:focus {
    outline: none;
    border-color: var(--border-hover);
}

.input::placeholder { color: var(--text-muted); }

/* ============================================
   Badges & Tags
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-red { background: rgba(255, 0, 0, 0.1); color: #ff6666; }
.badge-green { background: rgba(0, 200, 100, 0.1); color: #44cc88; }
.badge-blue { background: rgba(0, 100, 255, 0.1); color: #4499ff; }
.badge-muted { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); }

/* ============================================
   Tool Grid (shared across tools.html, homepage)
   ============================================ */

.tool-category {
    margin-bottom: 32px;
}

.tool-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    cursor: pointer;
    user-select: none;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--t);
}

.tool-category-header:hover {
    border-color: var(--border-glow);
}

.tool-category-header h3 {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
}

.tool-category-header i.cat-icon {
    color: var(--primary);
    font-size: 18px;
}

.tool-category-header .chevron {
    color: var(--text-muted);
    transition: transform var(--t);
    font-size: 14px;
}

.tool-category-header.collapsed .chevron {
    transform: rotate(-90deg);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.tool-grid.hidden { display: none; }

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all var(--t);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--t);
}

.tool-card:hover {
    border-color: var(--border-glow);
    background: var(--bg-elevated);
    transform: translateY(-2px);
}

.tool-card:hover::before { transform: scaleX(1); }

.tool-card i {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 10px;
    display: block;
}

.tool-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.tool-card p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ============================================
   Stats Cards
   ============================================ */

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--t);
}

.stat-card:hover {
    border-color: var(--border-glow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: rgba(255, 42, 42, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
}

.stat-info p {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   Section Title
   ============================================ */

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i { color: var(--primary); }

.section-title .line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ============================================
   Animations
   ============================================ */

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

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.fade-in { animation: fadeIn 0.3s ease; }

/* ============================================
   Search Bar
   ============================================ */

.search-bar {
    width: 100%;
    padding: 12px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--t);
    margin-bottom: 20px;
}

.search-bar:focus {
    outline: none;
    border-color: var(--border-hover);
}

/* ============================================
   Loading Spinner
   ============================================ */

.loading {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

.loading i { animation: spin 1s linear infinite; }

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p { font-size: 14px; }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .navbar {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(10, 10, 10, 0.98);
        padding: 12px;
        gap: 4px;
        border-bottom: 1px solid var(--border-glow);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    }

    .nav-links.open {
        display: flex;
        animation: slideDown 0.2s ease;
    }

    .nav-toggle { display: block; }

    .nav-links a { width: 100%; padding: 12px 16px; }

    /* Auth area: show inside mobile menu when open */
    .nav-auth { 
        display: none; flex-direction: column; width: 100%; gap: 8px; margin-top: 8px;
        position: absolute; top: 100%; left: 0; right: 0;
        background: rgba(10, 10, 10, 0.98); padding: 12px;
        border-bottom: 1px solid var(--border-glow);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    }
    .nav-links.open ~ .nav-auth { display: flex; animation: slideDown 0.2s ease; }

    .container { padding: 20px 16px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .tool-grid { grid-template-columns: 1fr 1fr; }
    .page-header h1 { font-size: 1.5rem; }


}

@media (max-width: 480px) {
    .tool-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================
   Utility Classes
   ============================================ */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none; }
.w-full { width: 100%; }


/* ============================================
   Print Styles
   ============================================ */
@media print {
    .navbar, .nav-toggle, .nav-auth, .footer, .protection-message {
        display: none !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .container {
        padding: 0 !important;
        max-width: 100% !important;
    }
    .tool-card, .cat-filter, .help-card, .lesson-card, .script-card {
        border: 1px solid #ccc !important;
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
    h1, h2, h3, h4, h5, h6, p, li, td, th, span, div, code, pre {
        color: #000 !important;
    }
    .result-area {
        border: 1px solid #ccc !important;
        background: #f5f5f5 !important;
        color: #000 !important;
    }
}