/* =========================================================================
   Doodle — feuille de style
   Display : Space Grotesk · Corps : Inter
   ========================================================================= */

:root {
    /* Couleurs */
    --ink:        #17152b;
    --ink-soft:   #4a4763;
    --muted:      #8b88a3;
    --line:       #e7e4f0;
    --surface:    #ffffff;
    --bg:         #f5f3fb;

    --primary:    #5b4be0;
    --primary-2:  #7a5cf0;
    --primary-ink:#3a2db0;

    --yes:        #16a36a;
    --yes-bg:     #e3f6ec;
    --maybe:      #d98a09;
    --maybe-bg:   #fbf0d8;
    --no-bg:      #f1eff7;

    --danger:     #d6455d;

    --radius:     16px;
    --radius-sm:  10px;
    --shadow:     0 1px 2px rgba(23,21,43,.06), 0 12px 32px -12px rgba(23,21,43,.18);
    --shadow-lg:  0 24px 64px -20px rgba(91,75,224,.45);

    --ff-display: "Space Grotesk", system-ui, sans-serif;
    --ff-body:    "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--ff-body);
    color: var(--ink);
    background:
        radial-gradient(1200px 520px at 100% -10%, rgba(122,92,240,.10), transparent 60%),
        radial-gradient(900px 480px at -10% 0%, rgba(91,75,224,.08), transparent 55%),
        var(--bg);
    min-height: 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--ff-display); font-weight: 600; letter-spacing: -.02em; line-height: 1.1; margin: 0; }

/* -------------------------------------------------------------- Topbar */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 2.5rem);
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.7);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 20;
}
.brand {
    display: inline-flex; align-items: center; gap: .6rem;
    font-family: var(--ff-display); font-weight: 700; font-size: 1.25rem;
    color: var(--ink); letter-spacing: -.03em;
}
.brand:hover { text-decoration: none; }
.brand .dot {
    width: 28px; height: 28px; border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    display: grid; place-items: center; color: #fff; font-size: .95rem;
    box-shadow: 0 6px 16px -6px var(--primary);
}
.topbar .nav { display: flex; align-items: center; gap: 1.1rem; font-size: .92rem; }
.topbar .nav .who { color: var(--muted); }

/* -------------------------------------------------------------- Layout */
.container { max-width: 1040px; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem); }
.container.narrow { max-width: 520px; }

.page-head { margin-bottom: 1.75rem; }
.page-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.page-head p { color: var(--ink-soft); margin: .4rem 0 0; }
.eyebrow {
    text-transform: uppercase; letter-spacing: .14em; font-size: .72rem;
    font-weight: 600; color: var(--primary); margin-bottom: .5rem;
}

/* -------------------------------------------------------------- Cartes */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(1.25rem, 3vw, 2rem);
}
.card + .card { margin-top: 1.25rem; }

/* -------------------------------------------------------------- Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font-family: var(--ff-body); font-weight: 600; font-size: .95rem;
    padding: .7rem 1.2rem; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 10px 24px -12px var(--primary);
}
.btn-primary:hover { box-shadow: var(--shadow-lg); text-decoration: none; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: .45rem .8rem; font-size: .85rem; }

/* -------------------------------------------------------------- Formulaires */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: .35rem; }
input[type=text], input[type=email], input[type=password],
input[type=date], input[type=time], textarea {
    width: 100%; font: inherit; color: var(--ink);
    padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(91,75,224,.14);
}
textarea { resize: vertical; min-height: 88px; }

