html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

@font-face {
  font-family: "Montserrat";
  src: url("./fonts/Montserrat-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Montserrat";
  src: url("./fonts/Montserrat-Bold.woff2") format("woff2");
  font-weight: bold;
  font-style: normal;
}

body {
  background: #1a1a1a;
  color: #ffffff;
  font-family: "Montserrat", sans-serif;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  text-align: center;
  padding: 2rem 1rem;
  box-sizing: border-box;
}

h1 {
  color: #00ffcc;
  margin-bottom: 1rem;
  font-size: 2.5rem;
  text-shadow: 0 0 10px #00ffcc55;
}

.station-info {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  color: #ddd;
}

#stationSelectorContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

#villeSelector,
#stationSelector {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: #2a2a2a;
  color: #ffffff;
  border: 1px solid #555;
  border-radius: 6px;
  width: 260px;
  text-align: left;
  transition: all 0.3s ease-in-out;
  appearance: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.carburant-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 2rem auto 3rem;
}

.carburant,
.rupture {
  background: linear-gradient(160deg, #222, #333);
  border-radius: 15px;
  width: 260px;
  padding: 1.8rem;
  min-height: 145px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition:
    transform 0.25s,
    box-shadow 0.25s;
}

.carburant {
  border: 2px solid #00ffcc;
  box-shadow: 0 0 15px #00ffcc33;
}

.carburant:hover {
  transform: scale(1.06);
  box-shadow: 0 0 20px #00ffcc99;
}

.rupture {
  border: 2px solid red;
  box-shadow: 0 0 15px #ff000033;
  animation: blink-border 1s infinite;
  height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rupture:hover {
  transform: scale(1.06);
  box-shadow: 0 0 20px #ff000099;
}

.type {
  font-size: 1.6rem;
  color: #ffd700;
  margin-bottom: 0.5rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.rupture .type {
  color: #ff5555;
}

.prix {
  font-size: 2.6rem;
  font-weight: bold;
  margin-top: 0.6rem;
  margin-bottom: 0.4rem;
  color: #ffffff;
}

.rupture .message {
  font-size: 1.8rem;
  font-weight: bold;
  color: #ff3333;
}

.maj {
  font-size: 0.8rem;
  color: #aaaaaa;
  margin-top: 1rem;
}

/* Clignotement de la bordure pour rupture */
@keyframes blink-border {
  0%,
  100% {
    border-color: red;
    box-shadow: 0 0 15px #ff000033;
  }
  50% {
    border-color: #ff9999;
    box-shadow: 0 0 20px #ff000099;
  }
}

.footer {
  padding: 10px;
  border-top: 1px solid #333;
  font-size: 0.95rem;
  color: #666;
  background: #1a1a1a;
  display: flex;
  justify-content: center;
}

/* Boutons flottants */
.floating-buttons {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.floating-buttons button {
  background-color: rgba(128, 128, 128, 0.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  padding: 15px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 1px 4px 6px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s;
}

.floating-buttons button:hover {
  background-color: rgba(128, 128, 128, 0.8);
}

.favorite-button {
  background-color: rgba(255, 215, 0, 0.5) !important;
}

.favorite-button:hover {
  background-color: rgba(255, 215, 0, 0.8) !important;
}

.favorite-button.active {
  background-color: rgba(255, 215, 0, 0.9) !important;
}

.favorites-button {
  background-color: rgba(0, 255, 204, 0.5) !important;
}

.favorites-button:hover {
  background-color: rgba(0, 255, 204, 0.8) !important;
}

/* Modal pour afficher les favoris */
.favorites-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.favorites-content {
  background: linear-gradient(160deg, #222, #333);
  border: 2px solid #00ffcc;
  border-radius: 15px;
  padding: 1.5rem;
  width: 95vw;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 20px #00ffcc99;
  margin: auto;
  box-sizing: border-box;
  animation: fadeInScale 0.3s ease-out forwards;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.favorites-content h2 {
  color: #00ffcc;
  margin-bottom: 1.5rem;
  text-align: center;
}

.favorite-station {
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.favorite-station:hover {
  background: #333;
  border-color: #00ffcc;
}

.favorite-station .name {
  font-weight: bold;
  font-size: 1.2rem;
  color: #fff;
}

.favorite-station .address {
  font-size: 0.9rem;
  color: #aaa;
  margin-top: 0.3rem;
}

.no-favorites {
  color: #aaa;
  text-align: center;
  font-style: italic;
}

.close-favorites {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.5rem;
  cursor: pointer;
}

.close-favorites:hover {
  color: #fff;
}

/* Messages système */
.system-message {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 255, 204, 0.9);
  color: #1a1a1a;
  padding: 1rem 2rem;
  border-radius: 5px;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  transition: opacity 0.5s;
}

.system-message.error-message {
  background-color: rgba(255, 173, 173, 0.95);
  color: #5a1a1a;
  box-shadow: 0 2px 12px rgba(255, 173, 173, 0.4);
}

.map-button {
  background-color: rgba(0, 128, 255, 0.5) !important;
}
.map-button:hover {
  background-color: rgba(0, 128, 255, 0.8) !important;
}

.map-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.map-content {
  background: #1a1a1a;
  border: 2px solid #00ffcc;
  border-radius: 12px;
  padding: 1rem;
  width: 95vw;
  max-width: 800px; /* Réduit de 900px à 800px */
  max-height: 85vh; /* Réduit de 90vh à 85vh */
  overflow: hidden;
  position: relative;
}

.close-map {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #aaa;
  cursor: pointer;
}

.close-map:hover {
  color: #fff;
}

/* Style pour les marqueurs personnalisés sur la carte */
.custom-map-marker {
  background: transparent !important;
  border: none !important;
}

/* Popup par défaut (stations) */
.leaflet-popup-content {
  font-family: "Montserrat", sans-serif;
  margin: 12px;
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  max-width: 260px; /* largeur fixe pour les stations */
  line-height: 1.4;
}

/* Popup spécifique pour la position utilisateur */
.user-location-popup .leaflet-popup-content {
  max-width: none !important; /* pas de limite */
  min-width: 107px; /* un peu de largeur mini */
  text-align: center;
  font-weight: bold;
  color: #00ffcc;
}

/* Titre + adresse */
.popup-header {
  margin-bottom: 10px; /* espace entre adresse et prix */
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: normal; /* forcer la coupure si trop long */
}

.leaflet-popup-content b {
  color: #000000;
}

.leaflet-popup-content-wrapper {
  background: #1a1a1a;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

.leaflet-popup-tip {
  background: #1a1a1a;
}

/* Ajustements pour le contenu de la carte */
#map {
  height: 75vh;
  border-radius: 8px;
}

.map-content h2 {
  margin-top: 0.5rem;
  margin-bottom: 0.8rem;
  font-size: 1.5rem;
}

/* Bloc principal */
.popup-container {
  font-family: "Montserrat", sans-serif;
  font-size: 14px;
  width: 260px !important;
}

/* Prix + logo alignés */
.popup-prices-with-logo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px; /* espace avec le bouton */
}

/* Liste des prix */
.popup-prices {
  flex: 1;
}

/* Ligne carburant + prix rapprochés */
.price-line {
  font-size: 14px;
  margin: 2px 0;
  display: flex;
  justify-content: flex-start;
  gap: 4px; /* ← petit espace seulement */
}

.fuel-price {
  font-weight: bold;
}

/* Logo aligné à droite */
.popup-logo img {
  height: 38px;
  width: auto;
  opacity: 0.9;
  margin-right: 10px; /* ← décalage vers la gauche */
}

/* Pied du popup avec bouton */
.popup-footer {
  text-align: center;
  margin-top: 8px;
}

/* Bouton sur toute la largeur */
.popup-button {
  display: block;
  width: 100%; /* ← prend toute la largeur */
  background: #00ffcc;
  color: #1a1a1a;
  border: none;
  border-radius: 8px;
  padding: 10px 0;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

.popup-button:hover {
  background: #00ccaa;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .carburant,
  .rupture {
    width: 45%;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .station-info {
    font-size: 1rem;
  }

  .carburant,
  .rupture {
    width: 80%;
    padding: 1.2rem;
  }

  .type {
    font-size: 1.2rem;
  }

  .prix {
    font-size: 2.5rem;
  }

  .rupture .message {
    font-size: 1.3rem;
  }

  .maj {
    font-size: 0.9rem;
  }

  .footer {
    font-size: 0.75rem;
  }

  .favorites-content {
    padding: 1.2rem;
    max-height: 85vh;
  }

  .favorite-station {
    padding: 0.8rem;
  }

  .favorites-content h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }

  .map-content {
    padding: 0.8rem;
  }
}



@media (max-width: 480px) {
  .carburant,
  .rupture {
    width: 80%;
  }

  .type,
  .rupture .type {
    font-size: 1.2rem;
  }

  .prix {
    font-size: 2.5rem;
  }

  .rupture .message {
    font-size: 1.6rem;
  }

  .maj {
    font-size: 0.85rem;
  }

  .footer {
    font-size: 0.75rem;
  }

  .favorites-content {
    width: 90%;
    padding: 1rem;
  }

  .map-content {
    width: 90%;
    padding: 0.5rem;
  }
}