/* ============================================
   NOS TABLES — Carnet de critiques gastronomiques
   Style : néo-brutalisme soft « gourmand »
   ============================================ */

/* ---------- VARIABLES DE THÈME ---------- */
:root {
    /* Palette aliments */
    --paper:    #FDF1E3;   /* crème chaud (fond)          */
    --paper-2:  #F7E6CF;   /* crème plus soutenu          */
    --card:     #FFFFFF;   /* surface des fiches          */
    --ink:      #1E1A16;   /* encre : bordures, texte     */
    --ink-soft: #6B5E52;   /* texte secondaire            */
    --tomato:   #FF4D3D;   /* tomate : action principale  */
    --mustard:  #FFC12E;   /* moutarde : favoris, à tester */
    --herb:     #1FB673;   /* herbe : testé, excellence   */

    /* Neutres utilitaires */
    --line:     #E7D6BF;   /* filets discrets             */

    /* Formes */
    --radius:   12px;
    --radius-s: 8px;
    --border:   2.5px solid var(--ink);
    --shadow:   4px 4px 0 var(--ink);
    --shadow-s: 3px 3px 0 var(--ink);
    --shadow-lg: 6px 6px 0 var(--ink);

    --t: all 0.18s ease;

    --font-display: "Bricolage Grotesque", "Space Grotesk", sans-serif;
    --font-body:    "Space Grotesk", system-ui, sans-serif;
}

/* ---------- BASE ---------- */
* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 28px 18px 64px;
    background-color: var(--paper);
    background-image:
        radial-gradient(var(--paper-2) 1.1px, transparent 1.1px);
    background-size: 22px 22px;
    font-family: var(--font-body);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 900px;
    margin: 0 auto;
}

/* ---------- EN-TÊTE ---------- */
header {
    text-align: center;
    margin-bottom: 26px;
}

.eyebrow {
    display: inline-block;
    background: var(--ink);
    color: var(--paper);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}

h1 {
    font-family: var(--font-display);
    font-size: clamp(42px, 12vw, 68px);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 0.95;
    margin: 0;
}

h1 .accent { color: var(--tomato); }

.tagline {
    color: var(--ink-soft);
    font-size: 14px;
    margin: 10px 0 0;
}

/* ---------- RÉSUMÉ (STATS) ---------- */
#resume {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 26px;
}

.stat {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-s);
    padding: 16px 10px;
    text-align: center;
}

.stat-val {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
}
.stat:nth-child(1) .stat-val { color: var(--herb); }
.stat:nth-child(2) .stat-val { color: var(--tomato); }
.stat:nth-child(3) .stat-val { color: var(--mustard); }

.stat-label {
    font-size: 10.5px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-top: 6px;
    font-weight: 600;
}

/* ---------- BARRE D'OUTILS ---------- */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.search-wrap {
    position: relative;
    flex: 1;
}
.search-wrap svg {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--ink-soft);
    pointer-events: none;
}
#recherche {
    width: 100%;
    padding: 13px 14px 13px 40px;
    border: var(--border);
    border-radius: var(--radius);
    background: var(--card);
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink);
    outline: none;
    box-shadow: var(--shadow-s);
    transition: var(--t);
}
#recherche:focus {
    box-shadow: var(--shadow);
    transform: translate(-1px, -1px);
}
#recherche::placeholder { color: var(--ink-soft); }

.btn-ajouter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--tomato);
    color: #fff;
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-s);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    padding: 0 18px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--t);
}
.btn-ajouter svg { width: 18px; height: 18px; }
.btn-ajouter:hover {
    box-shadow: var(--shadow);
    transform: translate(-1px, -1px);
}
.btn-ajouter:active { box-shadow: 1px 1px 0 var(--ink); transform: translate(2px, 2px); }
.btn-ajouter .label-long { display: none; }

/* ---------- FILTRES ---------- */
.filtres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.filtres:last-of-type { margin-bottom: 24px; }

.chip {
    background: var(--card);
    border: var(--border);
    border-radius: 999px;
    padding: 7px 14px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: var(--t);
    box-shadow: 2px 2px 0 var(--ink);
}
.chip:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow-s); }
.chip.actif {
    background: var(--ink);
    color: var(--paper);
}
/* teintes d'accent sur les puces de statut actives */
.chip[data-statut="teste"].actif    { background: var(--herb);   color: #fff; border-color: var(--ink); }
.chip[data-statut="a_tester"].actif { background: var(--mustard); color: var(--ink); }
.chip[data-statut="favoris"].actif  { background: var(--tomato); color: #fff; }

.select-cuisine {
    appearance: none;
    -webkit-appearance: none;
    background: var(--card);
    border: var(--border);
    border-radius: 999px;
    padding: 7px 34px 7px 14px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--ink);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231E1A16' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.filtre-titre {
    font-size: 10.5px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--ink-soft);
    font-weight: 600;
    margin-right: 2px;
}

/* ---------- LISTE DES FICHES ---------- */
#liste {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.fiche {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--t);
}
.fiche:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }

