/* ============================================
   Email Sentinel — Stylesheet
   Industrial-utilitarian aesthetic with sharp edges
   ============================================ */

:root {
    --bg: #0a0a0b;
    --bg-raised: #131316;
    --bg-card: #1a1a1f;
    --bg-hover: #22222a;
    --border: #2a2a33;
    --border-light: #353540;
    --text: #e4e4e8;
    --text-dim: #8b8b96;
    --text-muted: #5a5a66;
    --accent: #3b82f6;
    --accent-dim: #2563eb;
    --safe: #22c55e;
    --low: #84cc16;
    --medium: #eab308;
    --high: #f97316;
    --critical: #ef4444;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 4px;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* --- NAV --- */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-icon {
    color: var(--accent);
    font-size: 1.1rem;
}

.nav-title {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    border-radius: var(--radius);
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

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

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

.btn-lg {
    padding: 0.85rem 1.8rem;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-dim);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-hover);
}

/* --- FLASH MESSAGES --- */
.flash-container {
    padding: 1rem 2rem 0;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid;
}

.flash-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--safe);
}

.flash-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--critical);
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
}

/* --- LANDING --- */
.landing {
    max-width: 900px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.landing-hero {
    text-align: center;
    margin-bottom: 4rem;
}

.hero-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 0.3rem 0.8rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
}

.landing-hero h1 {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1.2rem;
    letter-spacing: -0.02em;
}

.hero-sub {
    font-size: 1.05rem;
    color: var(--text-dim);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.hero-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.8rem;
    font-family: var(--font-mono);
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.feature-card {
    background: var(--bg-raised);
    padding: 1.8rem;
}

.feature-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.6;
}

/* --- DASHBOARD --- */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dash-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.dash-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 0.3rem;
}

.scan-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.select-input {
    padding: 0.55rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.82rem;
    border-radius: var(--radius);
    cursor: pointer;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-raised);
    padding: 1.2rem 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

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

.stat-critical .stat-value { color: var(--critical); }
.stat-high .stat-value { color: var(--high); }
.stat-threats .stat-value { color: var(--medium); }
.stat-safe .stat-value { color: var(--safe); }

