/* ==========================================================================
   Materiautec - Carte des fournisseurs
   ========================================================================== */

:root {
  --mt-map-primary: #046632;
  --mt-map-secondary: #0d8f37;
  --mt-map-tertiary: #ffcf4e;
  --mt-map-bg: #f0f3f7;
  --mt-map-white: #fff;
  --mt-map-radius: 10px;
  --mt-map-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* --- Layout principal --- */
.mt-suppliermap {
  margin: 0 -15px;
}

.mt-suppliermap__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: var(--mt-map-white);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  gap: 15px;
  flex-wrap: wrap;
}

.mt-suppliermap__count {
  color: var(--mt-map-primary);
  font-size: 0.95rem;
  white-space: nowrap;
}

.mt-suppliermap__count strong {
  font-size: 1.3rem;
  color: var(--mt-map-secondary);
}

.mt-suppliermap__search {
  flex: 1;
  max-width: 350px;
}

.mt-suppliermap__search input {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 15px;
  font-size: 0.9rem;
  color: var(--mt-map-primary);
  width: 100%;
  transition: border-color 0.2s;
}

.mt-suppliermap__search input:focus {
  border-color: var(--mt-map-secondary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 175, 177, 0.15);
}

.mt-suppliermap__wrapper {
  display: flex;
  height: 600px;
}

/* --- Liste fournisseurs --- */
.mt-suppliermap__list {
  width: 420px;
  min-width: 320px;
  overflow-y: auto;
  background: var(--mt-map-white);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  scrollbar-width: thin;
  scrollbar-color: #c0c8d4 transparent;
}

.mt-suppliermap__list::-webkit-scrollbar {
  width: 6px;
}

.mt-suppliermap__list::-webkit-scrollbar-thumb {
  background: #c0c8d4;
  border-radius: 3px;
}

/* --- Carte fournisseur --- */
.mt-suppliermap__card {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: background-color 0.2s;
}

.mt-suppliermap__card:hover,
.mt-suppliermap__card.is-active {
  background-color: #e9f8f8;
}

.mt-suppliermap__card.is-active {
  border-left: 3px solid var(--mt-map-secondary);
  padding-left: 17px;
}

.mt-suppliermap__card-body {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.mt-suppliermap__card-info {
  flex: 1;
  min-width: 0;
}

.mt-suppliermap__card-name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--mt-map-primary);
  line-height: 1.3;
}

.mt-suppliermap__card-name a {
  color: inherit;
  text-decoration: none;
}

.mt-suppliermap__card-name a:hover {
  color: var(--mt-map-secondary);
}

.mt-suppliermap__card-address {
  font-size: 0.85rem;
  color: #5a6a80;
  margin: 0 0 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}

.mt-suppliermap__card-address svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--mt-map-secondary);
}

.mt-suppliermap__card-badge {
  display: inline-block;
  background: var(--mt-map-secondary);
  color: var(--mt-map-white);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
}

.mt-suppliermap__card-phone {
  font-size: 0.83rem;
  color: #5a6a80;
  margin: 6px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mt-suppliermap__card-phone svg {
  color: var(--mt-map-secondary);
}

.mt-suppliermap__card-image {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--mt-map-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mt-suppliermap__card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mt-suppliermap__card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.mt-suppliermap__empty {
  padding: 40px 20px;
  text-align: center;
  color: #5a6a80;
}

/* --- Conteneur carte --- */
.mt-suppliermap__map-container {
  flex: 1;
  position: relative;
}

.mt-suppliermap__map {
  width: 100%;
  height: 100%;
}

/* --- Popups Leaflet --- */
.mt-popup {
  font-family: 'Raleway', sans-serif;
  min-width: 200px;
}

.mt-popup__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--mt-map-primary);
  margin: 0 0 6px;
}

.mt-popup__address {
  font-size: 0.83rem;
  color: #5a6a80;
  margin: 0 0 8px;
}

