/* === Polices personnalisées === */
@font-face {
  font-family: "Globet";
  src: url("../assets/fonts/Globet-Regular-FFP.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Globet";
  src: url("../assets/fonts/Globet-Bold-FFP.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roundex";
  src: url("../assets/fonts/Roundex.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Variables globales (couleurs + polices) */
:root {
  /* PALETTE VIOLET/NOIR - Style Revolut */
  --color-violet-main: #7F56D9;   /* Violet plus vibrant */
  --color-violet-accent: #5b21b6; /* Violet profond */
  --color-glow-light: rgba(224, 176, 255, 0.6); 
  
  --c1: var(--color-violet-main);
  --c2: var(--color-violet-accent);
  --c3: #F4F5F7; /* Fond clair légèrement grisé */
  --c4: var(--color-violet-main);
  --c5: var(--color-violet-accent);

  --text: #111827;
  --text-invert: #ffffff;
  --bg: var(--c3);
  --surface: #ffffff;
  --border-light: rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

  --font-heading: "Globet", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-body: "Roundex", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* --- SURCHARGE MODE SOMBRE (Le Look "Revolut") --- */
:root[data-theme="dark"] {
  --bg: #0F0F13;           /* Noir profond presque bleu nuit */
  --surface: rgba(255, 255, 255, 0.03); /* Surface vitrée très transparente */
  --text: #F3F4F6;
  --text-invert: #FFFFFF;
  
  /* Lueur et Bordures Glassmorphism */
  --border-light: rgba(255, 255, 255, 0.12);
  --shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body.theme {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  /* Transition douce pour le changement de thème */
  transition: background 0.3s ease, color 0.3s ease;
  background-image: none;
}

/* En mode sombre, on ajoute le spot lumineux en haut (le "Glow") */
:root[data-theme="dark"] body.theme {
  background-image: radial-gradient(circle at 50% -20%, #4c1d95 0%, #0F0F13 60%);
  background-attachment: fixed;
}

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

/* Titres / navigation / boutons en Globet */
h1, h2, h3, h4, h5, h6,
.banner__title,
.brand__title,
.btn,
.nav a,
.quick-actions .card h3 {
  font-family: var(--font-heading);
}
p, input, select, textarea, .card p, label, .footer { font-family: var(--font-body); }

/* Header / Nav */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem;
  position: sticky; top: 0; z-index: 100;
  
  /* Effet Verre */
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

/* Header en mode sombre */
:root[data-theme="dark"] .app-header {
  background: rgba(15, 15, 19, 0.6); /* Plus sombre et transparent */
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-header--compact{padding:.5rem .75rem}
.brand{display:flex; align-items:center; gap:.5rem}
.brand__icon{width:32px; height:32px}
.brand__title{font-weight:700}

/* Burger */
.hamburger{
  display:inline-flex; flex-direction:column; gap:4px;
  background:none; border:0; cursor:pointer;
}
.hamburger span{
  display:block; width:22px; height:2px; background:var(--text);
  transition: transform .3s ease, opacity .2s ease;
}
/* Burger → croix quand menu ouvert */
.hamburger.is-open span:nth-child(1){ transform: rotate(45deg) translateY(7px); }
.hamburger.is-open span:nth-child(2){ opacity: 0; }
.hamburger.is-open span:nth-child(3){ transform: rotate(-45deg) translateY(-7px); }

/* Nav par défaut */
.nav{display:none; gap:1rem; align-items:center}
.nav a { 
  padding: 0.25rem 0.75rem; 
  border-radius: 99px; /* Pill shape */
  font-size: 0.95rem;
  transition: all 0.2s;
}
.nav a:hover { background: rgba(127, 86, 217, 0.1); }
.nav a.active { 
  background: var(--c1); 
  color: var(--text-invert); 
  box-shadow: 0 2px 8px rgba(127, 86, 217, 0.4);
}

.btn{
  background:var(--c1); color:#fff; border:0; padding:.5rem .75rem; border-radius:.6rem; cursor:pointer; box-shadow:var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(127, 86, 217, 0.4); }

.btn--ghost{background:transparent; color:var(--text); border:1px solid var(--border-light); box-shadow: none;}
.btn--ghost:hover{ border-color: var(--c1); background: rgba(127, 86, 217, 0.05); }

.btn--warn{background:var(--c4)}
.btn--danger{background:#b3261e}

.input,.select,textarea{
  width:100%; padding:.6rem .7rem; 
  border:1px solid var(--border-light); 
  border-radius:.6rem; 
  background:var(--surface); 
  color:var(--text);
}

/* Desktop : nav visible */
@media(min-width:768px){
  .hamburger{display:none}
  .nav{display:flex}
}

/* --- OFF-CANVAS NAV MOBILE --- */
@media (max-width: 767px){
  .nav.nav--open{
    display:flex;
    flex-direction:column;
    position:fixed;
    top:0; right:0;
    height:100dvh;
    width:80vw; max-width:320px;
    background:var(--surface);
    /* Glassmorphism mobile menu */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -12px 0 40px rgba(0,0,0,.25);
    padding:1rem;
    gap:.5rem;
    z-index:12000;
    border-left: 1px solid var(--border-light);
  }
  body[data-nav-open="true"]{
    overflow:hidden;
    touch-action:none;
  }
  body[data-nav-open="true"] .filter-bar{ display: none !important; }
}

/* Banner */
.banner {
  /* Mode clair : dégradé simple */
  background: linear-gradient(135deg, #f3e8ff 0%, #ffffff 100%);
  color: var(--text);
  padding: 3rem 1rem 4rem;
  text-align: center;
  position: relative;
  border-bottom-left-radius: 2rem;
  border-bottom-right-radius: 2rem;
  transition: background 0.3s ease;
}
.banner--page { padding: 1.5rem 1rem; background: var(--c2); color: #fff; border-radius: 0; }

/* Banner en mode sombre : Transparent pour laisser voir le gradient du body */
:root[data-theme="dark"] .banner {
  background: transparent;
  color: var(--text);
}

.banner__logo{width:64px; height:64px; filter:drop-shadow(0 3px 8px rgba(0,0,0,.25))}
.banner__title{margin:.25rem 0 0; font-size: 2rem; background: -webkit-linear-gradient(45deg, var(--text), var(--c1)); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
.banner__subtitle{opacity:.8; margin-bottom: 1rem;}

/* Quick actions */
.quick-actions{
  display:grid; gap:1.5rem; grid-template-columns:1fr; 
  margin:1.5rem auto 0; max-width:960px;
}

/* --- CARTES D'ACCUEIL (Glassmorphism) --- */
.quick-actions .card{
  display:flex; flex-direction:column; justify-content:center; align-items:center;
  background: var(--surface);
  border-radius: 1.5rem; 
  padding: 2rem 1.5rem; text-align:center;
  cursor:pointer; min-height:140px;
  color: var(--text);
  
  /* Glassmorphism Base */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.quick-actions .card h3{margin:0 0 .5rem; font-size:1.3rem; font-weight:600}
.quick-actions .card p{margin:0; font-size:.9rem; opacity:.7}

/* Hover en mode clair */
:root[data-theme="light"] .quick-actions .card:hover{
  transform:translateY(-5px);
  border-color: var(--c1);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* SPÉCIFIQUE MODE SOMBRE (Le Look Revolut) */
:root[data-theme="dark"] .quick-actions .card {
  background: rgba(255, 255, 255, 0.03); /* Très transparent */
  border: 1px solid rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .quick-actions .card:hover {
  transform: translateY(-5px) scale(1.02);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-violet-main);
  /* Glow effect */
  box-shadow: 
    0 0 20px rgba(127, 86, 217, 0.3), 
    inset 0 0 20px rgba(127, 86, 217, 0.1);
}
:root[data-theme="dark"] .quick-actions .card h3 {
  color: #fff;
  text-shadow: 0 0 10px rgba(127, 86, 217, 0.6);
}

@media(min-width:640px){ .quick-actions{grid-template-columns:repeat(3,1fr)} }

/* Layouts */
.container{max-width:1100px; margin:2rem auto; padding:0 1rem}
.grid{display:grid; gap:1rem; grid-template-columns:1fr}
@media(min-width:768px){ .grid{grid-template-columns:repeat(3,1fr)} }
.toolbar{display:flex; gap:.5rem; flex-wrap:wrap; margin-bottom:1rem}

/* Modules (Glassmorphism) */
.modules-grid .module{
  background:var(--surface); 
  padding:2rem; 
  border-radius:1.5rem; 
  box-shadow:var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
}

/* Map */
.map-layout{position:relative; height:calc(100dvh - 56px)}
.map{position:absolute; inset:0}

/* Barre de recherche (Glassmorphism) */
.search-bar{
  position:absolute; top:.75rem; left:.75rem; right:.75rem;
  max-width: 400px;
  z-index:2001;
}

.search-bar input{
  width:100%; padding:.8rem 1rem;
  border:1px solid var(--border-light); border-radius:1rem;
  background:var(--surface); color:var(--text);
  font-family:var(--font-body);
  box-shadow:var(--shadow);
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

/* Barre de filtres flottante (Glassmorphism) */
.filter-bar{
  position:absolute; top:.75rem; right:.75rem;
  background:var(--surface); 
  border-radius:1rem; 
  box-shadow:var(--shadow);
  padding:.5rem; display:flex; gap:.5rem; flex-wrap:wrap;
  z-index:2000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
}

/* Panneau de filtres avancés (Glassmorphism) */
.advanced-filters{
  position:absolute; top:4.5rem; right:.75rem;
  background:var(--surface); 
  border-radius:1rem; 
  box-shadow:var(--shadow);
  padding:1rem;
  z-index:2000;
  width:280px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
}

/* Styles spécifiques en mode sombre pour les contrôles de la carte */
:root[data-theme="dark"] .filter-bar,
:root[data-theme="dark"] .advanced-filters {
  background: rgba(15, 15, 19, 0.8); 
  border: 1px solid var(--color-glow-light);
}

/* --- Bottom Sheet au-dessus de la carte (Glassmorphism) --- */
.bottom-sheet{
  position: fixed;
  left: 0; right: 0; bottom: -65%;
  background: var(--surface);
  border-radius: 1.5rem 1.5rem 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,.25);
  padding: 1.5rem;
  transition: bottom .25s ease, height .25s ease;
  z-index: 9999; 
  max-height: 60%;
  overflow: auto;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-light);
}
.bottom-sheet[aria-hidden="false"]{ bottom: 0; }
.bottom-sheet__close{
  position:absolute; right:.5rem; top:.5rem;
  background:transparent; border:0; font-size:1.5rem; cursor:pointer; color:var(--text)
}
:root[data-theme="dark"] .bottom-sheet{ border-top: 1px solid var(--color-glow-light); }

/* --- Styles pour la fiche spot enrichie --- */
.spot-card{ font-family: var(--font-body); }
.spot-title{ margin: 0 0 .75rem 0; font-family: var(--font-heading); font-size: 1.5rem; color: var(--c1); }

.spot-info-grid{
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
  margin-bottom: .75rem; padding: .75rem;
  background: rgba(0,0,0,0.03); border-radius: .6rem;
}
:root[data-theme="dark"] .spot-info-grid { background: rgba(255,255,255,0.05); }

@media(max-width: 480px){ .spot-info-grid{ grid-template-columns: 1fr; } }

.spot-info-item{ font-size: .9rem; line-height: 1.5; }
.spot-info-item strong{ color: var(--c2); font-weight: 600; }
.spot-description{ margin: .75rem 0; line-height: 1.6; color: var(--text); }

.spot-info-extra{
  margin: .5rem 0; padding: .5rem;
  background: rgba(0,0,0,0.03); border-radius: .4rem;
  font-size: .9rem; font-style: italic; opacity: .9;
}

.spot-actions{ display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.spot-actions .btn{ flex: 1; min-width: 120px; text-align: center; }

/* --- Styles pour le formulaire d'édition --- */
.spot-edit-form{ padding: 0.5rem; }
.spot-edit-form .form-group{ margin-bottom: 1rem; }
.spot-edit-form label{ display: block; margin-bottom: .5rem; font-weight: 600; color: var(--text); font-size: .9rem; }

.spot-edit-form input[type="text"],
.spot-edit-form select{
  width: 100%; padding: .75rem;
  border: 1px solid var(--border-light); border-radius: .5rem;
  font-size: 1rem; font-family: var(--font-body);
  background: var(--surface); color: var(--text);
  transition: border-color .2s ease;
}
.spot-edit-form input[type="text"]:focus,
.spot-edit-form select:focus{
  outline: none; border-color: var(--c1);
  box-shadow: 0 0 0 3px rgba(127, 86, 217, 0.2);
}

/* --- Style pour le bouton primaire --- */
.btn--primary{ background: var(--c1); color: var(--text-invert); font-weight: 600; }
.btn--primary:hover{ background: var(--color-violet-accent); }

/* --- Backdrop + blocage du scroll quand la fiche est ouverte --- */
body.sheet-open { overflow: hidden; }
body.sheet-open::after{
  content:""; position:fixed; inset:0;
  background: rgba(0,0,0,.35); z-index: 9998;
}

/* --- Mobile portrait --- */
@media (max-width: 767px) and (orientation: portrait){
  .bottom-sheet{
    bottom: -100%; max-height: none; height: auto;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .bottom-sheet[aria-hidden="false"]{ bottom: 0; height: 92dvh; }
  .bottom-sheet__content{ max-height: calc(92dvh - 52px); overflow: auto; }
}

#map, .leaflet-container { z-index: 0; }

/* Footer */
.app-footer{padding:1rem; text-align:center; color:#5c6a77; opacity: 0.6;}
.app-footer--hidden-mobile{display:none}
@media(min-width:768px){ .app-footer--hidden-mobile{display:block} }

/* Modal (Glassmorphism) */
.modal{border:0; border-radius:1rem; padding:0; width:min(640px, 92%); background:transparent}
.modal::backdrop{background:rgba(0,0,0,.7)}
.modal__content{
  background:var(--surface); 
  padding:1.5rem; 
  border-radius:1rem; 
  box-shadow:var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light); 
}
.modal__actions{display:flex; gap:.5rem; justify-content:flex-end; margin-top:.75rem}

/* Chips (tags) */
.chip{
  display:inline-block; padding:.15rem .5rem; border-radius:999px;
  background: rgba(0,0,0,0.05); color:inherit; font-size:.85rem; margin-right:.25rem
}
:root[data-theme="dark"] .chip { background: rgba(255,255,255,0.1); }

/* === Scoped: pages Paramètres / Login / Register === */
body.page-auth .auth-wrap,
body.page-auth #authGate,
body.page-auth #accountView,
body.page-auth .auth-panel,
body.page-auth form.page-auth-form {
  max-width: 480px; margin: 2rem auto;
  background: var(--surface);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  padding: 2rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
}
:root[data-theme="dark"] body.page-auth .auth-panel { border: 1px solid var(--color-glow-light); }

body.page-auth h1,
body.page-auth h2,
body.page-auth .auth-title { text-align: center; margin-bottom: 1rem; font-family: var(--font-heading); }

/* Champs uniquement dans les pages auth */
body.page-auth form input,
body.page-auth form select,
body.page-auth form textarea {
  width: 100%; padding: .8rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: .8rem;
  background: var(--surface); color: var(--text);
  font-family: var(--font-body);
}

body.page-auth form input:focus,
body.page-auth form select:focus,
body.page-auth form textarea:focus {
  outline: none; border-color: var(--c1);
  box-shadow: 0 0 0 3px rgba(127, 86, 217, 0.2);
}

body.page-auth form .btn { width: 100%; margin-top: 1rem; padding: 0.8rem; }
body.page-auth .alt-links { text-align: center; margin-top: 1.5rem; font-size: .9rem; opacity: 0.8; }
body.page-auth .alt-links a { color: var(--c1); }
body.page-auth .alt-links a:hover { text-decoration: underline; }

body.page-auth .muted { opacity: .7; }
body.page-auth .mt-8 { margin-top: .5rem; }
body.page-auth .mt-12 { margin-top: .75rem; }
body.page-auth .mt-16 { margin-top: 1rem; }
body.page-auth .gap-12 { gap: .75rem; }
body.page-auth .row { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; }

@media (max-width: 480px) {
  body.page-auth .auth-wrap,
  body.page-auth #authGate,
  body.page-auth #accountView,
  body.page-auth .auth-panel,
  body.page-auth form.page-auth-form { margin: 1rem; padding: 1.5rem; }
}