/* === Email Phishing Analyzer - CSS (solarized-osaka-night) === */
:root {
    --bg-main: #0b1720;
    --bg-panel: #001f2a;
    --bg-panel-soft: #022737;
    --bg-input: #011a23;
    --fg-primary: #e5f2f7;
    --fg-muted: #8fa1ad;
    --fg-accent: #b3ecff;
    --accent-cyan: #2aa198;
    --accent-blue: #268bd2;
    --accent-magenta: #d33682;
    --accent-yellow: #b58900;
    --accent-orange: #cb4b16;
    --accent-green: #859900;
    --accent-red: #dc322f;
    --border-subtle: #123345;
    --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.55);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --font-mono: "Fira Code", "Courier New", monospace;
    --font-sans: system-ui, -apple-system, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--fg-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 0%, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
    z-index: 0;
}

/* === Navigation === */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--bg-panel) 0%, var(--bg-panel-soft) 100%);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(10px);
}

.nav-back {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-back:hover {
    background: var(--bg-panel-soft);
    color: var(--fg-accent);
}

.nav-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--fg-primary);
}

.nav-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-cyan);
}

.nav-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-panel-soft);
    border: 1px solid var(--accent-green);
    border-radius: var(--radius-sm);
    color: var(--accent-green);
    font-size: 0.8rem;
    font-weight: 500;
}

/* === Container === */
.container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 24px 80px;
    z-index: 1;
}

/* === Upload Section === */
.upload-section {
    margin-bottom: 24px;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    background: var(--bg-panel);
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-cyan);
    background: var(--bg-panel-soft);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--accent-cyan);
    margin-bottom: 20px;
    opacity: 0.7;
}

.upload-area h2 {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    color: var(--fg-primary);
    margin-bottom: 10px;
}

.upload-area p {
    color: var(--fg-muted);
    margin-bottom: 8px;
}

.upload-area code {
    background: var(--bg-main);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--accent-yellow);
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--accent-green);
    margin-bottom: 20px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-top: 16px;
}

.file-info svg {
    color: var(--accent-cyan);
    flex-shrink: 0;
}

#fileName {
    font-family: var(--font-mono);
    color: var(--fg-primary);
}

#fileSize {
    color: var(--fg-muted);
    font-size: 0.9rem;
}

/* === Summary Panel === */
.summary-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.risk-indicator {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.risk-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
}

.risk-badge[data-risk="low"] {
    background: rgba(133, 153, 0, 0.15);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.risk-badge[data-risk="medium"] {
    background: rgba(181, 137, 0, 0.15);
    border: 1px solid var(--accent-yellow);
    color: var(--accent-yellow);
}

.risk-badge[data-risk="high"] {
    background: rgba(220, 50, 47, 0.15);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.risk-badge[data-risk="unknown"] {
    background: var(--bg-panel-soft);
    border: 1px solid var(--border-subtle);
    color: var(--fg-muted);
}

.risk-score {
    flex: 1;
    min-width: 200px;
}

.risk-bar {
    height: 8px;
    background: var(--bg-main);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.risk-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease, background 0.3s ease;
}

.risk-fill[data-risk="low"] { background: var(--accent-green); }
.risk-fill[data-risk="medium"] { background: var(--accent-yellow); }
.risk-fill[data-risk="high"] { background: var(--accent-red); }

#riskCount {
    font-size: 0.85rem;
    color: var(--fg-muted);
}

.summary-findings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.finding-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-panel-soft);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-subtle);
}

.finding-item[data-severity="high"] {
    border-left-color: var(--accent-red);
    background: rgba(220, 50, 47, 0.08);
}

.finding-item[data-severity="medium"] {
    border-left-color: var(--accent-yellow);
    background: rgba(181, 137, 0, 0.08);
}

.finding-item[data-severity="low"] {
    border-left-color: var(--accent-blue);
    background: rgba(38, 139, 210, 0.08);
}

.finding-item[data-severity="info"] {
    border-left-color: var(--accent-green);
    background: rgba(133, 153, 0, 0.08);
}

.finding-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.finding-item[data-severity="high"] .finding-icon { color: var(--accent-red); }
.finding-item[data-severity="medium"] .finding-icon { color: var(--accent-yellow); }
.finding-item[data-severity="low"] .finding-icon { color: var(--accent-blue); }
.finding-item[data-severity="info"] .finding-icon { color: var(--accent-green); }

.finding-text {
    font-size: 0.9rem;
    color: var(--fg-primary);
}

/* === Analysis Tabs === */
.analysis-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.analysis-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--fg-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.analysis-tab:hover {
    color: var(--fg-primary);
    background: var(--bg-panel-soft);
}

.analysis-tab.active {
    color: var(--bg-main);
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.analysis-tab svg {
    flex-shrink: 0;
}

/* === Tab Content === */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* === Panels === */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 16px;
}

.panel-header svg {
    flex-shrink: 0;
}

.panel-desc {
    color: var(--fg-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.section-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 24px 0;
}

.subsection-title {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--fg-primary);
    margin-bottom: 12px;
}

/* === Headers Grid === */
.headers-grid {
    display: grid;
    gap: 12px;
}

.header-item {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-panel-soft);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-subtle);
    align-items: start;
}

.header-item.flagged {
    border-left-color: var(--accent-red);
    background: rgba(220, 50, 47, 0.08);
}

.header-item.warning {
    border-left-color: var(--accent-yellow);
    background: rgba(181, 137, 0, 0.08);
}

.header-name {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

.header-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--fg-primary);
    word-break: break-all;
}