/* Results Table */
.results-section {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.results-section h2 {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.results-table-wrap {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.results-table thead {
    background: var(--bg-card);
}

.results-table th {
    text-align: left;
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.results-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.result-row:hover {
    background: var(--bg-hover);
}

.result-row.threat-critical { border-left: 3px solid var(--critical); }
.result-row.threat-high { border-left: 3px solid var(--high); }
.result-row.threat-medium { border-left: 3px solid var(--medium); }

.score-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--threat-color, var(--text));
    min-width: 2.5rem;
    text-align: center;
}

.level-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    letter-spacing: 0.05em;
}

.level-safe { background: rgba(34,197,94,0.15); color: var(--safe); }
.level-low { background: rgba(132,204,22,0.15); color: var(--low); }
.level-medium { background: rgba(234,179,8,0.15); color: var(--medium); }
.level-high { background: rgba(249,115,22,0.15); color: var(--high); }
.level-critical { background: rgba(239,68,68,0.15); color: var(--critical); }

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

.sender-name {
    font-weight: 500;
}

.sender-email {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.mismatch-flag {
    color: var(--high);
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.match-ok {
    color: var(--safe);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
}

/* --- REPORT --- */
.report {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.back-link {
    display: inline-block;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.82rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-mono);
}

.back-link:hover {
    color: var(--text);
}

.report-header {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-left: 4px solid var(--threat-color, var(--border));
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.report-score-wrap {
    text-align: center;
    min-width: 80px;
}

.report-score {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--threat-color, var(--text));
    line-height: 1;
}

.report-level {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    margin-top: 0.5rem;
    display: inline-block;
}

.report-meta h1 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.report-sender, .report-date {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
}

.report-reply-to.mismatch-alert {
    color: var(--high);
    font-weight: 500;
}

.mismatch-note {
    color: var(--critical);
    font-weight: 600;
}

.report-section {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.report-section h2 {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

.ai-reasoning {
    padding: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.7;
}

.indicators-list {
    padding: 1rem 1.5rem;
}

.indicator-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.indicator-item:last-child {
    border-bottom: none;
}

.indicator-icon {
    color: var(--high);
}

.signals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
}

.signal-card {
    background: var(--bg-raised);
    padding: 1.2rem 1.5rem;
}

.signal-card h3 {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
}

.auth-results {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.auth-result {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
}

.auth-pass { background: rgba(34,197,94,0.15); color: var(--safe); }
.auth-fail { background: rgba(239,68,68,0.15); color: var(--critical); }
.auth-softfail { background: rgba(234,179,8,0.15); color: var(--medium); }
.auth-unknown { background: rgba(90,90,102,0.15); color: var(--text-muted); }

.signal-alert {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    padding: 0.75rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: var(--high);
}

.signal-ok {
    color: var(--safe);
    font-size: 0.82rem;
}

.suspicious-link {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.suspicious-link code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--critical);
    word-break: break-all;
}

.suspicious-link ul {
    margin-top: 0.3rem;
    padding-left: 1.2rem;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.score-note {
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .landing-hero h1 { font-size: 1.8rem; }
    .features-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .signals-grid { grid-template-columns: 1fr; }
    .report-header { flex-direction: column; gap: 1rem; }
    .dash-header { flex-direction: column; }
}

/* ============================================
   Social Engineering Detection Styles
   ============================================ */

/* --- Dashboard SE Section --- */
.se-section {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    overflow: hidden;
}

.se-section h2 {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.se-summary {
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.se-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
}

.se-card {
    background: var(--bg-raised);
    padding: 1rem 1.2rem;
    transition: background 0.15s ease;
}

.se-card-active {
    background: var(--bg-card);
    border-left: 3px solid var(--high);
}

.se-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.se-icon {
    font-size: 1.2rem;
}

.se-count {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-muted);
}

.se-card-active .se-count {
    color: var(--high);
}

.se-label {
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.2rem;
}

.se-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* --- Table SE Tactics Pills --- */
.se-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.se-pill {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.se-pill-urgency { background: rgba(234,179,8,0.15); color: var(--medium); }
.se-pill-secrecy { background: rgba(168,85,247,0.15); color: #a855f7; }
.se-pill-authority { background: rgba(239,68,68,0.15); color: var(--critical); }
.se-pill-financial { background: rgba(249,115,22,0.15); color: var(--high); }
.se-pill-emotional { background: rgba(236,72,153,0.15); color: #ec4899; }
.se-pill-process-bypass { background: rgba(244,63,94,0.15); color: #f43f5e; }
.se-pill-credential { background: rgba(59,130,246,0.15); color: var(--accent); }
.se-pill-brand-spoof { background: rgba(99,102,241,0.15); color: #6366f1; }

/* --- Threat Type Tag --- */
.type-tag {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.12rem 0.4rem;
    border-radius: 2px;
    background: rgba(239,68,68,0.1);
    color: var(--critical);
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.type-tag-lg {
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
}

.report-threat-type {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 0.4rem;
}

/* --- Report SE Cards --- */
.se-report-grid {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.se-report-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border-left: 3px solid var(--se-color, var(--border));
    border-radius: var(--radius);
}

.se-report-icon {
    font-size: 1.5rem;
    min-width: 2rem;
    text-align: center;
}

.se-report-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--se-color, var(--text));
}

.se-report-desc {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* --- Attack Narrative --- */
.attack-narrative {
    padding: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.7;
    background: rgba(239,68,68,0.05);
    border-left: 3px solid var(--critical);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .se-grid { grid-template-columns: repeat(2, 1fr); }
}

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