/* ═══════════════════════════════════════════════════════════
   MailScrub.app — Design System
   Dark mode · Glassmorphism · Premium aesthetic
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────── */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/**
 * MailScrub.app — Main Stylesheet
 * Version: 1.0.0 (Official Release)
 */

:root {
    /* Colors */
    --bg-primary: #06070f;
    --bg-secondary: #0c0e1a;
    --bg-card: rgba(16, 19, 39, 0.65);
    --bg-card-hover: rgba(22, 26, 52, 0.75);
    --border-card: rgba(99, 115, 255, 0.12);
    --border-card-hover: rgba(99, 115, 255, 0.25);

    --text-primary: #e8eaf6;
    --text-secondary: #8b8fa8;
    --text-muted: #555a72;

    --accent-blue: #6373ff;
    --accent-cyan: #00d4ff;
    --accent-green: #00e096;
    --accent-orange: #ffaa40;
    --accent-red: #ff4d6a;
    --accent-purple: #b44aff;

    --gradient-primary: linear-gradient(135deg, #6373ff, #00d4ff);
    --gradient-score-good: linear-gradient(135deg, #00e096, #00d4ff);
    --gradient-score-mid: linear-gradient(135deg, #ffaa40, #ff7a00);
    --gradient-score-bad: linear-gradient(135deg, #ff4d6a, #ff2442);

    /* Glassmorphism */
    --glass-bg: rgba(16, 19, 39, 0.55);
    --glass-blur: 20px;
    --glass-border: 1px solid rgba(99, 115, 255, 0.1);

    /* Shadows */
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 60px rgba(99, 115, 255, 0.08);

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Sizing */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

/* ── Light Theme Variables ───────────────────────────── */

body.light-theme {
    /* Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(245, 247, 255, 0.95);
    --border-card: rgba(99, 115, 255, 0.15);
    --border-card-hover: rgba(99, 115, 255, 0.3);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Shadows (softer for light mode) */
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 40px rgba(99, 115, 255, 0.15);

    /* Glassmorphism adjustments */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: 1px solid rgba(99, 115, 255, 0.15);
}

html {
    scroll-behavior: smooth;
}

/* ── Accessibilité : focus visible au clavier ─────────── */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    /* Smooth theme transition */
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Also transition cards and headers to avoid jarring jumps */
.stats-grid .stat-card,
.dashboard-card,
.navbar {
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.hidden {
    display: none !important;
}


/* ── Animated Background Orbs ─────────────────────────── */

.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

.bg-orb-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-blue);
    top: -200px;
    right: -200px;
    animation: float1 20s ease-in-out infinite;
}

.bg-orb-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-purple);
    bottom: -100px;
    left: -100px;
    animation: float2 25s ease-in-out infinite;
}

.bg-orb-3 {
    width: 300px;
    height: 300px;
    background: var(--accent-cyan);
    top: 50%;
    left: 50%;
    animation: float3 18s ease-in-out infinite;
}

@keyframes float1 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-80px, 60px) scale(1.1);
    }

    66% {
        transform: translate(40px, -40px) scale(0.9);
    }
}

@keyframes float2 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(100px, -80px) scale(1.15);
    }
}

@keyframes float3 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.2;
    }

    50% {
        transform: translate(-60px, 40px) scale(1.2);
        opacity: 0.35;
    }
}


/* ── Navbar ───────────────────────────────────────────── */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    position: relative;
    z-index: 10;
}

.landing-nav {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-badge {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    opacity: 0.7;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
}

.user-badge {
    color: var(--text-secondary);
    font-size: 0.8rem;
}


/* ── Hero Section ─────────────────────────────────────── */

.section-landing {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 20px;
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 800px;
}

.hero-badge {
    display: inline-block;
    background: rgba(0, 212, 255, 0.08);
    color: var(--accent-cyan);
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(0, 212, 255, 0.15);
    margin-bottom: 28px;
    animation: fadeInUp 0.6s ease-out;
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 24px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 650px;
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-subtitle strong {
    color: var(--text-primary);
}

.hero-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

/* ── Radio Button Group (Scan Limit) ────────────────── */

.scan-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.scan-option {
    position: relative;
    cursor: pointer;
}

.scan-option input {
    display: none;
    /* Hide actual radio */
}

.option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 18px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.option-icon {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.option-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.option-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Hover State */
.scan-option:hover .option-content {
    background: rgba(255, 255, 255, 0.05);
}

/* Selected State */
.scan-option input:checked+.option-content {
    background: rgba(99, 115, 255, 0.15);
    border-color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(99, 115, 255, 0.1);
}

.scan-option input:checked+.option-content .option-text {
    color: #fff;
    font-weight: 600;
}

.scan-option input:checked+.option-content .option-count {
    color: var(--accent-blue);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 30px;
    background: var(--gradient-primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 24px rgba(99, 115, 255, 0.35);
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 40px rgba(99, 115, 255, 0.5);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-icon {
    flex-shrink: 0;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-card);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-card-hover);
    background: var(--bg-card);
}

.hero-trust {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    animation: fadeInUp 0.6s ease-out 0.4s both;
}


/* ── Feature Cards ────────────────────────────────────── */

/* ── Features Section ────────────────────────────────── */

.features-section {
    padding: 80px 20px 120px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    animation: fadeInUp 0.6s ease-out 0.5s both;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 60px;
    background: linear-gradient(to right, #fff, #a0a0b0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-card-hover);
    transform: translateY(-6px);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.05);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.feature-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Footer ───────────────────────────────────────────── */

.landing-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 40px 20px;
    text-align: center;
    margin-top: auto;
    background: rgba(0, 0, 0, 0.2);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.footer-logo {
    font-weight: 700;
    font-size: 1.1rem;
    opacity: 0.8;
}

.footer-links {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent-blue);
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
}


/* ── Loading Screen ───────────────────────────────────── */

.section-loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 100;
}

.loader-container {
    text-align: center;
}

.loader-ring {
    width: 80px;
    height: 80px;
    border: 3px solid rgba(99, 115, 255, 0.15);
    border-top: 3px solid var(--accent-cyan);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.loader-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
}


/* ── Dashboard ────────────────────────────────────────── */

.section-dashboard {
    min-height: 100vh;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(99, 115, 255, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 212, 255, 0.04) 0%, transparent 60%);
}

.dashboard-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 30px 40px;
}