.header-flag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(220, 50, 47, 0.15);
    border: 1px solid var(--accent-red);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--accent-red);
    cursor: help;
}

.header-flag.warning {
    background: rgba(181, 137, 0, 0.15);
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
}

/* === Received Chain === */
.received-chain {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.received-hop {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-panel-soft);
    border-radius: var(--radius-sm);
}

.hop-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent-cyan);
    color: var(--bg-main);
    border-radius: 50%;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.hop-content {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--fg-primary);
    word-break: break-all;
}

/* === Auth Results === */
.auth-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.auth-item {
    padding: 12px 16px;
    background: var(--bg-panel-soft);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-subtle);
}

.auth-item.pass {
    border-left-color: var(--accent-green);
}

.auth-item.fail {
    border-left-color: var(--accent-red);
}

.auth-item.none {
    border-left-color: var(--accent-yellow);
}

.auth-name {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fg-muted);
    margin-bottom: 4px;
}

.auth-status {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
}

.auth-item.pass .auth-status { color: var(--accent-green); }
.auth-item.fail .auth-status { color: var(--accent-red); }
.auth-item.none .auth-status { color: var(--accent-yellow); }

/* === Links List === */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-item {
    padding: 16px;
    background: var(--bg-panel-soft);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-subtle);
}

.link-item.suspicious {
    border-left-color: var(--accent-red);
    background: rgba(220, 50, 47, 0.08);
}

.link-item.warning {
    border-left-color: var(--accent-yellow);
    background: rgba(181, 137, 0, 0.08);
}

.link-url {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-blue);
    word-break: break-all;
    margin-bottom: 8px;
}

.link-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.link-domain {
    padding: 4px 10px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--fg-muted);
}

.link-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.link-flag {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(220, 50, 47, 0.15);
    border: 1px solid var(--accent-red);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--accent-red);
    cursor: help;
}

.link-flag.warning {
    background: rgba(181, 137, 0, 0.15);
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
}

.link-display-mismatch {
    margin-top: 8px;
    padding: 10px;
    background: rgba(220, 50, 47, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: var(--radius-sm);
}

.link-display-mismatch span {
    font-size: 0.8rem;
    color: var(--accent-red);
}

.link-display-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--fg-primary);
}

/* === Attachments List === */
.attachments-list {
    display: grid;
    gap: 12px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-panel-soft);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-subtle);
}

.attachment-item.dangerous {
    border-left-color: var(--accent-red);
    background: rgba(220, 50, 47, 0.08);
}

.attachment-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    color: var(--fg-muted);
    flex-shrink: 0;
}

.attachment-item.dangerous .attachment-icon {
    color: var(--accent-red);
}

.attachment-info {
    flex: 1;
}

.attachment-name {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--fg-primary);
    margin-bottom: 4px;
}

.attachment-meta {
    font-size: 0.8rem;
    color: var(--fg-muted);
}

.attachment-warning {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(220, 50, 47, 0.15);
    border: 1px solid var(--accent-red);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--accent-red);
}

/* === Phrases List === */
.phrases-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.phrase-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-panel-soft);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-yellow);
}

.phrase-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-yellow);
    flex: 1;
}

.phrase-explanation {
    font-size: 0.8rem;
    color: var(--fg-muted);
}

.no-items {
    padding: 20px;
    text-align: center;
    color: var(--fg-muted);
    font-size: 0.9rem;
}

/* === Body Content === */
.body-content {
    padding: 16px;
    background: var(--bg-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--fg-primary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.html-preview {
    font-family: var(--font-sans);
    white-space: normal;
}

.html-preview a {
    color: var(--accent-blue);
    text-decoration: none;
    pointer-events: none;
}

.html-preview img {
    max-width: 100%;
    height: auto;
}

/* === Raw Content === */
.raw-actions {
    margin-bottom: 12px;
}

.raw-content {
    padding: 16px;
    background: var(--bg-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--fg-primary);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 500px;
    overflow: auto;
    line-height: 1.5;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

.btn svg {
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent-cyan);
    color: var(--bg-main);
}

.btn-primary:hover {
    background: #35b5a8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-panel-soft);
    color: var(--fg-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-panel);
    border-color: var(--accent-cyan);
}

.btn-ghost {
    background: transparent;
    color: var(--fg-muted);
    padding: 6px 12px;
}

.btn-ghost:hover {
    color: var(--accent-cyan);
    background: var(--bg-panel-soft);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* === Tooltip === */
.tooltip {
    position: fixed;
    z-index: 1000;
    max-width: 300px;
    padding: 12px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    font-size: 0.85rem;
    color: var(--fg-primary);
    pointer-events: none;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 24px;
    background: var(--bg-panel);
    border: 1px solid var(--accent-cyan);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    color: var(--fg-primary);
    font-size: 0.9rem;
    z-index: 1100;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast:not([hidden]) {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    border-color: var(--accent-red);
}

.toast.success {
    border-color: var(--accent-green);
}

/* === Footer === */
.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: var(--fg-muted);
    font-size: 0.85rem;
}

.footer-divider {
    color: var(--border-subtle);
}

/* === Responsive === */
@media (max-width: 768px) {
    .top-nav {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .nav-badge {
        display: none;
    }

    .container {
        padding: 20px 16px 60px;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .upload-area h2 {
        font-size: 1.1rem;
    }

    .header-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .risk-indicator {
        flex-direction: column;
        align-items: stretch;
    }

    .analysis-tabs {
        padding: 8px;
    }

    .analysis-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .analysis-tab span:not(:first-child) {
        display: none;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

/* === Selection === */
::selection {
    background: var(--accent-cyan);
    color: var(--bg-main);
}
