/* ===========================================
   AMAP des Jalles — Variante v2 "Yuka app"
   Direction : moderne, data-driven, transparence,
   mobile-first, gros radius pills, ombres molles colorées,
   Nunito ronde, vert app saturé + vert soft + jaune/rouge scoring.
   Classes du site préservées pour compat JS/HTML.
   =========================================== */

:root {
    /* Palette Yuka */
    --green: #54b948;            /* vert app principal */
    --green-dark: #3a9032;       /* vert hover, liens */
    --green-soft: #e6f7e3;       /* fond doux, chips actifs */
    --green-glow: rgba(84, 185, 72, 0.35);

    --orange: #ff9800;
    --yellow: #ffc107;
    --red: #e64a4a;

    --bg: #fafbfc;               /* fond principal app */
    --white: #ffffff;
    --ink: #1d2733;
    --mute: #6a7787;
    --line: #eef1f5;

    /* Radius */
    --r-pill: 999px;
    --r-card: 24px;
    --r-card-lg: 32px;
    --r-chip: 14px;
    --r-tag: 999px;

    /* Shadows */
    --sh-card: 0 4px 16px rgba(29, 39, 51, 0.05);
    --sh-card-hover: 0 10px 30px rgba(29, 39, 51, 0.08);
    --sh-cta: 0 6px 18px var(--green-glow);
    --sh-cta-big: 0 30px 80px rgba(84, 185, 72, 0.3);
    --sh-float: 0 20px 60px rgba(29, 39, 51, 0.08);

    /* Espace */
    --gutter: clamp(20px, 4vw, 32px);

    /* Alias rétro-compat — les HTML/JS utilisent var(--color-*) en inline */
    --color-primary: var(--green);
    --color-secondary: var(--green-dark);
    --color-accent: var(--yellow);
    --color-text: var(--ink);
    --color-text-light: var(--mute);
    --color-bg: var(--bg);
    --color-white: var(--white);
    --color-border: var(--line);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: 'Nunito', system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    font-size: 16px;
}

a { color: var(--green-dark); text-decoration: none; }

/* === HEADER app-style === */
header {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--green-dark);
    font-weight: 900;
}

.logo-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: var(--r-chip);
    background: var(--green-soft);
    padding: 4px;
}

.logo-text h1 {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--green-dark);
    line-height: 1.1;
}
.logo-text p {
    font-size: 0.78rem;
    color: var(--mute);
    font-weight: 600;
    margin-top: 2px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 4px;
    align-items: center;
}

nav a {
    display: inline-block;
    padding: 9px 16px;
    color: var(--mute);
    border-radius: var(--r-pill);
    font-size: 0.92rem;
    font-weight: 700;
    transition: all 0.18s ease;
}
nav a:hover, nav a.active {
    background: var(--green-soft);
    color: var(--green-dark);
}

.amapj-btn {
    margin-left: 8px;
    padding: 8px 14px !important;
    background: var(--green) !important;
    border-radius: var(--r-pill) !important;
    box-shadow: var(--sh-cta);
}
.amapj-btn:hover {
    background: var(--green-dark) !important;
    transform: translateY(-1px);
}

.menu-toggle {
    display: none;
    background: var(--green-soft);
    border: none;
    color: var(--green-dark);
    font-size: 1.3em;
    padding: 8px 12px;
    border-radius: var(--r-chip);
    cursor: pointer;
}

/* === HERO === */
.hero {
    background: var(--bg);
    color: var(--ink);
    padding: clamp(50px, 8vh, 80px) var(--gutter) clamp(40px, 6vh, 70px);
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    right: -100px;
    top: -100px;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(84, 185, 72, 0.10), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 18px;
    color: var(--ink);
    max-width: 18ch;
}
.hero h1 em,
.hero h1 .accent { color: var(--green); font-style: normal; }

