* {
  box-sizing: border-box;
}

:root {
  --bg-dark: #001f2d;
  --card-bg: rgba(255, 255, 255, 0.08);
  --accent: #00a8ff;
  --red: #fd696f;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  color: #fff;
  overflow: hidden;
  background: #00273b;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
}

.main-wrapper {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 30vw;
  min-width: 400px;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  padding-inline: 15px;
  padding-top: 80px;
}

/* Filters buttons */
.filtreButtons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.filtre-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: solid 2px rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.filtre-btn img {
  width: 20px;
  margin: -5px;
}

.filtre-btn:hover {
  background: #b4c5e4;
  color: #000;
}

.filtre-btn.active {
  background: #b4c5e4;
  color: #000;
}

.filtreCartes {
  overflow-y: auto;
  padding-right: 10px;
  transition: all 0.3s;
}

.filtreCartes::-webkit-scrollbar {
  width: 6px;
}

.filtreCartes::-webkit-scrollbar-track {
  background: transparent;
  margin-bottom: 15px;
}

.filtreCartes::-webkit-scrollbar-thumb {
  background: #b4c5e4;
  border-radius: 20px;
}

.filtreCartes::-webkit-scrollbar-thumb:hover {
  cursor: pointer;
  background: #9eadc9;
}

/* Cache le menu par défaut */
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #2c3e50;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  border-radius: 8px;
  margin-top: 5px;
  overflow: hidden;
}

/* LA CLASSE CRUCIALE : ajoutée par le JS au clic */
.dropdown-content.active-menu {
  display: block !important;
}

.dropdown-content a {
  color: white;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-size: 14px;
  cursor: pointer;
}

.dropdown-content a:hover {
  background-color: #34495e;
}

/* Restaurants card */

.restaurant-carte {
  display: block;
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  margin-bottom: 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #fff;
  transition: all 0.3s;
  padding: 5px;
  border: 2px solid transparent;
}

.resto-card-contents {
  display: flex;
  gap: 10px;
  align-items: center;
}

.restaurant-carte:hover {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.2);
}

.carteImg {
  width: 90px;
  height: 90px;
  border-radius: 8px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

/* Contenu informations */

.Info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Empêche le débordement du texte */
  padding-right: 30px;
  /* Petit espace avant le bord droit */
}

.Info * {
  margin: 0;
}

.Info h2 {
  font-size: 1rem;
}

.Info h2 i {
  margin-left: 3px;
}

.Info p {
  font-size: 0.8rem;
}

/* ouvert ou ferme */

.status-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 4px 0;
}

.status-row p {
  margin: 0 !important;
  font-size: 0.85rem;
  font-weight: 500;
}

.dot {
  height: 8px;
  width: 8px;
  border-radius: 50%;
  display: inline-block;
}

.ouvert .dot {
  background-color: #2ecc71;
  animation: pulse-green 2s infinite;
}
.ouvert p {
  color: #2ecc71;
}

@keyframes pulse-green {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }

  100% {
    opacity: 1;
  }
}

.ferme .dot {
  background-color: var(--red);
}
.ferme p {
  color: var(--red);
}

.carteImg {
  position: relative;
}

/* CROUS OU RESTO */

.badge-type {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: bold;
  text-transform: uppercase;

  color: #b4c5e4;
  pointer-events: none;
  /* Le clic passe à travers vers la carte */
}

/* bouton favori */

.fav-btn {
  font-size: 1.2rem;
  padding: 5px;
  display: flex;
  align-items: center;
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--red);
}

.adresse-text {
  opacity: 0.8;
  font-size: 0.75rem !important;
  padding-right: 50px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  /* Espace maximum entre titre et coeur */
  align-items: center;
  width: 100%;
}

.title-row h2 {
  flex: 1;
  /* Prend tout l'espace et pousse le coeur à droite */
  margin: 0;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Le point bleu pour l'utilisateur */
.user-location-dot {
  background-image: url("../photos/markeruser.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 20px !important;
  height: 20px !important;
  display: block;
}

#map {
  flex: 1;
}

.custom-dot {
  background-image: url("../photos/marker.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.leaflet-control-attribution {
  max-width: 450px !important;
  border-top-right-radius: 15px;
  background-color: rgba(255, 255, 255, 0.5);
  padding: 5px 10px;
  font-size: 0.7rem;
  color: #000;
}

.leaflet-control-attribution a {
  color: #0078a8;
  text-decoration: none;
}

.leaflet-control-attribution a:hover {
  text-decoration: underline;
}

.popup-map {
  text-align: center;
}

.popup-map-title {
  display: block;
  font-size: 1.1rem;
}

.popup-map-btn {
  display: block;
  background-color: #002d40;
  color: #fff !important;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.popup-map-btn:hover {
  background-color: #b4c5e4;
  color: #000 !important;
}

.leaflet-container a.leaflet-popup-close-button {
  font-size: 1.2rem;
  color: #000;
}

@media (max-width: 1090px) {
  .leaflet-control-attribution {
    max-width: 130px !important;
  }
}

.error-msg {
  display: none;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .main-wrapper {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 2vw;
    width: 96vw;
    height: 85dvh;
    z-index: 1500;
    padding-top: 15px;
    min-width: unset;
    transform: translateY(95%);
    border-radius: 10px 10px 0 0;

    transition: all 0.3s ease-out;
    touch-action: none;
  }

  .sidebar.grabbing {
    transition: none; /* On désactive la transition pendant qu'on glisse à la main */
  }

  .leaflet-top.leaflet-left {
    margin-top: 85px !important;
    margin-left: 7px;
    transition: transform 0.3s;
  }

  .grab {
    padding-top: 10px;
    margin-top: -10px;
    padding-bottom: 20px;
  }
  .grab hr {
    width: 40vw;
    border: 2px solid #ccc;
    border-radius: 5px;
    margin: 0 auto;
  }

  .leaflet-control-attribution {
    transform: translateY(-5.5vh);
    border-radius: 0 20px 20px 0;
  }

  /* Oui je sais de base c'est dans footer.css mais là pour le responsive téléphone j'ai dû le mettre ici -Rémi */
  .map-footer {
    bottom: 41px !important;
    border-radius: 10px 0 0 10px !important;
  }
}

@media screen and (min-width: 769px) {
  .grab {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  .leaflet-control-container {
    transform: translateY();
  }
}
