/*
 * Mehr Guard Threat Analysis Page Styles
 * Premium Dark Theme with Attack Breakdown
 * 
 * Accessibility: WCAG 2.1 AA compliant
 */

/* ==========================================================================
   CSS CUSTOM PROPERTIES
   ========================================================================== */
:root {
    /* Brand Colors */
    --primary: #195de6;
    --primary-dark: #1040a8;
    --primary-light: #548bf7;
    --primary-glow: rgba(25, 93, 230, 0.15);
    --accent-blue: #3b82f6;

    /* Status Colors */
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --danger-glow: rgba(239, 68, 68, 0.3);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);

    /* Background Colors - Matching dashboard blue-tinted theme */
    --bg-light: #f6f6f8;
    --bg-dark: #0f1115;
    --sidebar-bg: #111318;
    --surface-dark: #161b22;
    --surface-card: #1c2129;
    --surface-hover: #21262d;
    --border-dark: #292e38;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Layout */
    --sidebar-width: 18rem;
    --header-height: 4rem;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace;

    /* Shadows */
    --shadow-glow-red: 0 0 20px -5px var(--danger-glow);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 300ms ease;
}

/* ==========================================================================
   LIGHT MODE OVERRIDES
   ========================================================================== */
[data-theme="light"],
html.light,
body.light {
    /* Background Colors */
    --bg-light: #ffffff;
    --bg-dark: #f8fafc;
    --sidebar-bg: #ffffff;
    --surface-dark: #ffffff;
    --surface-card: #ffffff;
    --surface-hover: #f1f5f9;
    --border-dark: #e2e8f0;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Status Colors - slightly adjusted for light mode visibility */
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --primary: #2563eb;

    /* Shadows */
    --shadow-glow-red: 0 0 20px -5px rgba(220, 38, 38, 0.15);
}

/* System preference detection for light mode */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]):not(.dark) {
        --bg-light: #ffffff;
        --bg-dark: #f8fafc;
        --sidebar-bg: #ffffff;
        --surface-dark: #ffffff;
        --surface-card: #ffffff;
        --surface-hover: #f1f5f9;
        --border-dark: #e2e8f0;
        --text-primary: #0f172a;
        --text-secondary: #64748b;
        --text-muted: #94a3b8;
    }
}

/* Light mode element-specific overrides */
[data-theme="light"] .threat-hero,
html.light .threat-hero,
body.light .threat-hero {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-color: #e2e8f0;
}

[data-theme="light"] .hero-blur,
html.light .hero-blur,
body.light .hero-blur {
    background-color: rgba(220, 38, 38, 0.1);
}