.hero p {
    font-size: 1.1rem;
    color: var(--mute);
    margin-bottom: 28px;
    max-width: 52ch;
    font-weight: 500;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Hero en deux colonnes : accroche à gauche, prochaine distribution compacte à droite */
.hero-flex {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: clamp(24px, 5vw, 60px);
}
.hero-flex .hero-content { margin: 0; flex: 1 1 320px; }
.hero-logo {
    display: block;
    width: clamp(160px, 24vw, 260px);
    height: auto;
    margin-bottom: 22px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(58, 144, 50, 0.18);
}
.hero-next {
    flex: 0 1 320px;
    background: #fff;
    border: 1px solid var(--line, #e5e7eb);
    border-radius: var(--r-card, 16px);
    box-shadow: var(--sh-card, 0 4px 16px rgba(0,0,0,0.06));
    padding: 20px 22px;
    position: relative;
    z-index: 1;
}
.hero-next-label {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--green-dark);
    margin-bottom: 8px;
}
.hero-next-date { display: block; font-size: 1.35rem; font-weight: 900; color: var(--ink); line-height: 1.1; }
.hero-next-meta { display: block; font-size: 0.92rem; color: var(--mute); margin-top: 6px; }
.hero-next-count { display: block; font-size: 0.92rem; font-weight: 700; color: var(--green-dark); margin-top: 10px; }
.hero-next-producers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: 1.3rem; }
.hero-map-card { flex: 1.4 1 560px; padding: 14px; }
.hero-map {
    height: 300px;
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    z-index: 0;
}
@media (max-width: 768px) {
    .hero-next { flex-basis: 100%; }
    .hero-map-card { flex-basis: 100%; }
    .hero-map { height: 260px; }
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 26px;
    border-radius: var(--r-pill);
    text-decoration: none;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.98rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.btn-primary {
    background: var(--green);
    color: var(--white);
    box-shadow: var(--sh-cta);
}
.btn-primary:hover {
    background: var(--green-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px var(--green-glow);
}

.btn-secondary {
    background: var(--green-soft);
    color: var(--green-dark);
    box-shadow: none;
}
.btn-secondary:hover {
    background: #d4f1d0;
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--ink);
    color: var(--white);
    box-shadow: 0 6px 18px rgba(29, 39, 51, 0.18);
}
.btn-accent:hover {
    background: #0f1820;
    transform: translateY(-2px);
}

/* === SECTIONS === */
.section {
    padding: clamp(50px, 8vh, 80px) var(--gutter);
}

.section-light {
    background: var(--white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    margin-bottom: 48px;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.section-title h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 12px;
    line-height: 1.1;
}
.section-title p {
    color: var(--mute);
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto;
    font-weight: 500;
}
/* Petit chip "tagline" si présent comme premier enfant (optionnel — non utilisé par défaut, prêt pour une évolution) */
.section-title .chip {
    display: inline-block;
    background: var(--green-soft);
    color: var(--green-dark);
    padding: 6px 14px;
    border-radius: var(--r-pill);
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 14px;
}

/* === CARDS — pills arrondies, ombres molles === */
.card {
    background: var(--white);
    border-radius: var(--r-card);
    padding: 28px;
    box-shadow: var(--sh-card);
    transition: all 0.2s ease;
    border: 2px solid transparent;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--sh-card-hover);
    border-color: transparent;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--r-chip);
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 1.7em;
    margin-bottom: 18px;
}

.card h3 {
    font-size: 1.15rem;
    margin-bottom: 10px;
    color: var(--ink);
    font-weight: 800;
    line-height: 1.25;
}

.card p {
    color: var(--mute);
    font-size: 0.95rem;
    line-height: 1.55;
}

.card.highlight {
    background: var(--green-soft);
    box-shadow: none;
}

/* === PRODUCTEURS — prod-pill style === */
.producer-card {
    background: var(--white);
    border-radius: var(--r-card);
    overflow: hidden;
    box-shadow: var(--sh-card);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
}
.producer-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sh-card-hover);
    border-color: var(--green);
}

.producer-card-header {
    /* Fallback vert ; le JS injecte un dégradé par catégorie en inline (override naturel) */
    background: var(--green);
    color: var(--white);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.producer-emoji {
    font-size: 1.8em;
    background: rgba(255, 255, 255, 0.25);
    padding: 12px;
    border-radius: var(--r-chip);
    line-height: 1;
    backdrop-filter: blur(4px);
}

.producer-card-title h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--white);
}
.producer-card-title p {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.producer-card-body { padding: 22px 24px; }

.producer-description {
    color: var(--mute);
    font-size: 0.94rem;
    line-height: 1.55;
    margin-bottom: 16px;
}
.producer-description strong { color: var(--ink); font-weight: 800; }

.products-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-tag {
    background: var(--line);
    color: var(--mute);
    padding: 5px 12px;
    border-radius: var(--r-tag);
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid transparent;
}
.product-tag.active {
    background: var(--green-soft);
    color: var(--green-dark);
    border-color: var(--green);
}

/* === PLANNING === */
.planning-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
    border-radius: var(--r-card);
    overflow: hidden;
    box-shadow: var(--sh-card);
    font-size: 0.92rem;
}

