:root {
    --bg-color: #ffffff;
    --primary-color: #501282; /* Ton nouveau violet ! */
    --text-dark: #111827;
    --text-grey: #5b6472; /* AA sur blanc et sur gris clair (≥ 5:1) ; était #9ca3af (2,5:1) */
    --bg-grey: #f3f4f6;
    --badge-red-text: #b4443d; /* AA sur le fond gris du badge ; était #e17c76 (2,6:1) */
    --badge-red-dot: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cabin', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    padding: 20px 20px 20px 20px;
}

/* =========================================
   LANDING PAGE (index.html) - Design Aéré
   ========================================= */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px; 
}

/* Taille propre pour ton logo image */
.logo-img {
    height: 70px;
    width: auto;
    object-fit: contain;
}

.menu-btn {
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    background: none;
    border: none;
    padding: 8px;
}

.hero-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-grey);
    color: var(--badge-red-text);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 32px;
}

.badge .dot {
    width: 6px;
    height: 6px;
    background-color: var(--badge-red-dot);
    border-radius: 50%;
    margin-right: 8px;
}

h1 {
    font-size: 1.375rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
    font-weight: 800;
    margin-bottom: 24px;
}

/* Nouvelle classe pour le violet */
.text-primary {
    color: var(--primary-color);
}

.description {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 40px;
    font-weight: 400;
}

.perks {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

/* Ajout d'une très légère bordure pour faire ressortir les pilules comme sur ta maquette */
.perk-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-color); /* Fond blanc */
    border: 1px solid #e5e7eb; /* Bordure grise */
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.lucide {
    width: 1.2em;
    height: 1.2em;
}

.cta-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 30px;
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 8px 16px -4px rgba(80, 18, 130, 0.3); /* Ombre violette */
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:hover {
    background-color: #3b0d61; /* Violet plus foncé au survol (au lieu du vert d'avant) */
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-dark);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: default;
    padding: 10px;
}

/* --- MOCKUP TÉLÉPHONE --- */

.app-mockup-container {
    width: 100%;
    display: flex;
    justify-content: center;
    position: relative;
    padding-bottom: 20px;
}

.phone-frame {
    width: 220px;
    max-width: 350px; 
    height: auto;
    background-color: #1c1c1e;
    padding: 12px; 
    border-radius: 55px; 
    position: relative;
    z-index: 2;
}

.phone-screen {
    width: 197px;
    height: auto;
    display: block;
    border-radius: 43px; 
    background-color: #fff;
}

.app-mockup-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px; 
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 85%);
    pointer-events: none;
    z-index: 3;
}

/* =========================================
   STYLES SPECIFIQUES A LA WEB APP (app.html)
   ========================================= */
.app-body {
    padding: 0;
    margin: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden; /* Empêche le scroll global sur la page map */
    background-color: #f0f0f0;
}

.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* =========================================
   CARTE INTERACTIVE LEAFLET
   ========================================= */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Reste derrière l'interface */
}

/* On cache les boutons de zoom par défaut sur mobile pour un rendu plus propre (type appli native) */
.leaflet-control-zoom {
    display: none !important;
}

/* Design de tes pins personnalisés sur la vraie carte */
.custom-pin {
    background: transparent;
    border: none;
}

.pin-marker {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    position: relative;
    cursor: pointer;
}

