/* --- Base styles --- */
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: linear-gradient(
    178deg,
    rgb(19 34 58) 70%,
    rgba(11, 27, 42, 1) 100%
  );
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Navigation --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #13223a;
  padding: 0.5rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover {
  color: #3a7bfd;
}

/* --- Burger menu --- */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  gap: 5px;
  margin-left: 1rem;
  z-index: 100;
}
.burger span {
  display: block;
  width: 28px;
  height: 4px;
  background: #fff;
  border-radius: 2px;
  transition: 0.3s;
}

/* --- Map and Info --- */
#map-container {
  position: relative;
  width: 100%;
  height: 66dvh;
  background-color: rgb(11,20,34);
}

#map {
  width: 100%;
  height: 100%;
  min-height: 66dvh;
  background-color: rgb(7,15,24);
  z-index: 1;
}

.info-text {
  text-align: center;
  margin: 2rem 0 1.5rem 0;
}
.info-text h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}
.info-text p {
  font-size: 1.1rem;
  color: #bfc9d5;
}
.leaflet-control-container {
  display:none;
}

/* --- Footer and Bulb --- */
footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 10;
  pointer-events: none;
  padding-bottom: 0;
  width: 100%;
}

/* Privacy notice */
.privacy-notice {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  pointer-events: auto;
  z-index: 20;
  text-align: center;
  width: max-content;
  max-width: 90vw;
}

.privacy-notice small {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.55rem;
}

.privacy-notice a {
  color: rgba(58, 123, 253, 0.8);
  text-decoration: none;
  transition: color 0.2s;
}

.privacy-notice a:hover {
  color: rgba(58, 123, 253, 1);
  text-decoration: underline;
}

.bulb-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-bottom: 2.5rem;
  pointer-events: auto;
  width: 100%;
}
#bulb-btn {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 0 auto;
  background: radial-gradient(circle, #233d5e00 60%, #0b1b2a 100%);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 24px 0 #000a;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}
#bulb-btn:hover {
  transform: scale(1.05);
}
#bulb-btn:active {
  box-shadow: 0 2px 12px 0 #0008;
  transform: scale(0.98);
}
#bulb-img {
  display: block;
  position: relative;
  z-index: 3;
  transition: filter 0.3s;
}
#progress-bar {
  position: absolute;
  top: -8px;
  left: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

/* Styles pour le cercle de progression */
.progress {
  background: conic-gradient(
    #3a7bfd var(--progress),
    rgba(58, 123, 253, 0.1) var(--progress),
    rgba(58, 123, 253, 0.1) calc(var(--progress) + 5deg),
    transparent calc(var(--progress) + 5deg)
  );
  animation: rotate 2s linear infinite;
  box-shadow: 0 0 20px rgba(58, 123, 253, 0.4);
}

/* Animation de rotation pour l'effet de brillance */
@keyframes rotate {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(15deg);
  }
}

/* Effet lumineux supplémentaire quand l'ampoule est active */
#bulb-btn.active {
  box-shadow: 0 0 30px rgba(58, 123, 253, 0.4);
}

/* --- Bulb disabled state --- */
#bulb-btn.disabled {
  cursor: not-allowed;
  background: radial-gradient(circle, #2c3440 60%, #0b1b2a 100%);
  box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.3);
  transition: none;
}

#bulb-btn.disabled:hover {
  transform: none;
}

img.disabled {
  filter: grayscale(100%) brightness(70%);
  opacity: 0.6;
}

/* Indication visuelle que l'ampoule est désactivée */
#bulb-btn.disabled::after {
  content: "";
  position: absolute;
  top: calc(50% - 2px);
  left: 20%;
  width: 60%;
  height: 4px;
  background-color: rgba(255, 0, 0, 0.6);
  transform: rotate(-45deg);
  border-radius: 2px;
  pointer-events: none;
  z-index: 4;
}

/* Timer text display */
.timer-text {
  color: #3a7bfd;
  font-weight: 600;
  font-size: 1.2rem;
  margin-top: 10px;
  background-color: rgba(11, 27, 42, 0.7);
  padding: 4px 12px;
  border-radius: 20px;
  text-shadow: 0 0 10px rgba(58, 123, 253, 0.5);
  min-height: 1.5rem; /* Ajusté pour correspondre à la hauteur du contenu */
  line-height: 1.5rem; /* Centrer verticalement le texte si une seule ligne */
  min-width: 60px;
  text-align: center;
  transition: opacity 0.3s, visibility 0.3s; /* Ajout de visibility à la transition */
  opacity: 0; /* Caché par défaut */
  visibility: hidden; /* Caché par défaut */
}

/* --- Debug Tools --- */
.debug-tools {
  margin-top: 12px;
  padding: 8px;
  border-radius: 5px;
  background-color: rgba(50, 50, 50, 0.3);
  display: inline-block;
}

.debug-checkbox {
  font-size: 0.85rem;
  color: #aaa;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.debug-checkbox input {
  margin: 0;
}

/* --- Zone Polygon Styles --- */
.zone-polygon {
  transition: all 0.5s ease;
}

.zone-polygon-active {
  animation: zone-glow 2s infinite ease-in-out;
  filter: drop-shadow(0 0 15px rgba(74, 139, 253, 0.9));
}

@keyframes zone-glow {
  0% {
    filter: drop-shadow(0 0 8px rgba(58, 123, 253, 0.7));
  }
  25% {
    filter: drop-shadow(0 0 20px rgba(74, 158, 255, 0.9));
  }
  50% {
    filter: drop-shadow(0 0 30px rgba(107, 168, 255, 1));
  }
  75% {
    filter: drop-shadow(0 0 20px rgba(74, 158, 255, 0.9));
  }
  100% {
    filter: drop-shadow(0 0 8px rgba(58, 123, 253, 0.7));
  }
}

