/* =========================================================================
   Mailerx.fr — feuille de style (refonte SaaS pro & sobre)
   ========================================================================= */
:root {
    /* Palette resserrée : bleu nuit dominant + un seul accent cyan */
    --ink: #0d1b2a;
    --ink-soft: #1b2a3d;
    --primary: #1d4ed8;
    --primary-dark: #1e3a8a;
    --accent: #06b6d4;
    --accent-soft: #22d3ee;

    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #f9fafc;
    --border: #e6eaf0;
    --border-strong: #d3dae4;

    --text: #0f1f33;
    --text-muted: #5b6b80;
    --text-soft: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --link: #1d4ed8;

    --shadow-xs: 0 1px 2px rgba(13, 27, 42, 0.05);
    --shadow-sm: 0 2px 6px rgba(13, 27, 42, 0.06);
    --shadow: 0 4px 16px rgba(13, 27, 42, 0.08);
    --shadow-lg: 0 18px 44px rgba(13, 27, 42, 0.14), 0 4px 10px rgba(13, 27, 42, 0.05);

    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.55;
}

/* ---------- Navbar ---------- */
.navbar {
    background: rgba(255, 255, 255, 0.78);
    border-bottom: 1px solid var(--border);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.nav-status { display: flex; align-items: center; gap: 12px; }
.lang-select {
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
    padding: 5px 9px; border-radius: 8px; font-family: inherit; font-size: 13px;
    font-weight: 500; cursor: pointer; outline: none; transition: border-color .15s ease;
}
.lang-select:hover { border-color: var(--primary); }
.nav-links { display: flex; gap: 24px; }
.nav-link {
    font-size: 14px; font-weight: 600; color: var(--text-muted);
    text-decoration: none; transition: color 0.15s ease;
}
.nav-link:hover { color: var(--primary); }
.nav-badge {
    font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--success);
    background: rgba(16, 185, 129, 0.1); padding: 4px 9px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 6px; text-transform: uppercase;
}
.nav-badge::before {
    content: ''; width: 6px; height: 6px; background: var(--success);
    border-radius: 50%; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---------- Vue accueil ---------- */
#view-home {
    padding: 56px 24px 64px; text-align: center; position: relative; overflow: hidden;
    flex-grow: 1; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(ellipse 70% 50% at 50% -10%, rgba(6, 182, 212, 0.12), transparent 70%),
        radial-gradient(ellipse 50% 40% at 50% 0%, rgba(29, 78, 216, 0.08), transparent 70%);
}
#view-home[hidden] { display: none; }
#view-home::before {
    content: ''; position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(29, 78, 216, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(29, 78, 216, 0.045) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: radial-gradient(ellipse 55% 50% at 50% 0%, #000 25%, transparent 78%);
    pointer-events: none;
}
.hero-content { position: relative; max-width: 720px; width: 100%; margin: 0 auto; }
.hero-logo { margin-bottom: 28px; display: flex; justify-content: center; animation: fadeInDown 0.6s cubic-bezier(.16,1,.3,1); }
.hero-logo img {
    height: clamp(132px, 17vw, 220px); width: auto; max-width: 92%;
    filter: drop-shadow(0 10px 28px rgba(29, 78, 216, 0.16));
}
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.hero-content h1 {
    font-family: var(--font-display);
    font-size: clamp(32px, 4.6vw, 46px); font-weight: 800; letter-spacing: -0.035em;
    line-height: 1.12; margin: 0 0 18px; color: var(--ink);
    animation: fadeInUp .6s .05s both cubic-bezier(.16,1,.3,1);
}
.hero-content h1 .accent {
    background: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-content p {
    font-size: 17px; color: var(--text-muted); margin: 0 0 36px; max-width: 560px;
    margin-inline: auto; animation: fadeInUp .6s .12s both cubic-bezier(.16,1,.3,1);
}

/* ---------- Composer ---------- */
.composer {
    max-width: 600px; margin: 0 auto; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-xl);
    padding: 8px; box-shadow: var(--shadow-lg); display: flex;
    align-items: center; gap: 4px; transition: box-shadow .2s ease, border-color .2s ease;
    animation: fadeInUp .6s .18s both cubic-bezier(.16,1,.3,1);
}
.composer:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg), 0 0 0 4px rgba(6, 182, 212, 0.14);
}
.composer-input-wrap { flex: 1; display: flex; align-items: center; padding: 0 14px; min-width: 0; }
.composer-icon { color: var(--text-soft); flex-shrink: 0; }
html[dir="ltr"] .composer-icon { margin-right: 10px; }
html[dir="rtl"] .composer-icon { margin-left: 10px; }
.address-input {
    flex: 1; background: transparent; border: none; outline: none;
    font-family: var(--font-mono); font-size: 15px; font-weight: 500;
    color: var(--text); padding: 14px 0; width: 100%;
}
.address-input::placeholder { color: var(--text-soft); }
.domain-suffix { font-family: var(--font-mono); font-size: 15px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
html[dir="ltr"] .domain-suffix { margin-right: 8px; }
html[dir="rtl"] .domain-suffix { margin-left: 8px; }
.composer-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ---------- Boutons ---------- */
.btn {
    background: transparent; border: 1px solid transparent; padding: 10px 15px;
    border-radius: var(--radius); font-family: inherit; font-weight: 600; font-size: 14px;
    cursor: pointer; transition: all 0.15s ease; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary {
    background: linear-gradient(120deg, var(--primary), var(--primary-dark));
    color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(29, 78, 216, 0.28);
}
.btn-primary:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(29, 78, 216, 0.36); }
.btn svg { width: 16px; height: 16px; }

.hero-hints {
    display: flex; justify-content: center; gap: 22px; margin-top: 26px;
    flex-wrap: wrap; font-size: 13px; color: var(--text-muted);
    animation: fadeInUp .6s .24s both cubic-bezier(.16,1,.3,1);
}
.hint { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.hint svg { width: 14px; height: 14px; color: var(--success); }

/* ---------- Vue boîte ---------- */
#view-mailbox { display: flex; flex-grow: 1; height: calc(100vh - 65px); background: var(--surface); }
#view-mailbox[hidden] { display: none; }
.split-container { display: grid; grid-template-columns: 380px 1fr; height: 100%; width: 100%; }

.column-sidebar { border-right: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; height: 100%; }
html[dir="rtl"] .column-sidebar { border-right: none; border-left: 1px solid var(--border); }
.sidebar-header { padding: 18px 20px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.mailbox-meta-row { display: flex; align-items: center; justify-content: space-between; }
.sidebar-title-wrap { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink); }
.inbox-title-current {
    font-family: var(--font-mono); font-weight: 500; font-size: 12.5px;
    background: rgba(29, 78, 216, 0.07); color: var(--primary); padding: 4px 10px; border-radius: 7px;
    border: 1px solid rgba(29, 78, 216, 0.12); white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 170px;
}
.loader { display: none; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.loader.active { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.sidebar-actions-row { display: flex; gap: 6px; }
.btn-sm {
    padding: 7px 11px; font-size: 12.5px; font-weight: 600; border-radius: 8px; background: var(--surface);
    border: 1px solid var(--border-strong); color: var(--text-muted); cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px; transition: all .15s ease;
}
.btn-sm:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary); }
.btn-sm svg { width: 14px; height: 14px; }
.mail-count-badge { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.column-list-scroll { flex-grow: 1; overflow-y: auto; padding: 0; margin: 0; list-style: none; }
.mail-item {
    padding: 16px 20px; border-bottom: 1px solid var(--border); cursor: pointer;
    transition: background .15s ease; position: relative; animation: fadeInUp .25s ease both;
}
.mail-item:hover { background: rgba(29, 78, 216, 0.035); }
.mail-item.selected { background: var(--surface); box-shadow: inset 3px 0 0 var(--primary); }
.mail-item-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; gap: 8px; }
.mail-item-sender { font-weight: 700; font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: initial; }
.mail-item-date { font-size: 11px; color: var(--text-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mail-item-subject { font-size: 13px; color: var(--text-muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: initial; }

.empty-inbox { text-align: center; padding: 56px 24px; color: var(--text-soft); }
.empty-inbox svg { width: 42px; height: 42px; margin-bottom: 14px; opacity: 0.45; }
.empty-inbox p { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--text); }
.empty-inbox small { font-size: 12px; color: var(--text-muted); }
.empty-inbox.is-error, .empty-inbox.is-error p { color: var(--danger); }

/* ---------- Lecteur d'email ---------- */
.column-content { background: var(--surface); overflow-y: auto; display: flex; flex-direction: column; height: 100%; }
.content-placeholder { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-soft); gap: 14px; }
.content-placeholder[hidden] { display: none; }
.content-placeholder svg { width: 52px; height: 52px; opacity: 0.35; }
.content-placeholder p { max-width: 280px; text-align: center; font-size: 14px; }
#mail-viewer-content { height: 100%; }
#mail-viewer-content[hidden] { display: none; }

.mail-view-wrapper { padding: 32px; display: flex; flex-direction: column; gap: 22px; height: 100%; }
html[dir="rtl"] .mail-view-wrapper { text-align: right; }
.mail-view-header { border-bottom: 1px solid var(--border); padding-bottom: 20px; flex-shrink: 0; }
.mail-view-subject { font-family: var(--font-display); font-size: 23px; font-weight: 800; color: var(--ink); margin: 0 0 16px 0; letter-spacing: -0.02em; line-height: 1.25; }
.mail-view-meta-box { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--surface-2); padding: 13px 16px; border-radius: var(--radius); border: 1px solid var(--border); flex-wrap: wrap; }
.mail-view-sender-info { font-size: 14px; color: var(--text-muted); }
.mail-view-sender-name { font-weight: 700; color: var(--ink); }
.mail-view-sender-email { font-family: var(--font-mono); font-size: 12px; color: var(--text-soft); }
.mail-view-date { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Fallback texte : lisible + liens cliquables stylés */
.mail-view-body {
    font-family: var(--font-body); font-size: 14.5px; color: var(--text);
    white-space: pre-wrap; word-break: break-word; line-height: 1.7;
    background: var(--surface-2); border: 1px solid var(--border);
    padding: 22px 24px; border-radius: var(--radius-lg); overflow-y: auto; flex-grow: 1;
}
.mail-view-body a { color: var(--link); text-decoration: none; border-bottom: 1px solid rgba(29,78,216,.25); word-break: break-all; transition: border-color .15s ease; }
.mail-view-body a:hover { border-bottom-color: var(--link); }

.mail-view-iframe { width: 100%; height: 100%; border: none; background: #fff; border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--border); flex-grow: 1; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 26px 24px; text-align: center; }
.footer-stat { font-size: 14px; color: var(--text-muted); margin-bottom: 6px; }
.stats-number {
    font-family: var(--font-display); font-weight: 800; font-size: 18px;
    background: linear-gradient(120deg, var(--primary), var(--accent));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    margin: 0 4px; font-variant-numeric: tabular-nums;
}
.footer-meta { font-size: 12px; color: var(--text-soft); }

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--ink); color: #fff; padding: 13px 20px; border-radius: var(--radius);
    font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0;
    pointer-events: none; transition: all 0.25s cubic-bezier(.16,1,.3,1); display: inline-flex;
    align-items: center; gap: 8px; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 16px; height: 16px; color: var(--accent-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .navbar { padding: 12px 16px; }
    .split-container { grid-template-columns: 1fr; }
    .column-content { display: none; }
    .column-content.active-mobile { display: flex; position: fixed; inset: 65px 0 0 0; z-index: 40; }
    .mail-view-wrapper { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}