.pin-marker::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Couleurs selon les catégories */
.pin-clothes { background-color: var(--primary-color); }
.pin-food { background-color: #f59e0b; }
.pin-hygiene { background-color: #14b8a6; }
.pin-logement { background-color: #3b82f6; }
.pin-numerique { background-color: #8b5cf6; }
.pin-etude { background-color: #10b981; }
.pin-sociale { background-color: #ec4899; }
.pin-multiservice { background-color: #14b8a6; }

/* Assurer que l'interface est au-dessus de la carte Leaflet */
.top-overlay, .bottom-nav, .modal-backdrop, .bottom-sheet {
    z-index: 1000;
}

/* Superposition du haut */
.top-overlay {
    position: relative;
    z-index: 10;
    padding: 20px 20px 20px 20px; /* Padding top large pour les encoches iPhone */
    background: linear-gradient(to bottom, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 100%);
}

.search-bar {
    display: flex;
    align-items: center;
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 16px;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 0 12px;
    font-family: 'Cabin', sans-serif;
}

.search-bar input::placeholder {
    color: var(--text-grey);
}

.icon-grey {
    color: var(--text-grey);
}

.divider {
    width: 1px;
    height: 24px;
    background-color: #e5e7eb;
    margin: 0 12px;
}

/* Filtres (Scroll horizontal) */
.filters-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px; /* Espace pour l'ombre éventuelle */
    /* Cache la barre de défilement sur Chrome/Safari */
    scrollbar-width: none; 
}
.filters-container::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #f3f4f6;
    cursor: pointer;
}

.filter-pill.active {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.filter-pill.icon-only {
    padding: 10px;
}

/* Navigation du bas adaptée aux écrans avec encoche/barre iOS */
.bottom-nav {
    position: fixed; /* <--- C'est le seul mot à changer ! */
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 16px 10px calc(16px + env(safe-area-inset-bottom)) 10px;
    border-top: 1px solid #f3f4f6;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-grey);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.nav-item i {
    width: 24px;
    height: 24px;
}

.nav-item.active {
    color: var(--primary-color);
}

/* Couleurs des catégories sur la carte */
.food-pin { background-color: #f59e0b; } /* Orange pour nourriture */
.clothes-pin { background-color: var(--primary-color); } /* Vert pour vêtements */
.misc-pin { background-color: #3b82f6; } /* Bleu pour divers */

/* =========================================
   BOTTOM SHEET (Modale)
   ========================================= */

.modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.bottom-sheet {
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    background-color: white;
    border-radius: 24px 24px 0 0;
    padding: 20px 24px 34px 24px;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.1, 0.8, 0.2, 1), visibility 0.3s; /* Animation fluide type iOS */
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px; height: 5px;
    background-color: #e5e7eb;
    border-radius: 10px;
    margin: 0 auto 20px auto;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sheet-category {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
    background-color: #e8dcfc;
    padding: 6px 12px;
    border-radius: 8px;
}

.sheet-category i { width: 16px; height: 16px; }

.close-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px; height: 32px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    color: var(--text-dark);
}

.sheet-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.sheet-info-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    background-color: var(--bg-grey);
    padding: 16px;
    border-radius: 16px;
}

.info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.95rem;
}

.info-row i { width: 20px; height: 20px; flex-shrink: 0; }
.font-bold { font-weight: 700; }

.sheet-desc-container h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.sheet-desc-container p {
    color: var(--text-grey);
    line-height: 1.5;
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-secondary-outline {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: transparent;
    color: var(--text-dark);
    border: 2px solid #e5e7eb;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    width: 100%;
}

/* =========================================
   PAGE AMIS (amis.html)
   ========================================= */

/* Fond blanc pur pour cette page */
.white-bg {
    background-color: #ffffff;
}

.page-header {
    padding: 20px 20px 20px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.friends-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px;
    /* On ajoute un gros padding en bas pour que le dernier ami remonte au-dessus du bouton flottant */
    padding-bottom: calc(160px + env(safe-area-inset-bottom)); 
    overflow-y: auto;
    height: 100%;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f3f4f6;
}

/* Conteneur de la photo de profil */
.avatar-wrapper {
    position: relative;
    width: 56px;
    height: 56px;
    margin-right: 16px;
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Pastille de statut */
.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff; /* Bordure blanche pour détacher la pastille de l'image */
}

.status-dot.online {
    background-color: #07AD41;
}

.status-dot.offline {
    background-color: #d1d5db; /* Gris clair */
}

/* Informations texte */
.friend-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.friend-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.friend-status {
    font-size: 0.9rem;
    color: var(--text-grey);
}

/* Conteneur du bouton Ajouter un ami */
.floating-action-container {
    position: fixed;
    bottom: calc(95px + env(safe-area-inset-bottom)); /* Exactement le même calcul */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center; /* Centre le bouton horizontalement */
    padding: 0 20px;
    z-index: 900;
    pointer-events: none; /* Permet de cliquer à côté du bouton sans bloquer la liste */
}

/* On réactive le clic uniquement sur le bouton lui-même */
.floating-action-container .btn-primary {
    pointer-events: auto;
    width: 100%;
    min-width: 200px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* =========================================
   PAGE PROFIL (profil.html)
   ========================================= */

/* En-tête supérieur */
.profile-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 20px 20px; /* Padding pour iOS notch */
}

.profile-top-bar h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.top-bar-actions {
    display: flex;
    gap: 16px;
    color: var(--text-dark);
}

.top-bar-actions i {
    cursor: pointer;
    width: 28px;
    height: 28px;
}

/* Photo de profil et icônes d'action */
.profile-picture-section {
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Aligne les icônes vers le bas de l'image */
    gap: 20px;
    margin-top: 10px;
    margin-bottom: 30px;
}

.avatar-large-wrapper {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.avatar-large-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin-bottom: 10px; /* Remonte légèrement les icônes */
}

.icon-light {
    color: var(--text-grey); /* icônes upload/édition : contraste ≥ 3:1 (WCAG 1.4.11) */
    width: 24px;
    height: 24px;
}

/* Statistiques (Visites, Trouvailles, Points) */
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-num {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-grey);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Onglets (Album / Favoris) */
.profile-tabs {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 24px;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    opacity: 0.75; /* Un peu transparent quand inactif (contraste AA conservé) */
    transition: opacity 0.2s ease;
}

.tab.active {
    opacity: 1; /* Pleinement visible quand actif */
}

/* Grille de l'album */
.photo-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 colonnes comme sur Instagram */
    gap: 12px;
    padding: 0 24px;
    padding-bottom: 100px; /* Espace pour la barre de navigation */
}

.photo-item {
    aspect-ratio: 1 / 1; /* Garde la div parfaitement carrée */
    border-radius: 16px;
    background-color: var(--bg-grey);
}

.placeholder-img {
    background: repeating-conic-gradient(#f0f0f0 0% 25%, transparent 0% 50%) 50% / 20px 20px;
    opacity: 0.5;
}

/* =========================================
   PAGE RÉCOMPENSES (recompenses.html)
   ========================================= */

.header-with-icon {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-dark {
    color: var(--text-dark);
    width: 24px; height: 24px;
    cursor: pointer;
}

.rewards-scroll-container {
    padding: 0 24px 120px 24px;
    overflow-y: auto;
}

/* Jauge circulaire SVG */
.progress-section {
    display: flex;
    justify-content: center;
    margin: 30px 0 40px 0;
}

.progress-ring {
    transform: rotate(-90deg); /* Pour que la jauge commence en haut */
}

/* Le périmètre d'un cercle de rayon 70 est 2 * PI * 70 = 439.8 */
/* On utilise stroke-dasharray pour créer des pointillés, et dashoffset pour cacher une partie */
.progress-ring-fill {
    stroke-dasharray: 439.8;
    /* Plus le chiffre ci-dessous est grand, moins la jauge est remplie. 
       Ici on la remplit à environ 70% (439.8 * 0.3) */
    stroke-dashoffset: 130; 
    stroke-linecap: round; /* Bouts arrondis */
    transition: stroke-dashoffset 1s ease-out; /* Animation au chargement */
}

/* Accordéons */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.accordion-header {
    background-color: #c4c4c4; /* Gris de ton design */
    color: white;
    padding: 16px 20px;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.accordion-header:active {
    background-color: #a3a3a3;
}

/* Liste des lieux (Contenu de l'accordéon) */
.accordion-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
}

/* Liste dynamique des récompenses */
.rewards-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reward-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid #f3f4f6;
}

/* Image de la récompense (maintenant avec de vraies images) */
.reward-img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    flex-shrink: 0;
    object-fit: cover;
}

.reward-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.reward-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary-color);
}

.reward-address {
    font-style: italic;
    color: var(--text-grey);
    font-size: 0.85rem;
}

/* La description de l'offre (ex: 1 shot acheté = 1 offert) */
.reward-offer {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
    margin-top: 2px;
}

.reward-points {
    color: var(--badge-red-text); /* En corail pour ressortir */
    font-size: 0.9rem;
    font-weight: 800;
    margin-top: 4px;
}

.reward-img {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    flex-shrink: 0;
}

.reward-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.reward-address {
    font-style: italic;
    color: var(--text-grey);
    font-size: 0.95rem;
}

.reward-points {
    color: var(--text-grey);
    font-size: 0.95rem;
    font-weight: 600;
}

/* =========================================
   MODALE AJOUT D'AMIS (amis.html)
   ========================================= */

/* Adaptation de la barre de recherche pour la modale */
.modal-search {
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
    box-shadow: none; /* Retire l'ombre par rapport à celle de la carte */
}

.suggestions-title {
    color: var(--text-grey);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 30px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.suggestion-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%; /* Cercle parfait pour l'avatar */
    flex-shrink: 0;
    object-fit: cover;
}

.suggestion-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-left: 12px;
}

.suggestion-name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1rem;
}

.suggestion-sub {
    color: var(--text-grey);
    font-size: 0.85rem;
}

.btn-add-small {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-add-small:active {
    transform: scale(0.95);
}

/* Bouton pointillé (Inviter un contact) */
.btn-invite-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: transparent;
    border: 2px dashed #e5e7eb;
    color: var(--text-grey);
    padding: 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Ajustement de l'espace de défilement pour qu'aucun contenu ne soit caché par la nav-bar agrandie */
.friends-list-container {
    padding-bottom: calc(150px + env(safe-area-inset-bottom)); 
}

.photo-grid-container {
    padding-bottom: calc(120px + env(safe-area-inset-bottom)); 
}

.rewards-scroll-container {
    padding-bottom: calc(120px + env(safe-area-inset-bottom)); 
}

/* =========================================
   GESTION DES VUES (SINGLE PAGE APPLICATION)
   ========================================= */
.app-view {
    display: none; /* Caché par défaut */
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* La vue active est affichée */
.active-view {
    display: block;
    animation: fadeIn 0.2s ease-in-out; /* Petite transition fluide */
}

/* Cas particulier pour la carte pour éviter les bugs de Leaflet */
#view-map.active-view {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =========================================
   MODALE INFO RÉCOMPENSES (Centrée)
   ========================================= */

/* Structure de la modale au centre */
.center-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9); /* Effet de zoom au pop */
    width: 85%;
    max-width: 380px;
    background-color: white;
    border-radius: 24px;
    padding: 30px 24px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.1, 0.8, 0.2, 1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.center-modal.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.center-modal-title {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 30px;
    color: var(--text-dark);
}

/* La ligne du temps (Timeline) */
.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 30px;
}

/* La ligne pointillée verte qui passe derrière les icônes */
.timeline::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 19px; /* Centré par rapport à l'icône qui fait 40px (19px = 40/2 - 1px épaisseur) */
    width: 0;
    border-left: 2px dashed var(--primary-color);
    z-index: 1;
}

