/* ============================================
   NextPark Web — ParkVolt Clean Tech Style
   Light • Minimal • Neon Green Accent
   ============================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Colors */
  --bg: #f8f9fa;
  --bg-card: rgba(255, 255, 255, 0.95);
  --text: #0a0a0a;
  --text-sec: #4a4a4a;
  --text-muted: #8e8e93;

  --green: #a8e000;
  --green-gradient: linear-gradient(135deg, #a8e000 0%, #82af00 100%);
  --green-glow: 0 4px 20px rgba(168, 224, 0, 0.4);
  --green-soft: rgba(168, 224, 0, 0.15);

  --danger: #ff3b30;
  --success: #34c759;
  --blue: #007aff;
  --border: rgba(0, 0, 0, 0.05);

  /* Radius */
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 32px;

  /* Shadows */
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 12px 48px rgba(0, 0, 0, 0.12);
  --font: "Inter", -apple-system, system-ui, sans-serif;

  --header-h: 64px;
  --nav-h: 80px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
button {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
input {
  border: none;
  outline: none;
  font: inherit;
}
a {
  text-decoration: none;
  color: inherit;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ---------- Header — Frosted Glass ---------- */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 2000;
  background: rgba(245, 245, 245, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.logo img {
  height: 32px;
  width: auto;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hdr-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.15s;
}
.hdr-btn:active {
  background: var(--bg);
}
.hdr-btn svg {
  width: 20px;
  height: 20px;
}

/* ---------- Layout ---------- */
#app-main {
  padding-top: calc(
    var(--header-h) + 4px
  ); /* Point 5: Moins d'espace en haut */
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px);
  padding-inline: 12px;
}

.screen {
  display: none;
}
.screen.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: screenIn 0.3s ease-out;
}
@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Card ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- Map Card ---------- */
.card-map {
  padding: 0;
  overflow: hidden;
  height: calc(100vh - var(--header-h) - var(--nav-h));
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  border-radius: 0;
}
#leaflet-map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#screen-home {
  position: relative;
  padding: 0;
  height: calc(100vh - var(--header-h) - var(--nav-h));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Point 2 & 3: Le bouton GPS descend plus bas, mais juste au-dessus du bloc session */
#btn-locate-container {
  margin-top: auto;
  margin-bottom: 20px; /* Plus proche de la carte session pour rester sous le pouce */
  pointer-events: none;
  z-index: 5;
}
#btn-locate {
  pointer-events: auto;
}

.home-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.home-overlay > * {
  pointer-events: auto;
  margin-bottom: 6px; /* Espace minimal entre les blocs du haut */
}

.home-overlay > .session-card-wrapper {
  margin-top: 0;
  margin-bottom: 0;
  width: 100%;
}

.tile-sub {
  display: none !important;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.map-fab {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fab {
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  color: var(--text);
  transition: transform 0.1s;
}
.fab:active {
  transform: scale(0.92);
}
.fab svg {
  width: 20px;
  height: 20px;
}

/* ---------- Plate Input ---------- */
.plate-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plate-section .section-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-left: 4px;
}
.plate-field {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border-radius: var(--r-md);
  padding: 14px 16px;
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.plate-field:focus-within {
  border-color: var(--green);
  background: #fff;
  box-shadow:
    var(--green-glow),
    inset 0 2px 4px rgba(0, 0, 0, 0.01);
  transform: translateY(-1px);
}
.plate-field svg {
  width: 22px;
  height: 22px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.plate-input {
  flex: 1;
  background: transparent;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
  text-align: center;
}
.plate-input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
  font-size: 1rem;
}

/* ---------- Info Grid ---------- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.info-tile {
  background: var(--bg);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.info-tile.wide {
  grid-column: span 2;
}
.tile-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tile-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.tile-sub {
  font-size: 0.78rem;
  color: var(--text-sec);
}

/* ---------- Duration Slider ---------- */
.slider-section {
  margin-top: 8px;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.slider-track {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
}
.slider-track::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--green);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.1s;
}
.slider-track::-webkit-slider-thumb:active {
  transform: scale(1.15);
}

/* ---------- Buttons ---------- */
.btn-cta {
  width: 100%;
  padding: 18px;
  background: var(--green-gradient);
  color: #000;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: var(--r-md);
  box-shadow: var(--green-glow);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
  position: relative;
  overflow: hidden;
  border: none;
}

.btn-cta:active {
  transform: scale(0.96);
  box-shadow: 0 2px 10px rgba(168, 224, 0, 0.2);
}

/* Shimmer Animation Effect */
.btn-cta::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(45deg);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-150%) rotate(45deg);
  }
  20% {
    transform: translateX(150%) rotate(45deg);
  }
  100% {
    transform: translateX(150%) rotate(45deg);
  }
}

.btn-outline {
  width: 100%;
  padding: 14px;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  transition: all 0.15s;
  text-align: center;
}
.btn-outline:active {
  background: var(--bg);
}