.fiche-photo {
    height: 150px;
    background: var(--paper-2);
    background-size: cover;
    background-position: center;
    border-bottom: var(--border);
    position: relative;
}
.fiche-photo.vide {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
}
.fiche-photo.vide svg { width: 34px; height: 34px; opacity: 0.5; }

.badge-statut {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 9px;
    border: 2px solid var(--ink);
    border-radius: 999px;
}
.badge-statut.teste    { background: var(--herb);   color: #fff; }
.badge-statut.a_tester { background: var(--mustard); color: var(--ink); }

.btn-favori {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--ink);
    transition: var(--t);
    padding: 0;
}
.btn-favori:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow-s); }
.btn-favori svg { width: 18px; height: 18px; color: var(--ink-soft); }
.btn-favori.on { background: var(--mustard); }
.btn-favori.on svg { color: var(--ink); fill: var(--ink); }

.fiche-corps {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.fiche-haut {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.fiche-nom {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.1;
    margin: 0;
}

.fiche-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 12.5px;
    color: var(--ink-soft);
    font-weight: 500;
}
.tag-cuisine {
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: 999px;
    padding: 3px 9px;
    color: var(--ink);
    font-weight: 600;
    font-size: 12px;
}
.dot-sep { color: var(--line); }
.budget-eur { font-weight: 700; color: var(--ink); letter-spacing: 1px; }

.fiche-lieu {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: var(--ink-soft);
}
.fiche-lieu svg { width: 14px; height: 14px; flex-shrink: 0; }

.envie-txt {
    font-size: 13.5px;
    color: var(--ink-soft);
    font-style: italic;
    border-left: 3px solid var(--mustard);
    padding-left: 10px;
}

/* ---------- TAMPON DE NOTE (signature) ---------- */
.note-stamp {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: 8px 10px;
    border: 3px solid var(--ink);
    border-radius: 14px;
    box-shadow: var(--shadow-s);
    transform: rotate(-4deg);
    line-height: 1;
    flex-shrink: 0;
}
.note-stamp .val {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
}
.note-stamp .max {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 0.85;
    margin-top: 1px;
}
.note-stamp.exc { background: var(--herb);   color: #fff; }
.note-stamp.bon { background: var(--mustard); color: var(--ink); }
.note-stamp.moy { background: var(--tomato);  color: #fff; }
.note-stamp.na  { background: var(--paper);   color: var(--ink-soft); border-style: dashed; }

/* ---------- ACTIONS DE FICHE ---------- */
.fiche-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}
.btn-mini {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: var(--radius-s);
    padding: 9px 6px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: var(--t);
}
.btn-mini svg { width: 15px; height: 15px; }
.btn-mini:hover { background: var(--ink); color: var(--paper); }
.btn-mini.danger:hover { background: var(--tomato); color: #fff; border-color: var(--ink); }
.btn-mini.primary { background: var(--ink); color: var(--paper); }
.btn-mini.primary:hover { background: var(--tomato); }

/* ---------- ÉTAT VIDE ---------- */
.vide-liste {
    grid-column: 1 / -1;
    text-align: center;
    padding: 54px 20px;
    border: 2.5px dashed var(--ink);
    border-radius: var(--radius);
    color: var(--ink-soft);
    background: var(--card);
}
.vide-liste svg { width: 44px; height: 44px; margin-bottom: 12px; color: var(--tomato); }
.vide-liste h3 {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--ink);
    margin: 0 0 6px;
}
.vide-liste p { margin: 0; font-size: 14px; }

/* ============================================
   MODALES (fenêtres formulaire + détail)
   ============================================ */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 26, 22, 0.55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
    z-index: 100;
    animation: fadeIn 0.18s ease;
}
.overlay.ouvert { display: flex; }

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

.modale {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    margin: auto 0;
    animation: slideUp 0.22s ease;
}

.modale-tete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: var(--border);
    position: sticky;
    top: 0;
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    z-index: 2;
}
.modale-tete h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}
.btn-fermer {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--t);
    padding: 0;
}
.btn-fermer svg { width: 18px; height: 18px; }
.btn-fermer:hover { background: var(--tomato); color: #fff; }

.modale-corps { padding: 20px; }

/* ---------- FORMULAIRE ---------- */
.champ { margin-bottom: 16px; }
.champ:last-child { margin-bottom: 0; }

.champ label {
    display: block;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.champ input[type="text"],
.champ input[type="number"],
.champ input[type="date"],
.champ input[type="url"],
.champ textarea,
.champ select {
    width: 100%;
    padding: 11px 12px;
    border: 2px solid var(--ink);
    border-radius: var(--radius-s);
    background: var(--paper);
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink);
    outline: none;
    transition: var(--t);
}
.champ textarea { resize: vertical; min-height: 78px; }
.champ input:focus,
.champ textarea:focus,
.champ select:focus {
    background: var(--card);
    box-shadow: var(--shadow-s);
}

.champ-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.hint {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 5px;
}

/* Sélecteur de statut (segmenté) */
.seg {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 2px solid var(--ink);
    border-radius: var(--radius-s);
    overflow: hidden;
}
.seg label {
    margin: 0;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
    background: var(--card);
    transition: var(--t);
}
.seg label:first-child { border-right: 2px solid var(--ink); }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.seg input[value="a_tester"]:checked + label { background: var(--mustard); color: var(--ink); }
.seg input[value="teste"]:checked + label    { background: var(--herb);   color: #fff; }

/* Section critique (visible seulement pour « testé ») */
#section-critique {
    border-top: 2px dashed var(--line);
    margin-top: 4px;
    padding-top: 18px;
}
#section-critique.masquee { display: none; }

.critique-titre {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.critique-titre svg { width: 18px; height: 18px; color: var(--tomato); }

/* Notes /20 en grille */
.notes-grille {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.note-champ label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.note-suffixe { font-size: 11px; color: var(--ink-soft); }

.moyenne-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: var(--radius-s);
    padding: 12px 14px;
    margin: 16px 0;
}
.moyenne-box .lib {
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--ink-soft);
}
.moyenne-box .val {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    color: var(--tomato);
}

/* Aperçu photos */
.apercu-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.vignette {
    position: relative;
    width: 72px;
    height: 72px;
    border: 2px solid var(--ink);
    border-radius: var(--radius-s);
    background-size: cover;
    background-position: center;
    background-color: var(--paper-2);
}
.vignette .rm {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 22px;
    height: 22px;
    background: var(--tomato);
    color: #fff;
    border: 2px solid var(--ink);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.vignette .rm svg { width: 12px; height: 12px; }

.file-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: var(--radius-s);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--t);
}
.file-btn:hover { background: var(--ink); color: var(--paper); }
.file-btn svg { width: 16px; height: 16px; }
#f-photos { display: none; }