.timeline-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    z-index: 2; /* Pour que les icônes cachent la ligne pointillée en dessous */
}

/* Les ronds de couleur */
.timeline-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    color: white;
}

.timeline-icon svg {
    width: 20px;
    height: 20px;
}

.green-icon { background-color: var(--primary-color); }
.red-icon { background-color: var(--badge-red-text); } /* On réutilise ton corail ! */

.timeline-content h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.timeline-content p {
    font-size: 0.95rem;
    color: var(--text-grey);
    line-height: 1.4;
}

/* =========================================
   CAMÉRA ET BOUTON FLOTTANT (Map)
   ========================================= */

/* Bouton Caméra (Floating Action Button) */
.fab-camera {
    position: fixed; /* Fixé à l'écran, pas au conteneur */
    bottom: calc(95px + env(safe-area-inset-bottom)); /* S'adapte magiquement à tous les téléphones */
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color); /* (Ou primary-color si tu l'as passé en violet) */
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 900;
    transition: transform 0.2s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.fab-camera:active {
    transform: scale(0.9);
}

.fab-camera svg {
    width: 24px;
    height: 24px;
}

/* Overlay plein écran de la caméra */
.camera-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    z-index: 2000; /* Par-dessus tout, y compris la navigation */
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.camera-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* La balise vidéo qui diffuse la caméra */
#camera-stream {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Remplit l'écran sans déformer l'image */
}

