/* =========================================================================
   Escale — design system « Voyage & punchy »
   Dégradé indigo→violet, accents chauds, prix mis en avant. Mobile-first,
   dark mode automatique. Pas d'outillage : CSS artisanal via AssetMapper.
   ========================================================================= */

:root {
    /* Couleurs de marque */
    --indigo: #4f46e5;
    --violet: #7c3aed;
    --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --grad-warm: linear-gradient(135deg, #fb7185 0%, #f97316 100%);

    /* Surfaces & texte (clair) */
    --bg: #f5f4fb;
    --bg-soft: #ecebf7;
    --card: #ffffff;
    --ink: #191634;
    --muted: #6b6a86;
    --border: #e7e5f2;
    --accent: #6d28d9;
    --good: #15a34a;
    --danger: #dc2626;

    --shadow-sm: 0 1px 2px rgba(25, 22, 52, .06);
    --shadow: 0 6px 20px rgba(79, 70, 229, .10);
    --shadow-lg: 0 16px 40px rgba(79, 70, 229, .18);

    --radius: 16px;
    --radius-sm: 10px;
    --maxw: 1040px;

    --space: 1rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f0e1a;
        --bg-soft: #17162a;
        --card: #1b1930;
        --ink: #f1effa;
        --muted: #a6a4c8;
        --border: #2b2846;
        --accent: #a78bfa;
        --good: #34d399;
        --danger: #f87171;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow: 0 6px 20px rgba(0, 0, 0, .35);
        --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
    }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .75rem; }
h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); letter-spacing: -.01em; }

/* ---------- Header --------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    padding: .85rem clamp(1rem, 4vw, 2rem);
    background: var(--grad);
    box-shadow: var(--shadow);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -.02em;
    text-decoration: none;
    color: #fff;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.site-nav a {
    padding: .4rem .8rem;
    border-radius: 999px;
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}

.site-nav a:hover {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

/* ---------- Hero (accueil) ------------------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
    background: var(--grad);
    color: #fff;
    padding: clamp(2.5rem, 8vw, 4.5rem) clamp(1rem, 4vw, 2rem);
}

/* Halo lumineux pour donner de la profondeur au dégradé */
.hero::after {
    content: "";
    position: absolute;
    top: -30%;
    right: -10%;
    width: 45rem;
    height: 45rem;
    background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 60%);
    pointer-events: none;
}

.hero-inner { position: relative; max-width: var(--maxw); margin: 0 auto; }

.hero-title {
    font-size: clamp(1.9rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    margin: 0 0 .6rem;
}
.hero-title span { color: #fbbf24; } /* accent chaud sur « anormalement bas » */

.hero-sub {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    opacity: .92;
    max-width: 42rem;
    margin: 0 0 1.6rem;
}

.hero-search {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .6rem;
    padding: .8rem;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: var(--radius);
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow-lg);
}

.hero-field { display: flex; flex-direction: column; gap: .3rem; flex: 1 1 160px; min-width: 0; }
.hero-field > span { font-size: .78rem; font-weight: 700; letter-spacing: .02em; opacity: .95; }
.hero-field input {
    width: 100%;
    padding: .7rem .8rem;
    border: none;
    border-radius: var(--radius-sm);
    background: #fff;
    color: #191634; /* fixe : le fond reste blanc même en dark mode */
    font-size: 1rem;
}
.hero-field input:focus { outline: 2px solid #fbbf24; outline-offset: 1px; }

.hero-search button[type="submit"] {
    flex: 0 0 auto;
    background: #fff;
    color: var(--indigo);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.hero-search button[type="submit"]:hover { filter: none; background: #fff8ee; }

.hero-reset { display: inline-block; margin-top: .9rem; color: rgba(255, 255, 255, .9); font-size: .92rem; text-decoration: none; }
.hero-reset:hover { text-decoration: underline; }

/* En-tête de section + compteur */
.section-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.section-head h2 { margin: 0; }
.count-pill {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: .2rem .75rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
}

/* Code IATA discret à côté du nom de ville */
.iata { font-size: .68em; font-weight: 600; color: var(--muted); }
.deal-route .iata { color: color-mix(in srgb, var(--ink) 45%, transparent); }

/* ---------- Layout --------------------------------------------------------- */
.site-main {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem);
}

.lead { color: var(--muted); margin: -.25rem 0 1.5rem; font-size: 1.05rem; }

/* ---------- Flash ---------------------------------------------------------- */
.flash {
    padding: .8rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    font-weight: 500;
}
.flash-success { background: color-mix(in srgb, var(--good) 14%, transparent); border-color: color-mix(in srgb, var(--good) 35%, transparent); color: var(--good); }
.flash-error { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }

/* ---------- Feed : mise en page 2 colonnes --------------------------------- */
.feed-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.feed-sidebar { position: sticky; top: 5.5rem; }

.sidebar-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    padding: 1.1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.sidebar-group { display: flex; flex-direction: column; gap: .4rem; }
.sidebar-group > label {
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.sidebar-form select,
.sidebar-form input[type="date"] {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--ink);
    font-size: .95rem;
    font-family: inherit;
}
.sidebar-form input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; }

.switch {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: .55rem;
    font-size: .95rem;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
}
.switch input { width: 1.1rem; height: 1.1rem; accent-color: var(--violet); }

/* ---------- Feed : grille de bons plans ------------------------------------ */
.deal-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1.1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.deal-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

/* Liseré dégradé en haut de carte */
.deal-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--grad);
}