.planning-table th,
.planning-table td {
    padding: 14px 12px;
    text-align: center;
    border-bottom: 1px solid var(--line);
}

.planning-table thead { background: var(--green); }
.planning-table thead th {
    background: var(--green) !important;
    color: var(--white) !important;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: none;
}

.planning-table tbody tr:hover { background: var(--green-soft); }
.planning-table tbody tr:last-child td { border-bottom: none; }

.planning-table .date-cell {
    text-align: left;
    font-weight: 800;
    color: var(--ink);
}

.planning-table .present {
    color: var(--green-dark);
    font-weight: 900;
    font-size: 1.05em;
}

.planning-table .absent { color: #cdd4dd; }

.next-distribution {
    background: var(--green-soft) !important;
    box-shadow: inset 4px 0 0 var(--green);
}
.next-distribution .date-cell { color: var(--green-dark); }

/* === CONTACT & INFO === */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.info-card {
    background: var(--white);
    border-radius: var(--r-card);
    padding: 28px;
    box-shadow: var(--sh-card);
    transition: all 0.2s ease;
}
.info-card:hover { transform: translateY(-2px); box-shadow: var(--sh-card-hover); }

.info-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    color: var(--ink);
    font-size: 1.1rem;
    font-weight: 800;
}

.info-card ul { list-style: none; }

.info-card li {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--mute);
    font-size: 0.94rem;
    font-weight: 500;
}
.info-card li:last-child { border-bottom: none; }

/* === MAP === */
.map-container {
    height: 420px;
    border-radius: var(--r-card);
    overflow: hidden;
    box-shadow: var(--sh-card);
    background: var(--line);
}

/* === STATS — pills === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--white);
    border-radius: 20px;
    padding: 24px;
    text-align: left;
    box-shadow: var(--sh-card);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-card:hover { transform: translateY(-2px); }

.stat-card.highlight {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    color: var(--white);
    box-shadow: var(--sh-cta);
}
.stat-card.highlight .stat-label { color: rgba(255, 255, 255, 0.9); }

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.02em;
}
.stat-card.highlight .stat-value { color: var(--white); }

.stat-label {
    font-size: 0.82rem;
    color: var(--mute);
    font-weight: 700;
    margin-top: 4px;
}

/* === FOOTER === */
footer {
    background: var(--white);
    color: var(--mute);
    padding: 50px var(--gutter) 30px;
    border-top: 1px solid var(--line);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 36px;
}

.footer-section h4 {
    color: var(--ink);
    font-weight: 900;
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.footer-section p {
    color: var(--mute);
    font-size: 0.92rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.footer-section ul { list-style: none; }
.footer-section li { margin-bottom: 8px; font-size: 0.92rem; color: var(--mute); font-weight: 500; }

.footer-section a {
    color: var(--mute);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 600;
}
.footer-section a:hover { color: var(--green-dark); }

.footer-bottom {
    max-width: 1200px;
    margin: 36px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--mute);
    font-size: 0.85rem;
    font-weight: 500;
}
.footer-version { opacity: 0.7; font-size: 0.92em; margin-top: 4px; }

/* === DATA IMPORT === */
.import-zone {
    border: 2px dashed var(--green);
    border-radius: var(--r-card);
    padding: 56px;
    text-align: center;
    background: var(--green-soft);
    transition: all 0.2s ease;
    cursor: pointer;
}
.import-zone:hover, .import-zone.dragover {
    background: var(--white);
    transform: scale(1.01);
}
.import-zone.loaded {
    border-color: var(--green-dark);
    background: var(--green);
    color: var(--white);
}
.import-icon { font-size: 2.4em; margin-bottom: 16px; }

/* === TABS === */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 28px;
    padding: 6px;
    background: var(--white);
    border-radius: var(--r-pill);
    box-shadow: var(--sh-card);
    width: fit-content;
}