[data-theme="light"] .top-header,
html.light .top-header,
body.light .top-header {
    background-color: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .version-card,
html.light .version-card,
body.light .version-card {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
}

[data-theme="light"] .history-container,
html.light .history-container,
body.light .history-container {
    background-color: #ffffff;
    border-color: #e2e8f0;
}

/* CRITICAL FIX: History items must have white background in light mode */
[data-theme="light"] .history-item,
html.light .history-item,
body.light .history-item {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .history-item:hover,
html.light .history-item:hover,
body.light .history-item:hover {
    background-color: #f1f5f9 !important;
}

/* History item icon container - must be light in light mode */
[data-theme="light"] .history-icon-container,
html.light .history-icon-container,
body.light .history-icon-container {
    background-color: rgba(16, 185, 129, 0.1);
}

[data-theme="light"] .history-icon-container.danger,
html.light .history-icon-container.danger,
body.light .history-icon-container.danger {
    background-color: rgba(239, 68, 68, 0.1);
}

[data-theme="light"] .history-icon-container.warning,
html.light .history-icon-container.warning,
body.light .history-icon-container.warning {
    background-color: rgba(245, 158, 11, 0.1);
}

/* History item text */
[data-theme="light"] .history-url,
html.light .history-url,
body.light .history-url {
    color: #0f172a;
}

[data-theme="light"] .history-details,
html.light .history-details,
body.light .history-details {
    color: #64748b;
}

[data-theme="light"] .tag,
html.light .tag,
body.light .tag {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}

[data-theme="light"] .engine-status,
html.light .engine-status,
body.light .engine-status {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
}

[data-theme="light"] .engine-status span:last-child,
html.light .engine-status span:last-child,
body.light .engine-status span:last-child {
    color: #334155;
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.threat-body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

::selection {
    background-color: var(--danger);
    color: white;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #111621;
}

::-webkit-scrollbar-thumb {
    background: #292e38;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a4150;
}

/* Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 24px;
}

.material-symbols-outlined.filled {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.threat-layout {
    display: flex;
    height: 100vh;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-dark);
    display: none;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    z-index: 20;
}

@media (min-width: 768px) {
    .sidebar {
        display: flex;
    }
}

.sidebar-header {
    padding: var(--space-6);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-xl);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    border: none;
}

.logo-icon .material-symbols-outlined {
    color: white;
    font-size: 24px;
}

.logo-text h1 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.logo-text p {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: rgba(25, 93, 230, 0.1);
    color: var(--primary);
}

.nav-link.active .material-symbols-outlined {
    color: var(--primary);
}

.sidebar-footer {
    margin-top: auto;
    padding: var(--space-6);
    border-top: 1px solid var(--border-dark);
}

.version-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    background-color: var(--surface-card);
    border: 1px solid var(--border-dark);
}

.version-info {
    display: flex;
    flex-direction: column;
}

.version-number {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.version-status {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.75rem;
    color: var(--success);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--success);
}

.status-dot.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.version-card .material-symbols-outlined {
    color: var(--text-muted);
}

/* ==========================================================================
   MAIN CONTENT
   ========================================================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background-color: var(--bg-dark);
    position: relative;
}

/* ==========================================================================
   TOP HEADER
   ========================================================================== */
.top-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-dark);
    background-color: rgba(15, 18, 24, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.menu-toggle:hover {
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }
}

/* Breadcrumbs are hidden as per design requirements */
.breadcrumbs {
    display: none !important;
}

.breadcrumbs span {
    color: var(--text-muted);
}

.breadcrumbs .separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.breadcrumbs .current {
    color: var(--text-primary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.engine-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
    border-radius: var(--radius-full);
    background-color: var(--surface-card);
    border: 1px solid var(--border-dark);
}

.engine-status .status-dot {
    width: 8px;
    height: 8px;
}

.engine-status span:last-child {
    font-size: 0.75rem;
    font-weight: 500;
    color: #cbd5e1;
}

.header-divider {
    width: 1px;
    height: 1.5rem;
    background-color: var(--border-dark);
    margin: 0 var(--space-2);
    display: none;
}

@media (min-width: 640px) {
    .header-divider {
        display: block;
    }
}

.notification-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notification-btn:hover {
    background-color: var(--surface-dark);
    color: var(--text-primary);
}

.notification-btn .material-symbols-outlined {
    font-size: 22px;
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

/* ==========================================================================
   CONTENT SCROLL
   ========================================================================== */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    .content-scroll {
        padding: var(--space-8);
    }
}

@media (min-width: 1024px) {
    .content-scroll {
        padding: var(--space-10);
    }
}

.content-container {
    max-width: 90rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

/* ==========================================================================
   THREAT HERO CARD
   ========================================================================== */
.threat-hero {
    position: relative;
    background: linear-gradient(135deg, var(--surface-card), var(--surface-dark));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-2xl);
    padding: var(--space-1);
    box-shadow: var(--shadow-glow-red);
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Threat hero - WARNING state (yellow/amber) */
.threat-hero.warning {
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.15);
}

.threat-hero.warning .hero-blur {
    background-color: rgba(245, 158, 11, 0.2);
}

.threat-hero.warning .threat-icon {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.threat-hero.warning .threat-icon .material-symbols-outlined {
    color: var(--warning);
}

.threat-hero.warning .threat-badge {
    background-color: var(--warning);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.threat-hero.warning .score-value {
    color: var(--warning);
}

.threat-hero.warning .progress-fill {
    background-color: var(--warning);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* Threat hero - SAFE state (green) */
.threat-hero.safe {
    border: 1px solid rgba(34, 197, 94, 0.3);
    box-shadow: 0 0 40px rgba(34, 197, 94, 0.15);
}

.threat-hero.safe .hero-blur {
    background-color: rgba(34, 197, 94, 0.2);
}

.threat-hero.safe .threat-icon {
    background-color: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
}

.threat-hero.safe .threat-icon .material-symbols-outlined {
    color: var(--success);
}

.threat-hero.safe .threat-badge {
    background-color: var(--success);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.threat-hero.safe .score-value {
    color: var(--success);
}

.threat-hero.safe .progress-fill {
    background-color: var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

/* Threat hero - LOW (caution - blue) */
.threat-hero.caution {
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.15);
}

.threat-hero.caution .hero-blur {
    background-color: rgba(59, 130, 246, 0.2);
}

.threat-hero.caution .threat-icon {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}

.threat-hero.caution .threat-icon .material-symbols-outlined {
    color: #3b82f6;
}

.threat-hero.caution .threat-badge {
    background-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.threat-hero.caution .score-value {
    color: #3b82f6;
}

.threat-hero.caution .progress-fill {
    background-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Threat hero - INFO (No Activity - blue, lighter) */
.threat-hero.info {
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.15);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, transparent 100%);
}

.threat-hero.info .hero-blur {
    background-color: rgba(59, 130, 246, 0.15);
}

.threat-hero.info .threat-icon {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.25);
}

.threat-hero.info .threat-icon .material-symbols-outlined {
    color: #3b82f6;
}

.threat-hero.info .threat-badge {
    background-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.threat-hero.info .score-value {
    color: #3b82f6;
}

.threat-hero.info .progress-fill {
    background-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.hero-blur {
    position: absolute;
    right: -5rem;
    top: -5rem;
    width: 16rem;
    height: 16rem;
    background-color: var(--danger-bg);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    transition: background-color 0.3s ease;
}

.hero-content {
    position: relative;
    z-index: 1;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

@media (min-width: 768px) {
    .hero-content {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        padding: var(--space-8);
    }
}

.hero-left {
    display: flex;
    align-items: flex-start;
    gap: var(--space-6);
}

.threat-icon {
    flex-shrink: 0;
    width: 5rem;
    height: 5rem;
    border-radius: var(--radius-xl);
    background-color: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.threat-icon .material-symbols-outlined {
    font-size: 3rem;
    color: var(--danger);
}

.threat-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.threat-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-2);
}

.threat-title-row h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

@media (min-width: 768px) {
    .threat-title-row h2 {
        font-size: 1.875rem;
    }
}

.threat-badge {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background-color: var(--danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.threat-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 36rem;
    line-height: 1.6;
}

.threat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: var(--space-1) var(--space-2);
    padding-left: 0.625rem;
    border-radius: var(--radius-md);
    background-color: var(--surface-hover);
    border: 1px solid var(--border-dark);
    font-size: 0.75rem;
    font-weight: 500;
    color: #cbd5e1;
}

.tag .material-symbols-outlined {
    font-size: 16px;
}

.tag .material-symbols-outlined.danger {
    color: var(--danger);
}

.tag .material-symbols-outlined.warning {
    color: var(--warning);
}

.tag .material-symbols-outlined.info {
    color: var(--accent-blue);
}

.hero-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
}

.confidence-score {
    text-align: right;
}

.score-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--danger);
}

.threat-progress {
    height: 0.375rem;
    width: 100%;
    background-color: var(--surface-hover);
    margin-top: var(--space-4);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    transition: width var(--transition-slow);
}

/* ==========================================================================
   HISTORY SECTION
   ========================================================================== */
.history-section {
    background-color: var(--surface-card);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background-color: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.history-item:hover {
    background-color: var(--surface-hover);
    border-color: var(--primary);
}

.history-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background-color: rgba(16, 185, 129, 0.1);
}

.history-icon.safe {
    background-color: rgba(16, 185, 129, 0.1);
}

.history-icon.safe .material-symbols-outlined {
    color: var(--success);
}

.history-icon.danger {
    background-color: rgba(239, 68, 68, 0.1);
}

.history-icon.danger .material-symbols-outlined {
    color: var(--danger);
}

.history-icon.warning {
    background-color: rgba(245, 158, 11, 0.1);
}

.history-icon.warning .material-symbols-outlined {
    color: var(--warning);
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-url {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-1);
}

.history-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.history-badge.safe {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.history-badge.danger {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.history-badge.warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.history-badge.unknown {
    background-color: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
}

.history-icon.unknown {
    background-color: rgba(100, 116, 139, 0.1);
}

.history-icon.unknown .material-symbols-outlined {
    color: #94a3b8;
}

.history-time,
.history-score {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    text-align: center;
    color: var(--text-muted);
}

.history-empty .material-symbols-outlined {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
    opacity: 0.5;
}

.history-empty p {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.history-empty .empty-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: var(--space-2);
    opacity: 0.7;
}

/* Blue variant for "No Activity" state */
.history-empty.blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.02) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.history-empty.blue .material-symbols-outlined {
    color: #3b82f6;
    opacity: 0.8;
}

.history-empty.blue p {
    color: #3b82f6;
}

.history-empty.blue .empty-hint {
    color: #60a5fa;
    opacity: 0.8;
}

/* Light mode overrides for history section */
[data-theme="light"] .history-section,
html.light .history-section,
body.light .history-section {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .history-list,
html.light .history-list,
body.light .history-list {
    background-color: transparent !important;
}

[data-theme="light"] .history-item,
html.light .history-item,
body.light .history-item {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .history-item:hover,
html.light .history-item:hover,
body.light .history-item:hover {
    background-color: #f1f5f9 !important;
    border-color: #2563eb !important;
}

[data-theme="light"] .history-url,
html.light .history-url,
body.light .history-url {
    color: #0f172a !important;
}

[data-theme="light"] .history-time,
[data-theme="light"] .history-score,
html.light .history-time,
html.light .history-score,
body.light .history-time,
body.light .history-score {
    color: #64748b !important;
}

[data-theme="light"] .history-empty,
html.light .history-empty,
body.light .history-empty {
    color: #64748b !important;
}

[data-theme="light"] .history-empty .material-symbols-outlined,
html.light .history-empty .material-symbols-outlined,
body.light .history-empty .material-symbols-outlined {
    color: #94a3b8 !important;
}

[data-theme="light"] .history-url,
html.light .history-url,
body.light .history-url {
    color: #0f172a !important;
}

[data-theme="light"] .history-time,
[data-theme="light"] .history-score,
html.light .history-time,
html.light .history-score,
body.light .history-time,
body.light .history-score {
    color: #64748b !important;
}

[data-theme="light"] .history-empty,
html.light .history-empty,
body.light .history-empty {
    color: #64748b !important;
}

[data-theme="light"] .history-empty .material-symbols-outlined,
html.light .history-empty .material-symbols-outlined,
body.light .history-empty .material-symbols-outlined {
    color: #94a3b8 !important;
}

/* Blue empty state keeps blue colors in light mode */
[data-theme="light"] .history-empty.blue,
html.light .history-empty.blue,
body.light .history-empty.blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.03) 100%) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
}

[data-theme="light"] .history-empty.blue .material-symbols-outlined,
html.light .history-empty.blue .material-symbols-outlined,
body.light .history-empty.blue .material-symbols-outlined {
    color: #2563eb !important;
}

[data-theme="light"] .history-empty.blue p,
html.light .history-empty.blue p,
body.light .history-empty.blue p {
    color: #2563eb !important;
}

[data-theme="light"] .history-empty.blue .empty-hint,
html.light .history-empty.blue .empty-hint,
body.light .history-empty.blue .empty-hint {
    color: #3b82f6 !important;
}

/* ==========================================================================
   THREAT GRID
   ========================================================================== */
.threat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

@media (min-width: 1280px) {
    .threat-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.side-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.scan-id {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* ==========================================================================
   ATTACK CARDS
   ========================================================================== */
.attack-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.attack-card[open] {
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
}

.attack-card.blue[open] {
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
}

.attack-card.warning[open] {
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.5);
}

.attack-card.primary[open] {
    box-shadow: 0 0 0 1px rgba(25, 93, 230, 0.5);
}

.attack-card>summary {
    list-style: none;
}

.attack-card>summary::-webkit-details-marker {
    display: none;
}

.attack-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition-fast);
}

.attack-header:hover {
    background-color: rgba(42, 50, 69, 0.5);
}

.attack-title {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.attack-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
}

.attack-card.blue .attack-icon {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.attack-card.warning .attack-icon {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.attack-card.primary .attack-icon {
    background-color: var(--primary-glow);
    color: var(--primary);
}

.attack-icon .material-symbols-outlined {
    font-size: 20px;
}

.attack-info h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.attack-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.expand-icon {
    color: var(--text-muted);
    transition: transform var(--transition-normal);
}

.attack-card[open] .expand-icon {
    transform: rotate(180deg);
}

.attack-content {
    padding: var(--space-4) var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid rgba(46, 53, 69, 0.5);
    background-color: rgba(15, 18, 24, 0.3);
}

/* Domain Comparison */
.domain-comparison {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    background-color: var(--surface-dark);
    border: 1px solid var(--border-dark);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
    .domain-comparison {
        grid-template-columns: repeat(2, 1fr);
    }
}

.domain-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.domain-label {
    font-size: 0.75rem;
    font-family: var(--font-sans);
    color: var(--text-muted);
}

.domain-value {
    color: var(--text-primary);
    word-break: break-all;
}

.domain-value.danger {
    color: var(--danger);
}

.attack-explanation {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Redirect Timeline */
.redirect-timeline {
    position: relative;
    list-style: none;
    border-left: 1px solid #475569;
    margin-left: var(--space-3);
    padding-left: 0;
}

.timeline-item {
    position: relative;
    margin-left: var(--space-6);
    padding-bottom: var(--space-6);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: calc(-1 * var(--space-6) - 6px);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #475569;
    box-shadow: 0 0 0 4px var(--surface-card);
}

.timeline-item.start .timeline-dot {
    background-color: #475569;
}

.timeline-item.warning .timeline-dot {
    background-color: var(--warning);
}

.timeline-item.danger .timeline-dot {
    background-color: var(--danger);
}

.timeline-item.danger .timeline-dot.pulse {
    animation: pulse 2s infinite;
}

.timeline-content h5 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.timeline-item.danger .timeline-content h5 {
    color: var(--danger);
}

.timeline-content code {
    display: block;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    word-break: break-all;
}

.timeline-content code.danger {
    color: var(--danger);
}

/* Code Block */
.code-block {
    padding: var(--space-3);
    background-color: #111;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.code-block code {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--success);
    white-space: nowrap;
}

/* ==========================================================================
   ACTIONS CARD
   ========================================================================== */
.actions-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.actions-card h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.actions-card h3 .material-symbols-outlined {
    color: var(--accent-blue);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.btn-danger {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background-color: var(--danger);
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
    transition: background-color var(--transition-fast);
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-secondary {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background-color: var(--surface-hover);
    border: 1px solid var(--border-dark);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background-color: var(--surface-dark);
    border-color: #475569;
}

.btn-secondary .material-symbols-outlined {
    color: var(--text-muted);
}

.security-explainer {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-dark);
}

.security-explainer h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.security-reasons {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.security-reasons li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: 0.875rem;
    color: #cbd5e1;
}

.security-reasons .material-symbols-outlined {
    color: var(--danger);
    font-size: 1.125rem;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ==========================================================================
   META CARD
   ========================================================================== */
.meta-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}

.meta-card h3 {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.meta-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meta-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.meta-value {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.meta-value .material-symbols-outlined {
    font-size: 16px;
}

.offline-guarantee {
    margin-top: var(--space-4);
    padding: var(--space-3);
    background-color: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-md);
}

.offline-guarantee p {
    font-size: 0.625rem;
    color: var(--accent-blue);
    line-height: 1.6;
}

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background-color: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-full);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.toast.hidden {
    display: none;
}

.toast-icon {
    color: var(--success);
}

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.hidden {
    display: none !important;
}

/* Focus states */
button:focus-visible,
a:focus-visible,
details:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==========================================================================
   LIGHT MODE - Attack Card Content Fixes
   ========================================================================== */

/* Fix the gray box in attack cards (domain comparison section) */
[data-theme="light"] .domain-comparison,
html.light .domain-comparison,
body.light .domain-comparison {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .domain-label,
html.light .domain-label,
body.light .domain-label {
    color: #64748b !important;
}

[data-theme="light"] .domain-value,
html.light .domain-value,
body.light .domain-value {
    color: #0f172a !important;
}

[data-theme="light"] .domain-value.safe,
html.light .domain-value.safe,
body.light .domain-value.safe {
    color: #15803d !important;
}

[data-theme="light"] .domain-value.danger,
html.light .domain-value.danger,
body.light .domain-value.danger {
    color: #dc2626 !important;
}

/* Fix the attack content background */
[data-theme="light"] .attack-content,
html.light .attack-content,
body.light .attack-content {
    background-color: #f1f5f9 !important;
    border-top-color: #e2e8f0 !important;
}

/* Fix attack explanation text */
[data-theme="light"] .attack-explanation,
html.light .attack-explanation,
body.light .attack-explanation {
    color: #475569 !important;
}

/* Fix attack header hover */
[data-theme="light"] .attack-header:hover,
html.light .attack-header:hover,
body.light .attack-header:hover {
    background-color: #f1f5f9 !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}