/* ==========================================================================
   GÉNÉRATEUR DE NOMS DE VILLES - PANNEAU EB10 (CSS PUR) - VERSION ÉPURÉE
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800;900&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* Palette de signalisation routière */
  --panneau-rouge: #df1b24;
  --panneau-fond: #fcfdfe;
  --panneau-texte: #0c0e12;

  /* Typographie */
  --font-road: 'Barlow Condensed', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Transitions */
  --trans-fast: 0.15s ease;
  --trans-smooth: 0.25s ease;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  font-family: var(--font-ui);
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* ==========================================================================
   THÈMES CLAIR / OBSCUR & SOL EN HERBE PLEINE LARGEUR
   ========================================================================== */

/* Mode Clair (Jour / Bord de route) */
body.mode-clair {
  background: linear-gradient(180deg, #7bb7eb 0%, #b8dcf9 35%, #ebf5fe 50%);
  background-attachment: fixed;
  color: #0f172a;
  --header-border: rgba(0, 0, 0, 0.12);
  --title-color: #0f172a;
  
  /* Bloc gris / Dock inférieur */
  --dock-bg: rgba(241, 245, 249, 0.94);
  --dock-border: rgba(0, 0, 0, 0.14);
  --dock-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  --dock-title-color: #334155;
  
  /* Puces d'historique */
  --chip-bg: #ffffff;
  --chip-text: #0f172a;
  --chip-border: rgba(0, 0, 0, 0.16);
  --chip-hover-bg: #f8fafc;
  --chip-active-bg: #fee2e2;
  --chip-active-border: #df1b24;
  --chip-active-text: #b91c1c;

  /* Sol en herbe pleine largeur */
  --ground-gradient: linear-gradient(180deg, #5bb334 0%, #469624 32%, #347519 65%, #23540f 100%);
  --ground-top-highlight: rgba(255, 255, 255, 0.2);
}

/* Mode Obscur (Nuit / Contraste) */
body.mode-sombre {
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 65%, #020617 100%);
  background-attachment: fixed;
  color: #f8fafc;
  --header-border: rgba(255, 255, 255, 0.12);
  --title-color: #ffffff;

  /* Bloc gris / Dock inférieur */
  --dock-bg: rgba(30, 41, 59, 0.94);
  --dock-border: rgba(255, 255, 255, 0.14);
  --dock-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  --dock-title-color: #cbd5e1;

  /* Puces d'historique */
  --chip-bg: rgba(51, 65, 85, 0.85);
  --chip-text: #f8fafc;
  --chip-border: rgba(255, 255, 255, 0.16);
  --chip-hover-bg: rgba(71, 85, 105, 0.95);
  --chip-active-bg: rgba(223, 27, 36, 0.3);
  --chip-active-border: #f87171;
  --chip-active-text: #fca5a5;

  /* Sol en herbe pleine largeur */
  --ground-gradient: linear-gradient(180deg, #1f3d16 0%, #162e10 35%, #0e1e0a 100%);
  --ground-top-highlight: rgba(255, 255, 255, 0.05);
}

/* Sol en herbe continu couvrant 100% de la largeur de l'écran */
.fullwidth-ground {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 52vh;
  background: var(--ground-gradient);
  box-shadow: inset 0 1px 0 var(--ground-top-highlight), 0 -4px 20px rgba(0, 0, 0, 0.12);
  z-index: 1;
  pointer-events: none;
  transition: background 0.3s ease;
}

.app-container {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  justify-content: space-between;
  gap: 1rem;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--header-border);
}

.logo-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--title-color);
  letter-spacing: -0.3px;
}

.btn-theme-toggle {
  background: var(--dock-bg);
  border: 1px solid var(--dock-border);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  transition: all var(--trans-fast);
}

.btn-theme-toggle:hover {
  transform: scale(1.08);
}

.btn-theme-toggle:active {
  transform: scale(0.95);
}

/* ==========================================================================
   SCÈNE DU PANNEAU ROUTIER
   ========================================================================== */

.road-scene {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 0;
  min-height: 360px;
}

.sign-assembly {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
  filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.28));
}