.tab {
    background: transparent;
    border: none;
    padding: 10px 22px;
    border-radius: var(--r-pill);
    font-family: 'Nunito', sans-serif;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--mute);
    font-weight: 700;
}
.tab:hover { color: var(--ink); }
.tab.active {
    background: var(--green);
    color: var(--white);
    box-shadow: var(--sh-cta);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* === NOTIFICATIONS === */
.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 14px 22px;
    border-radius: var(--r-chip);
    background: var(--white);
    box-shadow: var(--sh-float);
    z-index: 10000;
    transform: translateX(420px);
    transition: transform 0.25s ease;
    font-size: 0.95rem;
    font-weight: 600;
}
.notification.show { transform: translateX(0); }
.notification.success { border-left: 4px solid var(--green); }
.notification.error { border-left: 4px solid var(--red); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .header-container { flex-wrap: wrap; padding: 0 var(--gutter); }
    .menu-toggle { display: inline-flex; }
    nav { width: 100%; display: none; }
    nav.open { display: block; }
    nav ul { flex-direction: column; padding-top: 14px; gap: 4px; align-items: stretch; }
    nav a { padding: 12px 16px; }

    .hero h1 { font-size: 2.1rem; }
    .hero p { font-size: 1rem; }

    .section-title h2 { font-size: 1.7rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .footer-content { grid-template-columns: 1fr; gap: 24px; text-align: left; }
    .footer-bottom { margin-top: 28px; }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.5s cubic-bezier(0.2, 0.6, 0.2, 1) forwards; }

.section { animation: fadeIn 0.6s cubic-bezier(0.2, 0.6, 0.2, 1) backwards; }
.section:nth-of-type(1) { animation-delay: 0.05s; }
.section:nth-of-type(2) { animation-delay: 0.12s; }
.section:nth-of-type(3) { animation-delay: 0.18s; }

/* === UTILITIES === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.mt-20 { margin-top: 24px; }
.mb-20 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* === BADGE BIO === */
.badge-bio {
    display: inline-block;
    background: var(--green);
    color: var(--white);
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 0.7em;
    font-weight: 800;
    text-decoration: none;
    margin-left: 8px;
    vertical-align: middle;
    white-space: nowrap;
    box-shadow: 0 2px 8px var(--green-glow);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-bio:hover { background: var(--green-dark); transform: translateY(-1px); }

/* === Score badge (en bonus, prêt à l'emploi pour évolution AB/Yuka style) === */
.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--green);
    color: var(--white);
    font-weight: 900;
    font-size: 0.85rem;
}
.score-badge.b { background: var(--yellow); color: var(--ink); }
.score-badge.c { background: var(--orange); color: var(--white); }
.score-badge.d { background: var(--red); color: var(--white); }

/* === Marqueurs carte producteurs (emoji dédié) === */
.leaflet-marker-icon.emoji-marker {
    background: transparent;
    border: none;
}
.emoji-marker .emoji-marker-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--white);
    border: 2px solid var(--green);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.emoji-marker .emoji-marker-glyph {
    display: block;
    font-size: 1.4rem;
    line-height: 1;
    transform: rotate(45deg); /* remet l'emoji droit dans la pastille pivotée */
}
.emoji-marker:hover { z-index: 1000 !important; }

/* Marqueur AMAP : logo mis en avant (pastille ronde + pointe) */
.leaflet-marker-icon.amap-logo-marker { background: transparent; border: none; }
.amap-logo-pin {
    position: relative;
    width: 60px;
    height: 60px;
}
.amap-logo-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--white);
    border: 3px solid var(--green);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    overflow: hidden; /* clippe le carré blanc du logo dans le cercle */
}
.amap-logo-circle img { width: 70%; height: 70%; object-fit: contain; }
.amap-logo-pin::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--green);
}
.amap-logo-marker { z-index: 1100 !important; } /* toujours au-dessus des producteurs */

/* === FOCUS === */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
    outline: 3px solid var(--green);
    outline-offset: 3px;
}

/* === FORM INPUTS dans cards (search producteurs) === */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--r-pill);
    border: 2px solid var(--line);
    transition: border-color 0.2s ease;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--green);
}
input[type="checkbox"] { accent-color: var(--green); }