/* Contrôles du haut (Croix et Switch) */
.camera-controls-top {
    position: absolute;
    top: max(40px, env(safe-area-inset-top)); /* S'adapte à l'encoche iPhone */
    left: 0;
    width: 100%;
    padding: 0 20px; /* Ajoute de l'espace sur les côtés */
    display: flex;
    justify-content: space-between; /* Écarte les deux boutons au maximum */
    align-items: center;
    z-index: 2001;
}

.icon-btn-camera {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

/* Zone du bouton de capture */
.camera-controls-bottom {
    position: absolute;
    bottom: max(40px, env(safe-area-inset-bottom));
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2001;
}

/* Design du bouton de capture type smartphone */
.capture-btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background-color: transparent;
    border: 4px solid white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    padding: 0;
}

.capture-btn-inner {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background-color: white;
    transition: transform 0.1s ease;
}

.capture-btn:active .capture-btn-inner {
    transform: scale(0.9);
}

/* =========================================
   COMPLÉMENT PAGE PROFIL (Album & Favoris)
   ========================================= */

/* Pour que les images respectent l'arrondi des carrés de l'album */
.photo-item {
    overflow: hidden;
}

/* Conteneur de la liste des favoris (même style que les récompenses) */
.favorites-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 24px 120px 24px;
    overflow-y: auto;
}

