/* =========================
   est-il-sorti-du-coffre — Style final sombre & élégant
   ========================= */

/* Palette + tokens */
:root{
  --bg:        #0a0b0e;     /* fond global */
  --bg-elev:   #11131a;     /* cartes */
  --text:      #e7e9f2;     /* texte principal */
  --muted:     #9aa1b8;     /* texte secondaire */
  --border:    #1d2230;     /* bordures discrètes */
  --primary:   #6b8cff;     /* accent */
  --ok:        #19c28b;     /* bouton OUI */
  --ko:        #ff6b6b;     /* bouton NON */
  --shadow:    0 12px 40px rgba(0,0,0,.35);
  --radius:    16px;
  --radius-sm: 12px;
  --font:      system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root{
    --bg: #f7f8fa;
    --bg-elev: #ffffff;
    --text: #14151a;
    --muted: #555c70;
    --border: #e1e3eb;
    --shadow: 0 6px 24px rgba(0,0,0,.08);
  }
}

/* Reset */
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: 
    radial-gradient(800px 300px at 80% -10%, rgba(107,140,255,.08), transparent 60%),
    radial-gradient(700px 300px at -10% 0%, rgba(110,85,255,.07), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-bottom: max(env(safe-area-inset-bottom), 20px);
}

/* Container principal */
.container{
  width: min(900px, 92vw);
  margin-inline: auto;
  padding-inline: clamp(12px, 3vw, 22px);
}

/* Header collant */
.site-header{
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px) saturate(1.2);
  background: color-mix(in oklab, var(--bg), transparent 10%);
  border-bottom: 1px solid var(--border);
}
.site-header .container{
  padding-block: .75rem;
}
h1{
  font-weight: 800;
  letter-spacing: .2px;
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  text-align: center;
  margin: .5rem 0;
  color: var(--text);
}

/* Cartes */
.card{
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin: 1rem 0;
  animation: fade-in .4s ease both;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Grilles formulaire */
.grid{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
}

/* Inputs */
label{ display: grid; gap: .4rem; font-weight: 600; }
input{
  width: 100%;
  padding: .8rem .95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus{
  border-color: color-mix(in oklab, var(--primary), white 20%);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary), transparent 85%);
}

/* Boutons */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: transform .08s ease, opacity .15s, filter .15s;
  touch-action: manipulation;
  font-weight: 600;
}
.btn:active{
  transform: translateY(1px) scale(.98);
}
/* Bouton de connexion plus fin et élégant */
.btn.primary {
  background: linear-gradient(135deg, #4b6bff, #5866e9);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 1.1rem; /* réduit la taille */
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(80,100,255,0.25);
}

.btn.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(80,100,255,0.35);
}
#login-form {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}
#login-form label {
  flex: 1;
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(80,100,255,0.25);
}

.btn.yes{
  background: linear-gradient(180deg, var(--ok), color-mix(in oklab, var(--ok), black 15%));
  border: none;
  color: #002015;
}
.btn.no{
  background: linear-gradient(180deg, var(--ko), color-mix(in oklab, var(--ko), black 15%));
  border: none;
  color: #220000;
}
.btn[disabled],
.btn[aria-disabled="true"]{
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(60%);
}

/* Zone d'action OUI/NON */
.today .actions{
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: .6rem;
  justify-content: center;
}

/* Stats */
.stat h2{
  margin: 0 0 .3rem;
  font-size: clamp(1.1rem, 4vw, 1.6rem);
}
.stat .muted{
  margin: 0;
}

/* Historique */
.history summary{
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  user-select: none;
}
.history summary::-webkit-details-marker{ display: none; }
.history-list{
  list-style: none;
  margin: .75rem 0 0;
  padding: 0;
}
.history-list li{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .55rem 0;
  border-top: 1px dashed var(--border);
  gap: 1rem;
  font-size: .95rem;
}

/* Footer */
.site-footer{
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
  padding-top: 1rem;
  color: var(--muted);
  text-align: center;
}

/* Textes utilitaires */
.muted{ color: var(--muted); }
.small{ font-size: .9rem; }

/* Animation de halo doux sur l'état du jour */
.status-pulse{
  position: relative;
  text-align: center;
}
.status-pulse::after{
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--primary), transparent 80%);
  animation: pulse 2.5s ease-out infinite;
}
@keyframes pulse{
  0%   { box-shadow: 0 0 0 0 color-mix(in oklab, var(--primary), transparent 80%); }
  70%  { box-shadow: 0 0 0 12px color-mix(in oklab, var(--primary), transparent 100%); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--primary), transparent 100%); }
}