.mt-popup__badge {
  display: inline-block;
  background: var(--mt-map-secondary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.mt-popup__link {
  display: inline-block;
  font-size: 0.83rem;
  color: var(--mt-map-secondary);
  font-weight: 600;
  text-decoration: none;
}

.mt-popup__link:hover {
  text-decoration: underline;
}

/* Style les popups Leaflet */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 0;
}

.leaflet-popup-content {
  margin: 14px 16px;
}

.leaflet-popup-tip {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* --- Marqueur custom --- */
.mt-marker {
  width: 32px;
  height: 40px;
  position: relative;
}

.mt-marker__pin {
  width: 32px;
  height: 40px;
  display: block;
}

.mt-marker--active .mt-marker__pin path {
  fill: var(--mt-map-primary);
}

/* --- Responsive --- */
@media (max-width: 991px) {
  .mt-suppliermap__wrapper {
    flex-direction: column-reverse;
    height: auto;
  }

  .mt-suppliermap__list {
    width: 100%;
    max-height: 350px;
    border-right: none;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }

  .mt-suppliermap__map-container {
    height: 400px;
  }
}

@media (max-width: 575px) {
  .mt-suppliermap__toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .mt-suppliermap__search {
    max-width: 100%;
  }

  .mt-suppliermap__map-container {
    height: 300px;
  }

  .mt-suppliermap__list {
    max-height: 280px;
  }

  .mt-suppliermap__card-image {
    width: 55px;
    height: 55px;
  }
}

/* ==========================================================================
   Hook displayHome - Carte + carousel fournisseurs
   ========================================================================== */

.mt-home-map {
  padding: 0;
  background-color: var(--mt-map-bg);
}

/* --- Header --- */
.mt-home-map__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.mt-home-map__header h2 {
  color: #046633;
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
}

.mt-home-map__see-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--mt-map-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.mt-home-map__see-all:hover {
  color: var(--mt-map-primary);
  text-decoration: none;
}

/* --- Carte --- */
.mt-home-map__map-wrapper {
  border-radius: var(--mt-map-radius);
  overflow: hidden;
  box-shadow: var(--mt-map-shadow);
  margin-bottom: 20px;
}

.mt-home-map__map {
  width: 100%;
  height: 420px;
}

/* --- Carousel --- */
.mt-home-map__carousel-wrapper {
  position: relative;
}

.mt-home-map__carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 4px 0 12px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.mt-home-map__carousel::-webkit-scrollbar {
  display: none;
}

/* --- Fleches --- */
.mt-home-map__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--mt-map-white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mt-map-primary);
  transition: background-color 0.2s, opacity 0.2s, visibility 0.2s;
}

.mt-home-map__arrow:hover {
  background-color: var(--mt-map-secondary);
  color: #fff;
}

.mt-home-map__arrow--prev {
  left: -14px;
}

.mt-home-map__arrow--next {
  right: -14px;
}

.mt-home-map__arrow.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* --- Carte fournisseur carousel --- */
.mt-home-map__card {
  flex: 0 0 300px;
  scroll-snap-align: start;
  background: var(--mt-map-white);
  border-radius: var(--mt-map-radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  border: 2px solid transparent;
}

.mt-home-map__card:hover {
  box-shadow: var(--mt-map-shadow);
  transform: translateY(-2px);
}

.mt-home-map__card.is-active {
  border-color: var(--mt-map-secondary);
  box-shadow: 0 4px 20px rgba(0, 175, 177, 0.2);
}

.mt-home-map__card-inner {
  display: flex;
  gap: 12px;
  padding: 16px;
  flex: 1;
}

.mt-home-map__card-info {
  flex: 1;
  min-width: 0;
}

.mt-home-map__card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--mt-map-primary);
  margin: 0 0 6px;
  line-height: 1.3;
}

.mt-home-map__card-address {
  font-size: 0.8rem;
  color: #5a6a80;
  margin: 0 0 8px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.35;
}

.mt-home-map__card-address svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--mt-map-secondary);
}

.mt-home-map__card-badge {
  display: inline-block;
  background: var(--mt-map-secondary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
}

.mt-home-map__card-image {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--mt-map-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mt-home-map__card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mt-home-map__card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.mt-home-map__card-link {
  display: block;
  padding: 10px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--mt-map-secondary);
  text-decoration: none;
  transition: background-color 0.15s;
}

.mt-home-map__card-link:hover {
  background-color: #e9f8f8;
  color: var(--mt-map-secondary);
  text-decoration: none;
}

/* --- Responsive --- */
@media (max-width: 767px) {
  .mt-home-map {
    padding: 40px 0;
  }

  .mt-home-map__header h2 {
    font-size: 1.2rem;
  }

  .mt-home-map__map {
    height: 300px;
  }

  .mt-home-map__card {
    flex: 0 0 260px;
  }

  .mt-home-map__arrow {
    display: none;
  }
}

@media (max-width: 575px) {
  .mt-home-map__header {
    flex-direction: column;
  }

  .mt-home-map__map {
    height: 250px;
  }

  .mt-home-map__card {
    flex: 0 0 240px;
  }
}