.deal-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--violet) 40%, var(--border));
}

.deal-link {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1.35rem 1.25rem 1.2rem;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.deal-route {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -.01em;
}

.deal-price {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.03em;
    color: var(--ink);
}

/* Badge de remise (chaud, accrocheur) */
.deal-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .28rem .7rem;
    border-radius: 999px;
    background: var(--grad-warm);
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    box-shadow: 0 2px 8px rgba(249, 115, 22, .35);
}

.deal-meta { display: flex; flex-wrap: wrap; gap: .35rem; }
.deal-meta-item {
    font-size: .78rem;
    color: var(--muted);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .1rem .55rem;
}
.deal-meta-item.is-direct { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--border)); font-weight: 600; }

.deal-date { color: var(--muted); font-size: .92rem; margin-top: auto; }

.empty {
    color: var(--muted);
    background: var(--card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.25rem;
    text-align: center;
}

/* ---------- Barre de filtres ---------------------------------------------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
    margin-bottom: 1.75rem;
    padding: .85rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.filter-bar input,
.filter-bar select {
    flex: 1 1 130px;
    min-width: 0;
    padding: .6rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--ink);
    font-size: 1rem;
}

.filter-bar input:focus,
.filter-bar select:focus,
.auth-form input:focus {
    outline: 2px solid color-mix(in srgb, var(--violet) 45%, transparent);
    outline-offset: 1px;
    border-color: var(--violet);
}

.reset-filters { color: var(--muted); font-size: .92rem; white-space: nowrap; }

/* ---------- Boutons -------------------------------------------------------- */
.button,
button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem 1.4rem;
    border: none;
    border-radius: 999px;
    background: var(--grad);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
    box-shadow: 0 4px 14px rgba(79, 70, 229, .28);
}

.button:hover,
button[type="submit"]:hover { transform: translateY(-1px); filter: brightness(1.05); }
.button:active,
button[type="submit"]:active { transform: translateY(0); }

/* ---------- Formulaires ---------------------------------------------------- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    max-width: 460px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.auth-form label { font-weight: 600; font-size: .92rem; }

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"],
.auth-form input[type="number"] {
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--ink);
    font-size: 1rem;
}

.auth-form button[type="submit"] { align-self: flex-start; }

.auth-form label.checkbox,
.auth-form .form-check {
    flex-direction: row;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 500;
}

.hint { color: var(--muted); font-size: .92rem; }

/* ---------- En-tête de page ------------------------------------------------ */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

/* ---------- Abonnements ---------------------------------------------------- */
.sub-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }

.sub-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1.5rem;
    padding: 1.1rem 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.sub-filters { display: flex; flex-wrap: wrap; gap: .5rem; color: var(--muted); font-size: .9rem; }
.sub-filters span { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .7rem; }
.inline-form { margin-left: auto; }

/* ---------- Zone danger + liens danger ------------------------------------ */
.link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: .9rem; padding: 0; text-decoration: underline; }

.danger-zone {
    margin-top: 2.5rem;
    padding: 1.35rem;
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--danger) 8%, var(--card));
}
.danger-zone h2 { margin-top: 0; color: var(--danger); }

