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

/* ================================================
   MAILSCOPE — Threat Lab UI
   ================================================ */

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

:root {
    --bg-primary: #070c18;
    --bg-card: rgba(255,255,255,0.028);
    --bg-card-hover: rgba(255,255,255,0.042);
    --border: rgba(255,255,255,0.07);
    --border-hover: rgba(255,255,255,0.14);
    --accent: #3d6ef5;
    --accent-light: #7ca3fa;
    --accent-glow: rgba(61, 110, 245, 0.22);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.18);
    --text-primary: #eef0f5;
    --text-secondary: #8e9bb5;
    --text-muted: #4d5a72;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #f43f5e;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    --shadow-card: 0 4px 24px rgba(0,0,0,0.35), 0 0 0 1px var(--border);
    --shadow-glow: 0 0 48px var(--accent-glow);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
}

body {
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-secondary);
    min-height: 100vh;
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Noise grain texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

/* Diagonal line grid */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(255,255,255,0.015) 0px,
        rgba(255,255,255,0.015) 1px,
        transparent 1px,
        transparent 28px
    );
    pointer-events: none;
    z-index: 0;
}

/* Ambient glow — bottom right only */
.ambient {
    position: fixed;
    bottom: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(61,110,245,0.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.page-wrapper {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto;
    padding: 20px 24px 60px;
}

/* ---- HERO ---- */

.hero {
    text-align: center;
    padding: 64px 20px 52px;
}

.hero-icon {
    margin-bottom: 24px;
    display: inline-block;
}

.hero-logo {
    height: 108px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 24px rgba(61, 110, 245, 0.28));
}

.hero h1 {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1.2px;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.1;
}

.hero h1 span {
    color: var(--accent-light);
}

.hero-sub {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 400;
    max-width: 380px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ---- UPLOAD CARD ---- */

.upload-card {
    background: rgba(14, 20, 38, 0.85);
    border: 1px solid rgba(61, 110, 245, 0.18);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    margin-bottom: 56px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
}

.upload-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 30%, var(--accent-light) 60%, transparent 100%);
    opacity: 0.4;
}

/* Drop zone */

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 52px 30px;
    border: 1.5px dashed rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.012);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: rgba(61, 110, 245, 0.4);
    background: rgba(61, 110, 245, 0.04);
}

.drop-icon {
    margin-bottom: 16px;
    color: var(--accent-light);
    opacity: 0.8;
}

.drop-icon svg {
    width: 44px;
    height: 44px;
    stroke-width: 1.4;
}

.drop-text {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 4px;
}

.drop-or {
    font-size: 11px;
    color: var(--text-muted);
    margin: 12px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.browse-btn {
    display: inline-block;
    padding: 10px 30px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.3px;
    font-family: 'Manrope', sans-serif;
}

.browse-btn:hover {
    background: #4e7df7;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(61,110,245,0.35);
}

.drop-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 16px;
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
}

#fileInput { display: none; }

/* ---- FILE INFO ---- */

.file-info {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: rgba(61, 110, 245, 0.06);
    border: 1px solid rgba(61, 110, 245, 0.18);
    border-radius: var(--radius-md);
    animation: slideUp 0.25s ease;
}

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

.file-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(61, 110, 245, 0.12);
    border-radius: var(--radius-sm);
    color: var(--accent-light);
    flex-shrink: 0;
}

.file-icon svg { width: 20px; height: 20px; }

.file-details { flex: 1; }

.file-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.file-size {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    font-family: var(--font-mono);
}

.file-remove {
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: var(--danger);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-remove:hover {
    background: rgba(244, 63, 94, 0.16);
}

.file-remove svg { width: 15px; height: 15px; }

/* ---- BOUTON ANALYSER ---- */

.analyze-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 22px;
    padding: 16px 32px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.2px;
    font-family: 'Manrope', sans-serif;
    position: relative;
    overflow: hidden;
}

.analyze-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent);
    border-radius: inherit;
}

.analyze-btn:hover:not(:disabled) {
    background: #4e7df7;
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(61,110,245,0.4);
}

.analyze-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.btn-text, .btn-icon {
    position: relative;
    z-index: 1;
}

.btn-icon {
    display: inline-flex;
    transition: transform 0.25s;
}

.btn-icon svg { width: 18px; height: 18px; }

.analyze-btn:hover:not(:disabled) .btn-icon {
    transform: translateX(3px);
}

/* ---- LOADING OVERLAY ---- */

.loading-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 32px 0 8px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255,255,255,0.06);
    border-top-color: var(--accent);
    border-right-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 22px;
}

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