/* =========================================
   AFFICHAGE DYNAMIQUE DES POINTS (Récompenses)
   ========================================= */

/* Centrage parfait du texte dans la jauge */
.points-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.points-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1; /* Resserre l'espace avec 'pts' */
}

.points-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-grey);
    margin-top: 4px;
}

/* =========================================
   MODALE PROFIL AMI
   ========================================= */
.friend-profile-header {
    text-align: center;
    margin-bottom: 20px;
}

.friend-profile-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.friend-profile-avatar-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.friend-profile-avatar-wrapper img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.friend-profile-stats {
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 24px;
    margin-bottom: 24px;
}

.album-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color); /* Ton beau violet ! */
    margin-bottom: 16px;
    padding: 0 20px;
}

#friend-profile-sheet .photo-grid-container {
    padding: 0 20px 40px 20px;
}
/* ==========================================
   ACCESSIBILITÉ & ROBUSTESSE
   ========================================== */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.no-results {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 900;
    margin: 0;
    padding: 12px 18px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    color: var(--text-grey);
    font-family: 'Cabin', sans-serif;
    text-align: center;
}

.no-results[hidden] {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ==========================================
   DÉMOS LOCALES : bon, suggestion de lieu
   ========================================== */
.btn-use {
    margin-top: 8px;
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    background: var(--primary-color);
    color: white;
    font-family: 'Cabin', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-use:disabled {
    background: var(--bg-grey);
    color: var(--text-grey);
    cursor: not-allowed;
}

.voucher-partner { font-weight: 700; font-size: 1.1rem; text-align: center; margin: 12px 0 4px; }
.voucher-offer { text-align: center; margin: 0 0 16px; }
.voucher-code {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--primary-color);
    background: var(--bg-grey);
    border-radius: 12px;
    padding: 14px;
    margin: 0 0 12px;
}
.voucher-note { text-align: center; color: var(--text-grey); font-size: 0.85rem; margin: 0 0 20px; }

.fab-suggest {
    position: fixed;
    bottom: calc(169px + env(safe-area-inset-bottom));
    right: 26px;
    width: 48px;
    height: 48px;
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 900;
}

.suggest-form { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.suggest-form label { font-size: 0.85rem; font-weight: 600; margin-top: 6px; }
.suggest-form input,
.suggest-form select,
.suggest-form textarea {
    font-family: 'Cabin', sans-serif;
    font-size: 1rem;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
}
.suggest-status { min-height: 1.2em; margin: 6px 0; font-size: 0.9rem; color: var(--primary-color); }

/* ==========================================
   APPLICATION : colonne de la taille d'un mobile, sur PC comme sur mobile
   ========================================== */
@media (min-width: 600px) {
    html:has(body.app-body) {
        background: #e5e7eb;
    }

    body.app-body {
        width: 430px;
        height: min(100vh, 932px);
        height: min(100dvh, 932px);
        margin: max(0px, calc((100vh - 932px) / 2)) auto;
        margin: max(0px, calc((100dvh - 932px) / 2)) auto;
        background-color: #ffffff;
        border-radius: 28px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
        /* Rend le body parent des éléments en position: fixed (barre de navigation, fenêtres, caméra) */
        transform: translateZ(0);
    }
}

/* ==========================================
   LANDING PAGE : responsive mobile / tablette / bureau
   ========================================== */
.landing-body {
    max-width: 1160px;
    margin: 0 auto;
    padding: 20px 24px 0 24px;
}

.logo-link { display: flex; }

.navbar { position: relative; }

.nav-links {
    display: none;
    flex-direction: column;
    gap: 4px;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 240px;
    padding: 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    z-index: 50;
}

.nav-links.open { display: flex; }

.nav-links a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    padding: 12px 14px;
    border-radius: 10px;
}

.nav-links a:hover { background: var(--bg-grey); }

.nav-links .nav-cta {
    background: var(--primary-color);
    color: white;
    text-align: center;
}

.nav-links .nav-cta:hover { background: #3d0e63; }

.hero-section { gap: 0; }
.hero-text { display: flex; flex-direction: column; align-items: flex-start; width: 100%; }

.features, .about { padding: 40px 0 8px 0; }

.features h2, .about h2 {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.feature-card {
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 20px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.feature-card .lucide {
    width: 28px;
    height: 28px;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.feature-card h3 { font-size: 1.1rem; margin-bottom: 6px; }
.feature-card p, .about p { color: var(--text-grey); line-height: 1.6; font-size: 0.95rem; }
.about p { max-width: 62ch; margin-bottom: 20px; }

.about-cta { display: inline-flex; width: auto; padding: 14px 24px; text-decoration: none; }

.site-footer {
    margin-top: 40px;
    padding: 24px 0 32px 0;
    border-top: 1px solid #e5e7eb;
    color: var(--text-grey);
    font-size: 0.85rem;
}

.site-footer a { color: inherit; }

@media (min-width: 600px) {
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
    .landing-body { padding: 28px 40px 0 40px; }

    .menu-btn { display: none; }

    .nav-links {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        position: static;
        min-width: 0;
        padding: 0;
        background: none;
        border: none;
        box-shadow: none;
    }

    .nav-links .nav-cta { padding: 12px 20px; }

    .hero-section {
        display: grid;
        grid-template-columns: 1.1fr 0.9fr;
        gap: 48px;
        align-items: center;
        padding-top: 32px;
    }

    .hero-text h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); margin-bottom: 28px; }
    .hero-text .badge { font-size: 0.875rem; }
    .hero-text .description { font-size: 1.1rem; max-width: 540px; }

    .hero-text .cta-group { flex-direction: row; width: auto; }
    .hero-text .cta-group .btn-primary { width: auto; padding: 18px 32px; font-size: 1rem; }

    .app-mockup-container { padding-bottom: 0; }
    .phone-frame { width: 300px; border-radius: 64px; padding: 14px; }
    .phone-screen { width: 272px; border-radius: 50px; }

    .features, .about { padding-top: 72px; }
    .features h2, .about h2 { font-size: 2rem; }
    .feature-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
}

/* ==========================================
   COMPOSANTS INTERACTIFS (boutons réels)
   ========================================== */
.toast {
    position: fixed;
    left: 50%;
    top: calc(16px + env(safe-area-inset-top));
    transform: translate(-50%, -20px);
    max-width: calc(100% - 40px);
    padding: 12px 18px;
    background: var(--text-dark);
    color: white;
    border-radius: 14px;
    font-size: 0.95rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 3000;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.search-filter-btn {
    position: relative;
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-grey);
}

.search-filter-btn.has-filters { color: var(--primary-color); }

.search-filter-btn.has-filters::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--badge-red-dot);
}

.fab-locate {
    position: fixed;
    bottom: calc(227px + env(safe-area-inset-bottom));
    right: 26px;
    width: 48px;
    height: 48px;
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 900;
}

.you-are-here { width: 16px; height: 16px; background: #2563eb; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25); }

.fav-btn {
    margin-left: auto;
    margin-right: 8px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-dark);
}

.fav-btn.active { color: var(--badge-red-dot); }
.fav-btn.active svg { fill: currentColor; }

.sheet-header { gap: 0; }

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 1rem;
    cursor: pointer;
}