.button-danger {
    padding: .6rem 1.3rem;
    border: none;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

/* ---------- Opt-in notifications push -------------------------------------- */
.push-optin {
    margin-top: 2rem;
    padding: 1.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}
.push-optin h2 { margin-top: 0; }
.push-status { color: var(--muted); font-size: .9rem; margin: .5rem 0 0; }

/* ---------- Détail d'un bon plan ------------------------------------------ */
.deal-detail {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.deal-price-lg {
    font-size: clamp(2.2rem, 7vw, 3rem);
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--ink);
    margin: 0 0 .35rem;
}

.deal-discount { color: var(--good); font-weight: 700; }
.deal-return { color: var(--muted); font-size: .9rem; }

/* ---------- Page détail ---------------------------------------------------- */
.back-link { margin: 0 0 1rem; }

.detail {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}

.detail-main { display: flex; flex-direction: column; gap: 1.25rem; }
.detail-main h2 { margin: .25rem 0 -.25rem; }

.detail-head,
.detail-facts,
.detail-chart {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.detail-head h1 { margin: 0 0 .85rem; }
.detail-price-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.detail-price-row .deal-price-lg { margin: 0; }
.detail-baseline { color: var(--muted); margin: .7rem 0 0; }

.detail-facts {
    list-style: none;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1.1rem;
}
.detail-facts li { display: flex; flex-direction: column; gap: .2rem; }
.detail-facts li > span { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.detail-facts li > strong { font-size: 1.05rem; }

.detail-cta { position: sticky; top: 5.5rem; }
.detail-cta-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .8rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.detail-cta-price { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.detail-cta-card .button { width: 100%; }

@media (max-width: 880px) {
    .detail { grid-template-columns: 1fr; padding-bottom: 5.5rem; }
    /* CTA en barre fixe en bas de l'écran */
    .detail-cta { position: fixed; inset: auto 0 0 0; top: auto; z-index: 30; padding: .6rem clamp(1rem, 4vw, 2rem); background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -6px 20px rgba(0, 0, 0, .12); }
    .detail-cta-card { flex-direction: row; align-items: center; gap: .75rem; padding: 0; border: none; box-shadow: none; background: transparent; }
    .detail-cta-card .deal-badge,
    .detail-cta-card .hint { display: none; }
    .detail-cta-price { font-size: 1.35rem; }
    .detail-cta-card .button { width: auto; margin-left: auto; white-space: nowrap; }
}

/* ---------- Mini-graphe d'historique de prix ------------------------------ */
.history-chart { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.history-chart li { display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: .75rem; }
.history-date { color: var(--muted); font-size: .85rem; }
.history-bar { height: .8rem; background: var(--grad); border-radius: 999px; min-width: 3px; }
.history-price { font-variant-numeric: tabular-nums; font-size: .9rem; }

/* ---------- Pagination ----------------------------------------------------- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: .4rem;
    margin-top: 2rem;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    padding: .5rem .85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: .95rem;
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, border-color .15s ease, color .15s ease;
}

.page-btn:hover { transform: translateY(-1px); border-color: var(--violet); color: var(--accent); }
.page-btn.is-current { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(79, 70, 229, .28); }
.page-btn.is-disabled { opacity: .45; pointer-events: none; }

/* ---------- Tableau admin (responsive) ------------------------------------ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }

.admin-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.admin-table th,
.admin-table td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg-soft); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--bg-soft); }

.admin-actions { display: flex; gap: .5rem; align-items: center; }
.admin-actions form { margin: 0; }
.admin-actions button { padding: .35rem .8rem; font-size: .85rem; border-radius: 999px; }

/* ---------- Responsive ----------------------------------------------------- */
/* Tablette & en dessous : la colonne de filtres repasse au-dessus des résultats. */
@media (max-width: 880px) {
    .feed-layout { grid-template-columns: 1fr; }
    .feed-sidebar { position: static; }
    .sidebar-form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
    .sidebar-group { flex: 1 1 150px; }
    .switch { height: 100%; align-items: center; }
}

@media (max-width: 640px) {
    .site-header { flex-direction: column; align-items: stretch; }
    .site-nav { justify-content: center; overflow-x: auto; }
    .deal-list { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar input, .filter-bar select { flex: 1 1 auto; }
    .inline-form { margin-left: 0; }
}