/* Sommet du poteau */
.pole-top {
  width: 28px;
  height: 16px;
  background: linear-gradient(90deg, #4b525d 0%, #9ca3af 35%, #e2e8f0 55%, #6b7280 85%, #374151 100%);
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.4), 0 -1px 2px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

/* Le Panneau EB10 */
.road-sign {
  position: relative;
  z-index: 2;
  min-width: 320px;
  max-width: 800px;
  width: auto;
  min-height: 130px;
  background: var(--panneau-fond);
  border-radius: 20px;
  /* Chanfrein métallique biseauté extérieur */
  box-shadow: 
    0 0 0 2px #d1d5db,
    0 0 0 4px #9ca3af,
    0 0 0 5.5px #4b525d,
    0 8px 20px rgba(0, 0, 0, 0.25),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
  user-select: none;
}

/* Liséré rouge intérieur officiel */
.sign-border-red {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 110px;
  border: 11px solid var(--panneau-rouge);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 2.5rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Reflet satiné discret */
.sign-border-red::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

/* Typographie du nom de ville */
.sign-text-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  z-index: 2;
  gap: 0.15rem;
}

.sign-text-line {
  font-family: var(--font-road);
  font-weight: 800;
  font-size: 3.2rem;
  line-height: 1.05;
  color: var(--panneau-texte);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}

/* Deux lignes si le nom est long */
.sign-text-wrapper.two-lines .sign-text-line {
  font-size: 2.3rem;
  line-height: 1.1;
  letter-spacing: 2px;
}

/* Mât inférieur métallique */
.pole-bottom {
  width: 34px;
  height: 160px;
  background: linear-gradient(90deg, #474d57 0%, #88909c 25%, #e5e9f0 50%, #9ca3af 75%, #333842 100%);
  box-shadow: 
    inset 0 5px 6px rgba(0, 0, 0, 0.4),
    3px 8px 15px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
  margin-top: -3px;
  display: flex;
  justify-content: center;
}

.pole-base {
  position: absolute;
  bottom: 0;
  width: 56px;
  height: 12px;
  background: linear-gradient(180deg, #64748b 0%, #334155 100%);
  border-radius: 4px 4px 0 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.ground-shadow {
  width: 200px;
  height: 16px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 70%);
  border-radius: 50%;
  margin-top: -8px;
  z-index: 0;
}

/* ==========================================================================
   BLOC DOCK INFÉRIEUR (BLOC GRIS LISIBLE)
   ========================================================================== */

.bottom-dock-card {
  background: var(--dock-bg);
  border: 1px solid var(--dock-border);
  box-shadow: var(--dock-shadow);
  border-radius: 20px;
  padding: 1.4rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  backdrop-filter: blur(14px);
  z-index: 10;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.action-bar {
  display: flex;
  justify-content: center;
  width: 100%;
}

.btn-generate {
  background: linear-gradient(135deg, var(--panneau-rouge) 0%, #b91c1c 100%);
  color: white;
  font-family: var(--font-road);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0.85rem 2.75rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 
    0 10px 25px -5px rgba(223, 27, 36, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  transition: all var(--trans-smooth);
}

.btn-generate:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 15px 30px -5px rgba(223, 27, 36, 0.6),
    0 0 20px rgba(223, 27, 36, 0.35);
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.btn-generate:active {
  transform: translateY(1px) scale(0.99);
}

/* Historique des derniers tirages */
.history-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--dock-title-color);
}

.history-chips-container {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.2rem 0.2rem 0.5rem;
  scrollbar-width: thin;
}

.history-chip {
  background: var(--chip-bg);
  color: var(--chip-text);
  border: 1px solid var(--chip-border);
  padding: 0.45rem 0.95rem;
  border-radius: 20px;
  font-family: var(--font-road);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all var(--trans-fast);
}

.history-chip:hover {
  background: var(--chip-hover-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.history-chip.active {
  background: var(--chip-active-bg);
  border-color: var(--chip-active-border);
  color: var(--chip-active-text);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
  .road-sign {
    min-width: 270px;
    padding: 7px;
    border-radius: 16px;
  }

  .sign-border-red {
    border-width: 8px;
    padding: 0.9rem 1.2rem;
    min-height: 85px;
  }

  .sign-text-line {
    font-size: 2.1rem;
    letter-spacing: 1.5px;
  }

  .sign-text-wrapper.two-lines .sign-text-line {
    font-size: 1.55rem;
    letter-spacing: 1px;
  }

  .btn-generate {
    font-size: 1.3rem;
    padding: 0.75rem 1.75rem;
    width: 100%;
    justify-content: center;
  }

  .bottom-dock-card {
    padding: 1.1rem 1.2rem;
  }
}