.option-row input { width: 20px; height: 20px; accent-color: var(--primary-color); }

.sheet-buttons { display: flex; gap: 12px; margin-top: 20px; }
.sheet-buttons .btn-primary, .sheet-buttons .btn-secondary-outline { flex: 1; }

.btn-secondary-outline { cursor: pointer; font-family: 'Cabin', sans-serif; font-size: 0.875rem; }
.btn-danger { background: #dc2626; box-shadow: 0 8px 16px -4px rgba(220, 38, 38, 0.3); }

.top-bar-actions button,
.top-bar-actions a,
.header-actions button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
}

.top-bar-actions svg { width: 28px; height: 28px; }
.header-actions { display: flex; align-items: center; gap: 14px; }

.profile-name { text-align: center; font-size: 1.25rem; font-weight: 700; margin: 4px 0 12px 0; }

.favorite-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: white;
    border: 1px solid #f3f4f6;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    color: inherit;
    text-decoration: none;
}

.favorite-item .fav-info { flex: 1; min-width: 0; }
.favorite-item strong { display: block; }
.favorite-item small { color: var(--text-grey); }

.settings-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.settings-note { color: var(--text-grey); font-size: 0.9rem; line-height: 1.5; }

.voucher-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: 16px 0 20px 0; max-height: 40vh; overflow-y: auto; }
.voucher-list li { background: var(--bg-grey); border-radius: 12px; padding: 12px 14px; }
.voucher-list strong { display: block; }
.voucher-list code { color: var(--primary-color); font-weight: 800; letter-spacing: 2px; }
.voucher-empty { color: var(--text-grey); text-align: center; padding: 20px 0; }