.btn-danger {
  width: 100%;
  padding: 14px;
  background: var(--danger);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--r-md);
  text-align: center;
}

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center; /* Point 4: Centrage vertical */
  justify-content: space-around;
  z-index: 2000;
}
.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  padding: 0 16px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: color 0.15s;
}
.nav-tab.active {
  color: var(--green);
}
.nav-tab.active svg {
  stroke: var(--green);
}
.nav-tab svg {
  width: 24px;
  height: 24px;
  margin-bottom: 1px;
}

/* ---------- Ticket Screen ---------- */
#screen-ticket {
  align-items: center;
  padding-top: 20px;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.success-icon svg {
  width: 40px;
  height: 40px;
  stroke: #fff;
  stroke-width: 3;
}

.ticket-plate-box {
  background: var(--bg);
  border: 3px solid var(--text);
  border-radius: var(--r-sm);
  padding: 14px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 3px;
  margin: 16px 0;
}

/* ---------- Account Screen ---------- */
#screen-account {
  padding-top: 16px;
}

.auth-input {
  width: 100%;
  padding: 14px 16px;
  background: #efefef;
  border-radius: var(--r-md);
  font-size: 0.95rem;
  color: var(--text);
  border: 2px solid transparent;
  transition: all 0.2s;
}
.auth-input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px var(--green-soft);
}
.auth-input::placeholder {
  color: var(--text-muted);
}

.saved-plate-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}
.saved-plate-chip:active {
  background: var(--green-soft);
  border-color: var(--green);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  padding: 14px 20px;
  border-radius: var(--r-sm);
  background: var(--text);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  z-index: 10000;
  transform: translateY(-120px);
  transition: transform 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.toast.show {
  transform: translateY(0);
}
.toast-error {
  background: var(--danger);
}
.toast-success {
  background: var(--success);
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  gap: 20px;
}

.spinner-container {
  position: relative;
  width: 64px;
  height: 64px;
}

.spinner {
  width: 100%;
  height: 100%;
  border: 3px solid var(--green-soft);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

.spinner-inner {
  position: absolute;
  inset: 12px;
  border: 3px solid transparent;
  border-top-color: var(--green);
  border-radius: 50%;
  opacity: 0.5;
  animation: spin 1.2s reverse linear infinite;
}

#loading-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.2px;
  animation: pulseText 1.5s ease-in-out infinite;
}

@keyframes pulseText {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Fullscreen Success Screen ---------- */
.success-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 11000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  animation: successIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes successIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.success-check-anim {
  width: 100px;
  height: 100px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: var(--green-glow);
}

.success-check-anim svg {
  width: 50px;
  height: 50px;
  stroke: #000;
  stroke-width: 3;
}
.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
  max-height: 80vh;
  overflow-y: auto;
  animation: sheetUp 0.3s ease-out;
}
@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 16px;
}

/* ---------- Leaflet Overrides ---------- */
.leaflet-container {
  background: #f5f5f5 !important;
}
.leaflet-bar {
  border: none !important;
  box-shadow: var(--shadow) !important;
  border-radius: var(--r-sm) !important;
}
.leaflet-bar a {
  border-radius: var(--r-sm) !important;
}
/* Leaflet Custom Overrides */
.leaflet-popup-content-wrapper {
  background: white;
  border-radius: 16px;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 0;
}
.leaflet-popup-content {
  margin: 12px;
  line-height: 1.4;
}
.leaflet-popup-tip {
  background: white;
}
.leaflet-container a.leaflet-popup-close-button {
  top: 10px;
  right: 10px;
  color: #9ca3af;
  font-size: 18px;
}

.meter-marker {
  width: 36px !important;
  height: 36px !important;
  background: var(--text) !important;
  color: #fff !important;
  border: 3px solid #fff !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px !important;
  font-weight: 800 !important;
  transition: all 0.15s;
}
.meter-marker.selected {
  background: var(--green) !important;
  color: #000 !important;
  border-color: #fff !important;
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(168, 224, 0, 0.4) !important;
}

.user-marker {
  width: 20px;
  height: 20px;
  background: var(--blue);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(0, 122, 255, 0.5);
  position: relative;
}

.user-marker::before {
  content: "";
  position: absolute;
  inset: -8px;
  background: var(--blue);
  border-radius: 50%;
  opacity: 0.3;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.5);
    opacity: 0.5;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* ---------- Utilities ---------- */
.hidden {
  display: none !important;
}
.text-center {
  text-align: center;
}
.mt-8 {
  margin-top: 8px;
}
.mt-12 {
  margin-top: 12px;
}
.mt-16 {
  margin-top: 16px;
}
.mt-24 {
  margin-top: 24px;
}
.gap-8 {
  gap: 8px;
}
.gap-12 {
  gap: 12px;
}