.loading-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 26px;
    letter-spacing: -0.2px;
}

.loading-steps {
    width: 100%;
    max-width: 320px;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.4s ease;
    border-left: 2px solid rgba(255,255,255,0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 2px;
    font-family: var(--font-mono);
}

.step svg { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 2; }

.step.active {
    color: var(--accent-light);
    border-left-color: var(--accent);
    background: rgba(61, 110, 245, 0.05);
}

.loading-hint {
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ---- FEATURES ---- */

.features-section {
    margin-bottom: 56px;
}

.features-section h2 {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 32px;
    letter-spacing: -0.5px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 20px 24px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.feature-card-num {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 1px;
    margin-bottom: 14px;
    display: block;
    opacity: 0.8;
}

.feature-card:hover {
    border-color: rgba(61, 110, 245, 0.22);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(0,0,0,0.2);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(61, 110, 245, 0.1);
    border: 1px solid rgba(61, 110, 245, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: var(--accent-light);
    transition: var(--transition);
}

.feature-icon svg { width: 22px; height: 22px; stroke-width: 1.8; }

.feature-card:hover .feature-icon {
    background: rgba(61, 110, 245, 0.18);
    border-color: rgba(61, 110, 245, 0.25);
}

.feature-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 7px;
    letter-spacing: -0.2px;
}

.feature-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ---- FAQ ---- */

.faq-section {
    margin-bottom: 56px;
}

.faq-section h2 {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.faq-item:hover {
    border-color: rgba(61,110,245,0.2);
}

.faq-q {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.2s;
    user-select: none;
}

.faq-q:hover { color: var(--text-primary); }

.faq-arrow {
    transition: transform 0.3s ease;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 12px;
    display: flex;
}

.faq-arrow svg { width: 16px; height: 16px; }

.faq-item.open .faq-arrow {
    transform: rotate(180deg);
    color: var(--accent-light);
}

.faq-a {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding: 0 22px;
}

.faq-item.open .faq-a {
    max-height: 300px;
    padding: 0 22px 18px;
}

.faq-a p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
    line-height: 1.7;
}

.faq-a p strong { color: var(--text-secondary); }

/* ---- FOOTER ---- */

.footer {
    text-align: center;
    padding: 28px 0;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 480px;
    margin: 0 auto;
    font-family: var(--font-mono);
}

/* ---- NAVBAR ---- */

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 58px;
    background: rgba(7, 12, 24, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.065);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.3px;
}

.brand-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.brand-text {
    color: var(--text-primary);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-links li a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    letter-spacing: -0.1px;
}

.navbar-links li a:hover,
.navbar-links li a.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.055);
}

/* Burger menu mobile */
.navbar-burger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.navbar-burger span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: var(--transition);
}

.navbar-burger.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.navbar-burger.active span:nth-child(2) { opacity: 0; }
.navbar-burger.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* ---- FLASH MESSAGES ---- */

.flash-container {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 480px;
    padding: 0 16px;
}

.flash-message {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(16px);
    animation: slideDown 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: var(--font-mono);
}

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

.flash-success { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.25); color: var(--success); }
.flash-danger { background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.25); color: var(--danger); }
.flash-info { background: rgba(61, 110, 245, 0.12); border: 1px solid rgba(61, 110, 245, 0.25); color: var(--accent-light); }

.flash-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
}

.flash-close:hover { opacity: 1; }

/* ---- CONTENT PAGES ---- */

.content-page { padding-top: 40px; }

.content-page h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.content-page h2 {
    font-size: 1.2rem;
    color: var(--accent-light);
    margin-bottom: 0.8rem;
    margin-top: 1.5rem;
    font-weight: 700;
}

.content-page p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
    font-size: 14px;
}

.content-page ul {
    color: var(--text-secondary);
    line-height: 2;
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 14px;
}

.content-page ul li strong { color: var(--text-primary); }

/* ---- RESPONSIVE ---- */

@media (max-width: 768px) {
    .navbar-burger { display: flex; }
    .navbar-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(7, 12, 24, 0.99);
        backdrop-filter: blur(16px);
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        gap: 2px;
    }
    .navbar-links.open { display: flex; }
    .navbar-links li a { display: block; padding: 0.75rem 1rem; width: 100%; }
}

@media (max-width: 640px) {
    .hero { padding: 44px 16px 36px; }
    .hero h1 { font-size: 30px; }
    .hero-logo { height: 80px; }
    .upload-card { padding: 28px 20px; }
    .features-grid { grid-template-columns: 1fr; gap: 10px; }
    .feature-card { padding: 22px 18px; }
    .drop-zone { padding: 36px 20px; }
}