.btn-add-small.added { background-color: #d1d5db; color: #374151; }

/* Pictogrammes de récompenses (remplacent les photos de partenaires) */
.reward-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.reward-icon .lucide { width: 36px; height: 36px; }
.reward-icon.cat-bar { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.reward-icon.cat-nuit { background: linear-gradient(135deg, #1e1b4b, #6d28d9); }
.reward-icon.cat-resto { background: linear-gradient(135deg, #c2410c, #fb923c); }
.reward-icon.cat-loisirs { background: linear-gradient(135deg, #0f766e, #2dd4bf); }
.reward-icon.cat-culture { background: linear-gradient(135deg, #1d4ed8, #60a5fa); }
.reward-icon.cat-sport { background: linear-gradient(135deg, #15803d, #4ade80); }

/* ==========================================
   LECTEURS D'ÉCRAN ET CLAVIER
   ========================================== */
/* Une fenêtre fermée n'est ni lue ni atteignable au clavier (la transition garde l'animation de fermeture) */
.bottom-sheet:not(.active),
.center-modal:not(.active),
.camera-overlay:not(.active) {
    visibility: hidden;
}

.bottom-sheet.active,
.center-modal.active,
.camera-overlay.active {
    visibility: visible;
}

.center-modal { transition: all 0.3s cubic-bezier(0.1, 0.8, 0.2, 1), visibility 0.3s; }
.camera-overlay { transition: opacity 0.3s ease, visibility 0.3s; }

.search-bar:focus-within {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

[role="dialog"]:focus { outline: none; }