.dash-header {
    margin-bottom: 30px;
    animation: fadeInUp 0.5s ease-out;
}

.dash-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
}

.dash-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 6px;
}


/* ── Cards ────────────────────────────────────────────── */

.card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.3s ease;
    animation: fadeInUp 0.5s ease-out both;
}

.card:hover {
    border-color: var(--border-card-hover);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}


/* ── Score Ring ────────────────────────────────────────── */

.dash-grid-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.card-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation-delay: 0.1s;
}

.score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-ring {
    position: relative;
    width: 200px;
    height: 200px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: rgba(99, 115, 255, 0.1);
    stroke-width: 10;
}

.score-progress {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.score-number {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
}

.score-max {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.score-label {
    margin-top: 14px;
    font-size: 1rem;
    font-weight: 600;
}


/* ── Categories Chart ─────────────────────────────────── */

.card-categories {
    animation-delay: 0.2s;
}

.chart-container {
    position: relative;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ── Top Senders ──────────────────────────────────────── */

.card-senders {
    margin-bottom: 20px;
    animation-delay: 0.3s;
}

.senders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sender-row {
    display: grid;
    grid-template-columns: 32px 1fr 180px 50px 60px auto;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.sender-row:hover {
    background: rgba(99, 115, 255, 0.20);
    border-color: rgba(99, 115, 255, 0.6);
    box-shadow: inset 0 0 15px rgba(99, 115, 255, 0.15);
    cursor: pointer;
    transform: translateX(4px);
}

.sender-rank {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.sender-rank.top-3 {
    color: var(--accent-orange);
}

.sender-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sender-email {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sender-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.sender-bar-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.sender-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0;
}

.sender-bar.newsletter {
    background: var(--gradient-primary);
}

.sender-bar.notification {
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
}

.sender-bar.human {
    background: var(--gradient-score-good);
}

.sender-bar.spam {
    background: var(--gradient-score-bad);
}

.sender-count {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
}

.sender-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

/* ── Sender Controls (Search & Sort) ──────────────────── */

.senders-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    font-size: 0.9rem;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 10px 12px 10px 36px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-box input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(99, 115, 255, 0.2);
}

.sort-buttons {
    display: flex;
    gap: 8px;
}

.sort-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sort-btn.active {
    background: rgba(99, 115, 255, 0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}


/* ── Sender Action Buttons ────────────────────────────── */

.sender-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-action {
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-action:hover {
    transform: scale(1.1);
}

.btn-action:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-trash:hover {
    background: rgba(255, 77, 106, 0.15);
    border-color: var(--accent-red);
}

.btn-danger:hover {
    background: rgba(255, 77, 106, 0.2);
    border-color: var(--accent-red);
}

.btn-unsub:hover {
    background: rgba(255, 170, 64, 0.15);
    border-color: var(--accent-orange);
}

/* Theme Toggle Button */
.theme-btn {
    font-size: 1.2rem;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
}

.theme-btn:hover {
    background: var(--bg-card);
    border-color: var(--border-card-hover);
    transform: scale(1.05);
}


/* ── Space Summary Card ──────────────────────────────── */

.card-space {
    margin-bottom: 20px;
    animation-delay: 0.35s;
}

.space-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.space-item {
    text-align: center;
    padding: 20px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.space-item:hover {
    background: rgba(99, 115, 255, 0.05);
    border-color: var(--border-card);
}

.space-item.recoverable {
    border-color: rgba(255, 170, 64, 0.2);
}

.space-item.freed {
    border-color: rgba(0, 224, 150, 0.2);
}

.space-icon {
    display: block;
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.space-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.space-item.recoverable .space-value {
    background: linear-gradient(135deg, var(--accent-orange), #ff7a00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.space-item.freed .space-value {
    background: var(--gradient-score-good);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.space-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}


/* ── Recommendations ──────────────────────────────────── */

.card-recs {
    margin-bottom: 20px;
    animation-delay: 0.4s;
}

.recs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rec-item {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-blue);
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.rec-item:hover {
    background: rgba(99, 115, 255, 0.05);
    color: var(--text-primary);
}


/* ── Stats Row ────────────────────────────────────────── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    animation: fadeInUp 0.5s ease-out 0.5s both;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 22px;
    text-align: center;
    transition: border-color 0.3s ease;
}

.stat-card:hover {
    border-color: var(--border-card-hover);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}


/* ── Footer ───────────────────────────────────────────── */

.footer {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.footer a {
    color: var(--accent-blue);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}


/* ── Animations ───────────────────────────────────────── */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ── Responsive ───────────────────────────────────────── */

/* ── Pagination ───────────────────────────────────────── */

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-page {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-page:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* ── Breakpoint tablette (~1024px) ────────────────────── */
@media (max-width: 1024px) {
    .dashboard-content {
        padding: 10px 24px 40px;
    }

    .suggestions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Resserre la colonne barre/taille pour éviter le débordement */
    .sender-row {
        grid-template-columns: 32px 1fr 110px 48px 56px auto;
        gap: 10px;
    }

    .nav-links {
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .nav-links {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .nav-link {
        font-size: 0.85rem;
    }

    /* Évite que l'email/avatar pousse "Déconnexion" hors de l'écran */
    .user-badge {
        max-width: 45vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .features {
        grid-template-columns: 1fr;
        max-width: 360px;
    }

    .dash-grid-top {
        grid-template-columns: 1fr;
    }

    .sender-row {
        grid-template-columns: 28px 1fr 60px auto;
    }

    .sender-bar-container,
    .sender-size {
        display: none;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .space-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-content {
        padding: 10px 16px 40px;
    }
}

/* ── Sender Details Modal ────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay:not(.hidden) .modal-card {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-icon-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.btn-icon-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-badge {
    background: rgba(99, 115, 255, 0.1);
    color: var(--accent-blue);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(99, 115, 255, 0.2);
}

.modal-section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    font-weight: 600;
}

.smart-select-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-smart {
    background: rgba(99, 115, 255, 0.05);
    border: 1px solid rgba(99, 115, 255, 0.2);
    color: var(--accent-blue);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-smart:hover {
    background: rgba(99, 115, 255, 0.15);
    border-color: rgba(99, 115, 255, 0.4);
}

.email-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.email-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    display: grid;
    grid-template-columns: 24px 1fr auto;
    gap: 12px;
    align-items: center;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.email-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
}

.email-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-blue);
}

.select-all-item:hover {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: var(--border-card) !important;
}

.email-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.email-subject {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.email-meta {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 var(--radius) var(--radius);
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background: rgba(255, 77, 106, 0.1);
    border: 1px solid rgba(255, 77, 106, 0.3);
    color: var(--accent-red);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-weight: 600;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: var(--accent-red);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 77, 106, 0.4);
}

/* Score Modal Styles */
.score-clickable-area {
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    border-radius: var(--radius-md);
    padding: 10px;
    border: 1px solid transparent;
    /* Prepare for hover border */
}

.score-clickable-area:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    /* Similar to sender-row hover */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.score-details-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.score-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.score-detail-total {
    border: 2px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    margin-top: 8px;
    font-size: 1.1rem;
}

.text-danger {
    color: var(--accent-red);
}

.text-success {
    color: var(--success);
}

.text-neutral {
    color: var(--text-primary);
}


/* ── Confirmation Dialog (petite modale) ─────────────── */
.modal-card-sm {
    max-width: 440px;
}

.confirm-message {
    color: var(--text-secondary);
    line-height: 1.55;
    white-space: pre-line;
    word-break: break-word;
}

/* ── États vides ─────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 44px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.4rem;
    opacity: 0.7;
    line-height: 1;
}

.empty-state-text {
    font-size: 0.95rem;
    max-width: 320px;
}

/* ── Toasts (notifications non bloquantes) ───────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-card);
    border-left: 3px solid var(--accent-blue);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: var(--accent-green);
}

.toast-error {
    border-left-color: var(--accent-red);
}

.toast-warning {
    border-left-color: var(--accent-orange);
}

.toast-info {
    border-left-color: var(--accent-blue);
}

.toast-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1.3;
}

.toast-msg {
    flex: 1;
    white-space: pre-line;
    word-break: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
}

/* ── Accessibilité : respect de "réduire les animations" ─── */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .bg-orb {
        animation: none !important;
    }
}