/* ==========================================================================
   CamargueFun - main.css
   Version : "fusion parfaite"
   Objectifs :
   - Conserver le rendu HOME (index) que tu veux
   - Corriger le "décalage" horizontal sur desktop (scrollbar stable)
   - Garder le select "Ville" parfaitement aligné au design (pill-like)
   - Récupérer l'avatar/menu connecté COMPLET (badge + menu header/list)
   ========================================================================== */

/* ===================== */
/* 1. RESET & BASE       */
/* ===================== */

*,
*::before,
*::after { box-sizing: border-box; }

html {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #101827;
    background-color: #f5f5f8;

    /* Empêche le "décalage" horizontal sur desktop quand la scrollbar apparaît/disparaît */
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;

    /* Fallback anciens navigateurs : réserve toujours la place de la scrollbar */
    overflow-y: scroll;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6,
p { margin: 0; }

a { color: #0b7285; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===================== */
/* 2. LAYOUT GLOBAL      */
/* ===================== */

#main-content {
    flex: 1 0 auto;
    padding-bottom: 80px; /* espace pour la bottom-nav fixe */
}

/* ===================== */
/* 3. TOPBAR / HEADER    */
/* ===================== */

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

/* --- topbar principale --- */
.topbar { padding: 8px 0; }

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar-logo {
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0b7285;
    font-size: 1.05rem;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.topbar-link {
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    color: #374151;
    font-weight: 500;
}

.topbar-link-active {
    border-bottom-color: #0b7285;
    color: #0b7285;
}

.topbar-link:hover {
    text-decoration: none;
    border-bottom-color: #0b7285;
}

/* Responsive : on allège un peu le menu sur petits écrans */
@media (max-width: 640px) {
    .topbar-inner { flex-wrap: wrap; }
}

/* --- barre de langue --- */
.langbar {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    background-color: #f8fafc;
}

.langbar-inner {
    display: flex;
    gap: 8px;
    padding: 6px 16px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}

.langbar-inner::-webkit-scrollbar { display: none; }

.lang-pill {
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.8rem;
    background-color: #ffffff;
    color: #4b5563;
    white-space: nowrap;
    cursor: pointer;
}

.lang-pill-active {
    background-color: #0b7285;
    color: #ffffff;
    border-color: #0b7285;
}

/* --- ruban de catégories --- */
.categorybar {
    background-color: #ffffff;
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.categorybar-inner {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.categorybar-inner::-webkit-scrollbar { display: none; }

.category-pill {
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.85rem;
    background-color: #f3f4f6;
    color: #374151;
    white-space: nowrap;
}

.category-pill-active {
    background-color: #0b7285;
    color: #ffffff;
}

/* ===================== */
/* 4. HERO               */
/* ===================== */

.hero {
    padding: 16px 0 8px;
    background: linear-gradient(135deg, #e3fafc 0%, #f8fafc 50%, #ffffff 100%);
}

.hero-inner {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 16px;
    align-items: center;
}

.hero-text { display: flex; flex-direction: column; gap: 10px; }

.hero-title {
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.03em;
}

.hero-title-accent {
    font-size: 0.9em;
    color: #0b7285;
    font-weight: 700;
}

.hero-subtitle {
    color: #4b5563;
    font-size: 0.95rem;
    max-width: 520px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.hero-image {
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

@media (max-width: 768px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-image { order: -1; } /* l'image passe au-dessus du texte sur mobile */
}

/* ===================== */
/* 5. BOUTONS            */
/* ===================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
    background-color: #0b7285;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(11, 114, 133, 0.35);
}

.btn-primary:hover {
    background-color: #095d6b;
    box-shadow: 0 8px 18px rgba(11, 114, 133, 0.35);
    text-decoration: none;
}

.btn-secondary {
    background-color: #ffffff;
    color: #0b7285;
    border-color: #0b7285;
}

.btn-secondary:hover {
    background-color: #e3fafc;
    text-decoration: none;
}

/* ===================== */
/* 6. SECTIONS GÉNÉRIQUES*/
/* ===================== */

.section { padding: 18px 0; }
.section-header { margin-bottom: 8px; }

.section-header-with-link {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.section-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #111827;
}

.section-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: #0b7285;
}

/* ===================== */
/* 7. GRILLE DE CARTES   */
/* ===================== */

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

@media (min-width: 680px) {
    .cards-activites,
    .cards-restaurants,
    .cards-hebergements,
    .cards-artisans,
    .cards-associations {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.card {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

/* ===================== */
/* 8. CARTES ÉVÈNEMENTS  */
/* ===================== */

.card-event {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: flex-start;
}

.card-event-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 120px;
}

.card-event-dateblock {
    background-color: #0b7285;
    color: #ffffff;
    border-radius: 12px;
    padding: 6px 8px;
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 600;
}

.card-event-date { display: block; }

.card-event-time {
    display: block;
    font-size: 0.78rem;
    opacity: 0.9;
}

.card-event-tag {
    font-size: 0.78rem;
    font-weight: 500;
    color: #0b7285;
    background-color: #e3fafc;
    border-radius: 999px;
    padding: 4px 8px;
}

.card-event-right { display: flex; flex-direction: column; gap: 4px; }

.card-event-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #111827;
}

.card-event-text {
    font-size: 0.88rem;
    color: #4b5563;
}

.card-event-location {
    font-size: 0.86rem;
    color: #6b7280;
}

/* ===================== */
/* 14. FOOTER & BOTTOM NAV
/* ===================== */

.site-footer {
    flex-shrink: 0;
    background-color: #f8fafc;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
    padding-bottom: 56px; /* espace pour la bottom-nav */
}

.footer-inner {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-nav a { font-size: 0.82rem; color: #4b5563; }
.footer-nav a:hover { color: #0b7285; }

.footer-copy { font-size: 0.8rem; color: #9ca3af; }

@media (min-width: 768px) {
    .footer-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    background-color: #ffffff;
    border-top: 1px solid rgba(148, 163, 184, 0.4);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 40;
}

.bottom-nav-item {
    flex: 1;
    text-align: center;
    font-size: 0.78rem;
    color: #6b7280;
    padding-top: 4px;
}

.bottom-nav-item-active {
    color: #0b7285;
    font-weight: 600;
}

.bottom-nav-label { display: block; }

/* ===================== */
/* 15. UTILITAIRES       */
/* ===================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===================== */
/* 16. AVATAR / COMPTE   */
/*  -> version "préférée" (complète) + compatible JS existant
/* ===================== */

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar-button {
    border: none;
    background: transparent;
    padding: 4px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.avatar-button:hover {
    background-color: rgba(148, 163, 184, 0.18);
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4);
}

.avatar-svg {
    width: 26px;
    height: 26px;
    stroke: #0b7285;
    fill: none;
    stroke-width: 1.8;
}

/* Pastille (notifications / compteur) */
.avatar-badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    background-color: #0b7285;
    color: #ffffff;
    border-radius: 999px;
    min-width: 16px;
    height: 16px;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.user-avatar-wrapper { position: relative; }

.user-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 200px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 8px 0;
    z-index: 100;
}

.user-menu-header {
    padding: 8px 12px 6px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.user-menu-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #111827;
}

.user-menu-email {
    font-size: 0.8rem;
    color: #6b7280;
}

.user-menu-list {
    list-style: none;
    margin: 0;
    padding: 4px 0 4px;
}

.user-menu-list li a {
    display: block;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: #374151;
}

.user-menu-list li a:hover {
    background-color: #f3f4f6;
    text-decoration: none;
}

.user-menu-separator {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    margin-top: 4px;
    padding-top: 4px;
}

.user-menu-backoffice a {
    font-weight: 600;
    color: #0b7285;
}

/* ========================================================================== */
/* 17. ÉVÈNEMENTS À VENIR — RAIL HORIZONTAL (HOME)                             */
/* ========================================================================== */

.section-header-inline {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.section-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.section-see-all {
    font-size: 0.85rem;
    font-weight: 600;
    color: #0b7285;
    text-decoration: none;
    white-space: nowrap;
}
.section-see-all:hover { text-decoration: underline; }

.events-arrow {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background-color: #ffffff;
    color: #0b7285;
    font-size: 1.3rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.events-arrow:hover {
    background-color: #e3fafc;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
    transform: translateY(-1px);
}

.events-rail-wrapper { padding: 6px 0 4px; }

.events-rail {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 16px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.events-rail::-webkit-scrollbar { display: none; }

.event-card {
    flex: 0 0 260px;
    scroll-snap-align: start;
    background-color: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.event-card-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    color: inherit;
    text-decoration: none;
}
.event-card-link:hover { text-decoration: none; }

.event-card-date {
    display: inline-flex;
    align-self: flex-start;
    background-color: #0b7285;
    color: #ffffff;
    border-radius: 12px;
    padding: 6px 8px;
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
}

.event-card-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: #111827;
}

.event-card-city,
.event-card-price {
    font-size: 0.88rem;
    color: #4b5563;
}

@media (min-width: 768px) {
    .events-rail { padding-left: 0; padding-right: 0; }
}

/* ========================================================================== */
/* 18. PAGE AGENDA (/evenements.php) — FILTRES & PAGINATION                   */
/* ========================================================================== */

.events-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 12px;
}

.events-filter-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background-color: #ffffff;
    color: #374151;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.events-filter-pill:hover {
    background-color: #e3fafc;
    border-color: rgba(11, 114, 133, 0.55);
    text-decoration: none;
    transform: translateY(-1px);
}

.events-filter-pill-active {
    background-color: #0b7285;
    color: #ffffff;
    border-color: #0b7285;
}

.events-filter-pill-free::before {
    content: "✓ ";
    font-weight: 800;
}

.events-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.events-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background-color: #ffffff;
    color: #0b7285;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
}

.events-pagination a:hover {
    background-color: #e3fafc;
    text-decoration: none;
}

.events-pagination .events-page-info {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 600;
}

/* --- Searchbar (date à date) --- */

.events-searchbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 12px;
}

.events-field { display: inline-flex; align-items: center; gap: 6px; }

.events-input,
.events-select {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background-color: #ffffff;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.9rem;
    min-height: 36px;
    color: #111827;
    outline: none;
}

/* Select : "pill-like" + flèche custom */
.events-select {
    cursor: pointer;
    line-height: 1.2;
    padding: 8px 38px 8px 12px; /* place pour la flèche */
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(55, 65, 81, 0.9) 50%),
        linear-gradient(135deg, rgba(55, 65, 81, 0.9) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.events-select:hover { border-color: rgba(11, 114, 133, 0.55); }

.events-input:focus,
.events-select:focus {
    border-color: rgba(11, 114, 133, 0.75);
    box-shadow: 0 0 0 3px rgba(11, 114, 133, 0.12);
}

.events-apply-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #0b7285;
    background-color: #0b7285;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}
.events-apply-btn:hover { background-color: #095d6b; }

.events-clear-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background-color: #ffffff;
    color: #374151;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
}
.events-clear-link:hover { background-color: #f3f4f6; text-decoration: none; }

/* --- Ville (select) --- */

.events-city-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.events-city-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #374151;
}

/* Ruban catégories agenda */
.events-categories {
    display: flex;
    gap: 8px;
    padding-top: 6px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}
.events-categories::-webkit-scrollbar { display: none; }
.events-categories .events-filter-pill { flex: 0 0 auto; }