/* Safe area iOS */
@supports (padding: max(0px)) {
  .site-header .container{
    padding-top: max(.75rem, env(safe-area-inset-top));
  }
  .site-footer{
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

/* Accessibilité motion */
@media (prefers-reduced-motion: reduce){
  *{ animation:none!important; transition:none!important; }
}

/* Cache/affiche dynamique */
.hidden {
  display: none !important;
}

/* Confort tactile mobile */
button, .btn, input {
  min-height: 44px;
}

/* ====== Bar chart mensuel (mobile-first) ====== */
.chart{
  --h: 160px;               /* hauteur max des barres */
  --gap: 8px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
  align-items: end;
  height: var(--h);
  margin-top: .5rem;
  padding: .25rem .1rem 0;
  border-bottom: 1px solid var(--border);
}

.chart .bar{
  position: relative;
  height: 0;                /* sera défini en ligne par JS (en %) */
  background: linear-gradient(180deg, var(--primary), color-mix(in oklab, var(--primary), black 16%));
  border-radius: 9px 9px 0 0;
  border: 1px solid color-mix(in oklab, var(--primary), black 22%);
  transition: height .5s ease, filter .2s ease;
}
.chart .bar:hover{ filter: brightness(1.05); }

.chart .bar .val{
  position: absolute; left: 50%; bottom: calc(100% + 4px);
  transform: translateX(-50%);
  font-size: .78rem; color: var(--muted);
  opacity: .9;
}
.chart .label{
  margin-top: .35rem;
  text-align: center;
  font-size: .78rem;
  color: var(--muted);
  user-select: none;
}

/* Pile bar + label */
.chart-col{
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  min-width: 0; /* évite overflow */
}

/* Petites tailles d’écran */
@media (max-width: 420px){
  .chart{ --h: 140px; --gap: 6px; }
  .chart .label{ font-size: .72rem; }
  .chart .bar .val{ font-size: .72rem; }
}
/* Barre mise en avant (mois le plus actif) */
.chart .bar.highlight {
  outline: 2px solid var(--ok);
  box-shadow: 0 0 8px 2px color-mix(in oklab, var(--ok), transparent 60%);
  filter: brightness(1.15);
  position: relative;
}
/* Ajuste la flamme du meilleur mois */
/* chiffre par défaut, au-dessus de la barre */
.chart .bar .val{
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  font-size: .78rem;
  color: var(--muted);
  opacity: .95;
}

/* mise en avant + animation pour le meilleur mois */
.chart .bar.highlight .val{
  color: var(--ok);
  font-weight: 800;
  text-shadow: 0 0 0 color-mix(in oklab, var(--ok), transparent 70%);
  animation: pulseGlow 2.2s ease-in-out infinite;
}

/* anim' douce (respecte prefers-reduced-motion plus haut) */
@keyframes pulseGlow{
  0%   { transform: translateX(-50%) scale(1);    text-shadow: 0 0 0   color-mix(in oklab, var(--ok), transparent 70%); }
  50%  { transform: translateX(-50%) scale(1.15); text-shadow: 0 0 10px color-mix(in oklab, var(--ok), transparent 30%); }
  100% { transform: translateX(-50%) scale(1);    text-shadow: 0 0 0   color-mix(in oklab, var(--ok), transparent 70%); }
}
.chart .bar.highlight{
  outline: 2px solid var(--ok);
  box-shadow: 0 0 8px 2px color-mix(in oklab, var(--ok), transparent 60%);
  filter: brightness(1.15);
}


/* Met en valeur le texte "Mois le plus actif" */
#chart-legend {
  text-align: center;
  line-height: 1.4;
}
#chart-legend strong {
  display: inline-block;
  margin-top: .3rem;
  font-weight: 800;
  color: var(--ok);          /* vert de ton thème */
  text-shadow: 0 0 6px color-mix(in oklab, var(--ok), transparent 60%);
}

/* Bouton de connexion plus fin et élégant */
.btn.primary {
  background: linear-gradient(135deg, #4b6bff, #5866e9);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 1.1rem; /* réduit la taille */
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(80,100,255,0.25);
}

.btn.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(80,100,255,0.35);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(80,100,255,0.25);
}
/* Centre le titre de la carte de connexion */
#login-section h2,
#login-section h3,
#login-section h1 {
  text-align: center;
  width: 100%;
  margin-bottom: 1rem;
}
#login-section h3 {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: 0.3px;
}
/* Centre uniquement le titre "Connexion" */
#login-section h3 {
  text-align: center !important;
  display: block;
  width: 100%;
  margin: 0 auto 1rem auto;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: 0.3px;
}
/* Uniformise le style de la ligne "Mois le plus actif" */
#chart-legend strong {
  display: inline-block;
  margin-top: .3rem;
  font-weight: 800;
  color: var(--ok);
  text-shadow: 0 0 8px color-mix(in oklab, var(--ok), transparent 60%);
}

/* applique le même style à la valeur (ex: "Juin (3 sorties)") */
#chart-legend strong span {
  font-weight: 800;
  color: var(--ok);
  text-shadow: 0 0 8px color-mix(in oklab, var(--ok), transparent 60%);
}
.logout-container {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.logout-container .btn {
  min-width: 160px;
  text-align: center;
}
.footer-row{ display:flex; justify-content:center; }

