:root {
    /* Avant-Garde Palette: "Void & Neon" */
    --bg-void: #050505;
    --bg-surface: #0f1115;
    --bg-surface-2: #16191f;

    --primary: #5252ff;
    /* Electric Indigo */
    --primary-dim: rgba(82, 82, 255, 0.1);
    --primary-rgb: 82, 82, 255;

    --text-primary: #e6e6e6;
    --text-secondary: #888888;
    --text-tertiary: #666666;
    --text-dim: #5a5a5a;

    --border-subtle: #222222;
    --border-active: #333333;

    --success: #00ff9d;
    --error: #ff2a2a;
    --warning: #ffb800;

    /* Metrics */
    --max-width: 1100px;
    --radius: 4px;
    /* Brutalist/Technical */
    --spacing-unit: 8px;
}

/* 1. RESET & BASE */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-void);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* Accessibility Helpers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.is-hidden {
    display: none !important;
}

/* Ensure main content is robustly centered horizontally */
main {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 24px;
    /* Natural top spacing instead of centering */
}

/* 2. TYPOGRAPHY (Technical/OS Style) */
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

/* Focus Styles */
.btn:focus-visible,
.search-input:focus-visible,
.drop-zone:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 3. LAYOUT UTILITIES */
.container {
    width: 100%;
    max-width: var(--max-width);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* 4. COMPONENTS */

/* Navbar: Minimalist Strip */
.navbar {
    width: 100%;
    max-width: var(--max-width);
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.brand {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.brand svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

/* HUD Cards */
.glass-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    /* Contain Overflow */
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-active), transparent);
    opacity: 0.5;
}

/* Home Hero */
.hero-card {
    width: 100%;
    max-width: 650px;
    text-align: center;
    padding: 48px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hero-title {
    font-size: 32px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Search Input: Monolithic */
.search-container {
    width: 100%;
    position: relative;
}

.search-input {
    width: 100%;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    padding: 16px 20px 16px 50px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #1a1d24;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

/* File Drop Zone */
.drop-zone {
    border: 1px dashed var(--border-active);
    padding: 40px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.2s;
}

.drop-zone--active {
    border-color: var(--primary);
    background: rgba(82, 82, 255, 0.05);
}

.drop-zone-text {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.drop-zone-subtext {
    color: var(--text-tertiary);
    font-size: 11px;
    margin-top: 4px;
}

.file-input {
    display: none;
}

.file-preview-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-surface-2);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    align-items: center;
}

.file-name {
    color: var(--primary);
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: 1.5;
    width: 100%;
}

.file-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.btn-flex {
    flex: 1;
}

.btn-icon {
    padding: 10px;
}

/* Buttons: Brutalist */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: #4040ff;
}

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

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

/* Report Header */
.report-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.report-type-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.report-type-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 4px;
}

/* Report Specifics */
.report-header {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.ioc-display {
    display: block;
    margin-top: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    color: var(--primary);
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

/* Progress Header */
.loading-state {
    position: relative;
    overflow: visible;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-percent {
    font-size: 12px;
    color: var(--primary);
    font-weight: 700;
}

.progress-message {
    color: var(--text-secondary);
    font-size: 12px;
    margin: 0;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    margin: 16px 0;
}

.progress-bar {
    width: 100%;
    height: 4px;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: 2px;
    overflow: hidden;
    background: var(--border-subtle);
}

.progress-bar::-webkit-progress-bar {
    background: var(--border-subtle);
}

.progress-bar::-webkit-progress-value {
    background: linear-gradient(90deg, var(--primary), #9b59b6, var(--primary));
    background-size: 200% 100%;
    box-shadow: 0 0 10px var(--primary);
    animation: progress-pulse 1.5s ease-in-out infinite;
}

.progress-bar::-moz-progress-bar {
    background: linear-gradient(90deg, var(--primary), #9b59b6, var(--primary));
    background-size: 200% 100%;
    box-shadow: 0 0 10px var(--primary);
    animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Sticky Progress Header */
.sticky-progress {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface);
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
    margin: -24px -24px 24px -24px;
    padding: 16px 24px;
}

/* Logs */
.log-panel {
    background: #000;
    border: 1px solid var(--border-subtle);
    padding: 16px;
    height: 180px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
}

.log-panel--spaced {
    margin-top: 16px;
}

.log-entry {
    margin-bottom: 2px;
    display: flex;
    gap: 8px;
}

.log-time {
    color: var(--text-tertiary);
    min-width: 60px;
}

.log-entry.info {
    color: var(--text-secondary);
}

.log-entry.success {
    color: var(--success);
}

.log-entry.warn {
    color: var(--warning);
}

.log-entry.error {
    color: var(--error);
}

/* Error Card */
.error-card {
    border-color: var(--error);
}

.error-title {
    color: var(--error);
    margin-bottom: 8px;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.result-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.provider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
}

.provider-name {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--text-secondary);
}

.score-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 2px;
    font-weight: 700;
    text-transform: uppercase;
}

.score-safe {
    color: var(--success);
    background: rgba(0, 255, 157, 0.1);
}

.score-med {
    color: var(--warning);
    background: rgba(255, 184, 0, 0.1);
}

.score-high {
    color: var(--error);
    background: rgba(255, 42, 42, 0.1);
}

/* Capa Card */
.capa-card {
    grid-column: span 2;
}

/* Base Detail Rows */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.detail-label {
    color: var(--text-tertiary);
    flex-shrink: 0;
    margin-right: 16px;
}

.detail-value {
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 65%;
}

/* Capa Metadata Overrides (Must come after Base) */
.capa-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.capa-meta-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.capa-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    margin-right: 0;
    text-align: center;
    display: block;
    width: 100%;
}

.capa-meta-value {
    font-weight: 600;
    text-align: center;
    max-width: 100%;
    display: block;
    width: 100%;
}



.capa-caps-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.capa-attacks {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.capa-attacks-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.capa-attacks-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.capa-attack {
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid var(--primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
}

.capa-attack-id {
    color: var(--primary);
    font-weight: 700;
    margin-right: 6px;
}

.capa-attack-name {
    color: var(--text-secondary);
}

.text-dim {
    color: var(--text-dim);
}

/* Result Links */

/* Result Links */
.result-link {
    color: var(--primary);
    text-decoration: underline;
    word-break: break-all;
}

/* Capa Tags */
.capa-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.capa-tag {
    font-size: 11px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-active);
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 2px;
}

/* Provider Error Cards */
.provider-error-card {
    border-color: var(--error);
}

.provider-error-header {
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.provider-error-name {
    color: var(--error);
}

.provider-error-message {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Results Actions */
.results-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    padding: 24px;
}

/* Mobile */
@media (max-width: 768px) {
    .report-header {
        grid-template-columns: 1fr;
    }

    .capa-meta {
        grid-template-columns: 1fr;
    }
}

.upload-error {
    color: var(--error);
    margin-top: 8px;
    font-size: 13px;
}