/* --- Help Icon and Tooltip --- */
.help-icon {
  position: absolute;
  bottom: 40%;
  right: calc(50% - 85px);
  width: 20px;
  height: 20px;
  background: #233d5e;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s;
  z-index: 20;
  border: 2px solid white;
}

.help-icon:hover {
  background: #233d5e;
}

.tooltip {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  background: rgba(26, 41, 66, 0.95);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  pointer-events: none;
  z-index: 25;
}

.help-icon:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* --- Media Queries --- */
@media (max-width: 800px) {
  .nav-links {
    position: fixed;
    top: 60px;
    right: 0;
    background: #13223a;
    flex-direction: column;
    gap: 0;
    width: 220px;
    box-shadow: 0 6px 24px #0005;
    transform: translateX(100%);
    transition: transform 0.3s;
    pointer-events: none;
    opacity: 0;
    z-index: 99;
    height: 100dvh;
    padding-top: 10px;
  }
  .nav-links.open {
    transform: translateX(0);
    pointer-events: auto;
    opacity: 1;
  }
  .nav-links li {
    border-bottom: 1px solid #22344f;
    text-align: center;
    padding: 1rem 1.5rem;
    width: 100%;
  }
  .burger {
    display: flex;
  }

  #map {
    height: 45dvh;
  }
  .info-text {
    margin: 1.5rem 0;
    padding: 0 15px;
  }
  .info-text h1 {
    font-size: 1.8rem;
  }
  .info-text p {
    font-size: 1rem;
  }
  .v1-link {
    font-size: 0.95rem;
    padding: 0.35em 0.7em;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }
}

@media (max-width: 600px) {
  .navbar {
    padding: 0.5rem 1rem;
  }
  .nav-logo span {
    font-size: 0.9rem;
  }
  footer {
    padding-bottom: 30px;
  }
  .bulb-container {
    margin-bottom: 0.8rem;
  }
  #map {
    height: 60dvh;
    min-height: 220px;
  }
  .info-text {
    margin: 1.2rem 0;
  }
  .info-text h1 {
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
  }
  .info-text p {
    font-size: 0.9rem;
    max-width: 90%;
    margin: 0 auto;
  }
  #bulb-btn {
    width: 130px;
    height: 130px;
  }
  #bulb-img {
    width: 90px;
    height: 90px;
  }
  /* Mise à jour de la position du bouton d'aide pour mobile */
  .help-icon {
    width: 20px;
    height: 20px;
    font-size: 14px;
    /* Garder la position relative à l'ampoule comme sur desktop */
    bottom: 40%;
    right: calc(50% - 75px);
  }

  .tooltip {
    width: 180px;
    font-size: 0.8rem;
    bottom: 35px;
    right: -75px;
  }

  .tooltip:after {
    right: 85px;
  }
  .v1-link {
    font-size: 0.9rem;
    padding: 0.3em 0.6em;
    margin-left: 0.2rem;
    margin-right: 0.2rem;
  }
  .privacy-notice {
    max-width: 98vw;
    font-size: 0.7rem;
    padding: 0 2vw;
  }
}

@media (max-width: 375px) {
  .navbar {
    padding: 0.4rem 0.7rem;
  }
  .nav-logo img {
    height: 32px;
  }
  .nav-logo span {
    font-size: 0.8rem;
  }
  #map {
    height: 50dvh;
    min-height: 200px;
  }
  .info-text h1 {
    font-size: 1.4rem;
  }
  .info-text p {
    font-size: 0.85rem;
    max-width: 95%;
  }
  #bulb-btn {
    width: 80px;
    height: 80px;
  }
  #bulb-img {
    width: 55px;
    height: 55px;
  }
  /* Adapter la position du bouton d'aide pour les très petits écrans */
  .help-icon {
    width: 18px;
    height: 18px;
    font-size: 12px;
    bottom: 40%;
    right: calc(50% - 50px);
  }
  footer {
    padding-bottom: 20px;
  }
  .v1-link {
    font-size: 0.85rem;
    padding: 0.35em 0.7em;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  #map {
    height: 28dvh;
  }
  .info-text {
    margin: 0.8rem 0;
  }
  .info-text h1 {
    font-size: 1.4rem;
    margin-bottom: 0.2rem;
  }
  .info-text p {
    font-size: 0.8rem;
  }
  footer {
    padding-bottom: 10px;
  }
  .bulb-container {
    margin-bottom: 0.5rem;
  }
}

/* Lien Retourner sur la V1 */
.v1-link {
  color: #fff;
  background: #3a7bfd;
  border-radius: 4px;
  padding: 0.4em 0.8em;
  margin-left: 1rem;
  margin-right: 1rem;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  transition: background 0.2s, color 0.2s;
  display: inline-block;
  white-space: nowrap;
}
.v1-link:hover {
  background: #2556a8;
  color: #fff;
}

.city-banner {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 10001;
  margin: 0;
  padding: 16px 24px;
  border-radius: 8px;
  font-size: 1.1em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  background: #fff;
  border-left: 6px solid #2196f3;
  color: #222;
  transition: opacity 0.3s;
}
.city-banner.info {
  background: #e3f2fd;
  border-color: #2196f3;
  color: #1565c0;
}
.city-banner.success {
  background: #e8f5e9;
  border-color: #43a047;
  color: #256029;
}
.city-banner.alert {
  background: #ffebee;
  border-color: #e53935;
  color: #b71c1c;
}

/* Loader overlay */
#loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(19,34,58,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
#loader::after {
  content: '';
  display: block;
  width: 80px;
  height: 80px;
  background: url('../assets/loading.gif') center center no-repeat;
  background-size: contain;
}