/* Pied du formulaire */
.form-pied {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: var(--border);
}
.btn-form {
    flex: 1;
    padding: 14px;
    border: var(--border);
    border-radius: var(--radius-s);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--t);
}
.btn-form.secondaire { background: var(--card); color: var(--ink); }
.btn-form.secondaire:hover { background: var(--paper-2); }
.btn-form.principal {
    background: var(--tomato);
    color: #fff;
    box-shadow: var(--shadow-s);
}
.btn-form.principal:hover { box-shadow: var(--shadow); transform: translate(-1px, -1px); }
.btn-form.principal:disabled {
    opacity: 0.6;
    cursor: wait;
    box-shadow: 1px 1px 0 var(--ink);
    transform: none;
}

/* ---------- CONTENU DÉTAIL ---------- */
.detail-galerie {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: -20px -20px 18px;
    padding: 0;
    border-bottom: var(--border);
}
.detail-galerie img {
    height: 190px;
    min-width: 60%;
    object-fit: cover;
    flex-shrink: 0;
}
.detail-galerie img:only-child { min-width: 100%; }

.detail-entete {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}
.detail-entete .titre { font-family: var(--font-display); font-size: 26px; font-weight: 800; margin: 0; line-height: 1.05; }

.detail-ligne {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.detail-bloc { margin-bottom: 18px; }
.detail-bloc h4 {
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0 0 8px;
    font-weight: 700;
}
.detail-bloc p { margin: 0; font-size: 15px; line-height: 1.55; }
.verdict-txt {
    background: var(--paper);
    border-left: 4px solid var(--tomato);
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.55;
}

/* Barres de critères */
.criteres-barres { display: flex; flex-direction: column; gap: 10px; }
.critere-item { }
.critere-tete {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.critere-tete .n { font-family: var(--font-display); font-weight: 700; }
.barre {
    height: 14px;
    background: var(--paper-2);
    border: 2px solid var(--ink);
    border-radius: 999px;
    overflow: hidden;
}
.barre-fill {
    height: 100%;
    border-radius: 999px;
}
.barre-fill.exc { background: var(--herb); }
.barre-fill.bon { background: var(--mustard); }
.barre-fill.moy { background: var(--tomato); }

.lien-maps {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 14px;
    border-radius: 999px;
    transition: var(--t);
}
.lien-maps:hover { background: var(--tomato); color: #fff; }
.lien-maps svg { width: 15px; height: 15px; }

.detail-pied {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: var(--border);
}

/* ---------- PIED DE PAGE ---------- */
footer {
    text-align: center;
    margin-top: 40px;
    color: var(--ink-soft);
    font-size: 12px;
    letter-spacing: 1px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 560px) {
    .btn-ajouter .label-long { display: inline; }
}

@media (min-width: 680px) {
    body { padding: 40px 24px 72px; }
    #liste { grid-template-columns: 1fr 1fr; }
}

/* Accessibilité : mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
    .note-stamp { transform: none; }
}

/* Focus clavier visible */
:focus-visible {
    outline: 3px solid var(--tomato);
    outline-offset: 2px;
}