/* -------------------------------------------------------------- Flash */
.flash { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .92rem; border: 1px solid; }
.flash.info    { background: #eef0ff; border-color: #d6dbff; color: #34408a; }
.flash.success { background: var(--yes-bg); border-color: #bfe8d2; color: #11754d; }
.flash.error   { background: #fdeaee; border-color: #f6c6d0; color: #a3263b; }

/* -------------------------------------------------------------- Liste des doodles */
.doodle-list { display: grid; gap: 1rem; }
.doodle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.1rem 1.25rem; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.doodle-row:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.doodle-row .title { font-family: var(--ff-display); font-weight: 600; font-size: 1.1rem; color: var(--ink); }
.doodle-row .meta { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.tag {
    font-size: .72rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px;
    background: #eef0ff; color: var(--primary-ink); white-space: nowrap;
}
.tag.owner { background: var(--maybe-bg); color: var(--maybe); }

.empty {
    text-align: center; padding: 3rem 1.5rem; color: var(--muted);
    border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.5);
}

/* -------------------------------------------------------------- Créneaux (création) */
.option-rows { display: grid; gap: .6rem; margin-bottom: .75rem; }
.option-row { display: flex; gap: .6rem; align-items: center; }
.option-row input[type=date] { flex: 2; }
.option-row input[type=time] { flex: 1; }
.option-row .rm {
    border: 1px solid var(--line); background: #fff; color: var(--danger);
    width: 42px; height: 42px; border-radius: var(--radius-sm); cursor: pointer; flex: none;
    font-size: 1.1rem; line-height: 1;
}
.option-row .rm:hover { border-color: var(--danger); }

/* =========================================================================
   SIGNATURE — la grille de disponibilités
   Colonnes = créneaux · Lignes = participants · La meilleure colonne s'illumine
   ========================================================================= */
.grid-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
table.grid { border-collapse: collapse; width: 100%; min-width: 520px; }

table.grid th, table.grid td { padding: 0; text-align: center; border-bottom: 1px solid var(--line); }
table.grid thead th {
    position: sticky; top: 0; background: var(--surface);
    padding: .9rem .6rem; vertical-align: bottom; border-left: 1px solid var(--line);
}
table.grid thead th:first-child { border-left: none; }
.col-date { font-family: var(--ff-display); font-weight: 600; font-size: .95rem; }
.col-time { color: var(--muted); font-size: .78rem; font-weight: 500; }
.col-score {
    margin-top: .5rem; display: inline-flex; align-items: center; gap: .3rem;
    font-size: .78rem; font-weight: 700; color: var(--yes);
}

/* Colonne gagnante mise en avant */
table.grid th.best, table.grid td.best { background: linear-gradient(180deg, rgba(22,163,106,.10), rgba(22,163,106,.02)); }
table.grid th.best { box-shadow: inset 0 3px 0 var(--yes); }
.crown { color: var(--yes); }

.row-name {
    text-align: left; padding: .8rem 1rem; font-weight: 600; font-size: .9rem;
    white-space: nowrap; border-right: 1px solid var(--line); background: var(--surface);
    position: sticky; left: 0;
}
.row-name.me { color: var(--primary); }

.cell { border-left: 1px solid var(--line); padding: .65rem .4rem; }
.mark { font-size: 1.05rem; line-height: 1; display: inline-block; }
.cell.v2 { background: var(--yes-bg); }   .cell.v2 .mark { color: var(--yes); }
.cell.v1 { background: var(--maybe-bg); }  .cell.v1 .mark { color: var(--maybe); }
.cell.v0 { background: var(--no-bg); }     .cell.v0 .mark { color: var(--muted); }

tfoot td, tfoot th { padding: .7rem .4rem; font-weight: 700; font-family: var(--ff-display); border-top: 2px solid var(--line); }
tfoot .row-name { font-weight: 700; }
.count { font-size: .95rem; }
.count .sub { display: block; font-size: .72rem; color: var(--muted); font-weight: 500; }

/* -------------------------------------------------------------- Formulaire de vote */
.vote-grid { display: grid; gap: .6rem; }
.vote-option {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.vote-option .when { font-weight: 600; }
.vote-option .when small { color: var(--muted); font-weight: 500; margin-left: .4rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
    display: inline-block; padding: .45rem .9rem; font-size: .85rem; font-weight: 600;
    color: var(--muted); transition: background .15s, color .15s;
}
.seg input:checked + span.s2 { background: var(--yes-bg); color: var(--yes); }
.seg input:checked + span.s1 { background: var(--maybe-bg); color: var(--maybe); }
.seg input:checked + span.s0 { background: var(--no-bg); color: var(--ink); }
.seg input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--primary); }

/* -------------------------------------------------------------- Bloc lien à partager */
.share { display: flex; gap: .6rem; align-items: stretch; flex-wrap: wrap; }
.share input { flex: 1; min-width: 220px; font-family: ui-monospace, monospace; font-size: .85rem; background: #fbfaff; }
.legend { display: flex; gap: 1.2rem; flex-wrap: wrap; color: var(--ink-soft); font-size: .85rem; margin-top: 1rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: 14px; height: 14px; border-radius: 5px; }
.swatch.yes { background: var(--yes); } .swatch.maybe { background: var(--maybe); } .swatch.no { background: #cfccdf; }

/* -------------------------------------------------------------- Hero (accueil non connecté) */
.hero { text-align: center; padding: clamp(2.5rem, 8vw, 5rem) 1rem 2rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); max-width: 16ch; margin: 0 auto; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--ink-soft); font-size: 1.1rem; max-width: 52ch; margin: 1.1rem auto 1.8rem; }
.hero .cta { display: inline-flex; gap: .8rem; flex-wrap: wrap; justify-content: center; }

footer.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 2.5rem 1rem; }

/* -------------------------------------------------------------- Accessibilité / responsive */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (max-width: 560px) {
    .topbar .nav .who { display: none; }
    .vote-option { flex-direction: column; align-items: stretch; }
    .seg { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* -------------------------------------------------------------- Image d'en-tête */
.doodle-banner {
    margin-bottom: 1.5rem; border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface);
}
.doodle-banner img { display: block; width: 100%; max-height: 240px; object-fit: cover; }

/* -------------------------------------------------------------- Zone de dépôt (drag & drop) */
.dropzone {
    border: 2px dashed var(--line); border-radius: var(--radius-sm);
    background: #fbfaff; padding: 1.4rem; text-align: center; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--primary); }
.dropzone.dragover { border-color: var(--primary); background: #eef0ff; }
.dropzone.has-image { padding: 1rem; }
.dz-empty { display: flex; flex-direction: column; align-items: center; gap: .25rem; color: var(--ink-soft); }
.dz-icon { font-size: 1.6rem; }
.dz-empty strong { font-weight: 600; color: var(--ink); }
.dz-sub { font-size: .82rem; color: var(--muted); }
.dz-sub.error { color: var(--danger); }
.dz-preview { display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.dz-preview img { max-height: 180px; max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* --- Barre du haut en bleu clair --- */
.topbar {
    background: rgba(96, 132, 240, 0.92);     /* bleu clair (ajuste cette valeur) */
    border-bottom-color: rgba(255, 255, 255, 0.22);
}
.topbar .brand,
.topbar .nav a { color: #fff; }
.topbar .nav a:hover { color: #fff; }
.topbar .nav .who { color: rgba(255, 255, 255, 0.85); }

/* --- Cadre foncé autour du logo (pour le faire ressortir) --- */
.topbar .brand {
    background: #17152b;
    color: #fff;
    padding: .4rem .8rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.5);
}
.topbar .brand:hover { text-decoration: none; }

/* --- Sélecteur de langue --- */
.langswitch { display: inline-flex; gap: .1rem; align-items: center; margin-right: .35rem; }
.langswitch .lang {
    font-size: .74rem; font-weight: 700; letter-spacing: .02em;
    color: rgba(255, 255, 255, 0.72); padding: .22rem .42rem; border-radius: 6px;
    text-decoration: none; line-height: 1;
}
.langswitch .lang:hover { color: #fff; background: rgba(255, 255, 255, 0.16); text-decoration: none; }
.langswitch .lang.active { color: #fff; background: rgba(255, 255, 255, 0.28); }

/* La barre s'adapte sur petits écrans avec le sélecteur de langue */
@media (max-width: 600px) {
    .topbar { flex-wrap: wrap; gap: .6rem; }
    .topbar .nav { gap: .55rem; flex-wrap: wrap; justify-content: flex-end; }
}

/* --- Fond illustré de l'accueil, visible à 80% --- */
body.bg-doodle::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("/assets/img/bg-doodle.jpg") center / cover no-repeat;
    opacity: .05;
    z-index: -1;
    pointer-events: none;
}

/* --- Étiquette de date limite --- */
.deadline-chip {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .82rem; font-weight: 600; padding: .3rem .75rem; border-radius: 999px;
    margin-top: .7rem;
}
.deadline-chip.open   { background: #eef0ff; color: var(--primary-ink); }
.deadline-chip.closed { background: #fdeaee; color: #a3263b; }

/* --- Bouton danger (suppression) --- */
.btn-danger { background: #fff; border-color: #f3c6cf; color: var(--danger); }
.btn-danger:hover { background: #fdeaee; border-color: var(--danger); color: var(--danger); text-decoration: none; }
.danger-row { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }

/* --- Vignette d'image et actions dans la liste des doodles --- */
.doodle-row .row-main {
    display: flex; align-items: center; gap: .9rem; flex: 1; min-width: 0;
    color: inherit; text-decoration: none;
}
.doodle-row .row-main:hover { text-decoration: none; }
.row-thumb {
    width: 46px; height: 46px; flex: none; border-radius: 10px;
    object-fit: cover; border: 1px solid var(--line); background: #fff;
}
.row-actions { display: flex; gap: .5rem; align-items: center; flex: none; }

@media (max-width: 560px) {
    .doodle-row { flex-wrap: wrap; }
    .row-actions { width: 100%; justify-content: flex-end; }
}
