/* ══════════════════════════════════════════════════════════
   Tiendas Colombia — Map Layout Styles
   Split view: store list (left) + Google Map (right)
   ══════════════════════════════════════════════════════════ */

/* ── Wrapper ───────────────────────────────────────────── */
.tc-mapa-wrapper {
  --tc-primary: #1a2744;
  --tc-primary-light: #2d4a7a;
  --tc-accent: #f2c94c;
  --tc-accent-hover: #e0b830;
  --tc-whatsapp: #25d366;
  --tc-whatsapp-hover: #1ebe5d;
  --tc-bg: #f7f8fa;
  --tc-card-bg: #ffffff;
  --tc-text: #1a2744;
  --tc-text-muted: #6b7a90;
  --tc-border: #e2e6ec;
  --tc-radius: 0;
  --tc-radius-sm: 8px;
  --tc-shadow:
    0 1px 3px rgba(26, 39, 68, 0.06), 0 4px 12px rgba(26, 39, 68, 0.04);
  --tc-shadow-hover:
    0 4px 12px rgba(26, 39, 68, 0.1), 0 12px 28px rgba(26, 39, 68, 0.08);
  --tc-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --tc-map-height: 680px;

  position: relative;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Helvetica Neue", Arial, sans-serif;
  color: var(--tc-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.tc-mapa-wrapper *,
.tc-mapa-wrapper *::before,
.tc-mapa-wrapper *::after {
  box-sizing: border-box;
}

/* ── Reuse filter styles (already loaded from frontend.css) */
/* These classes come from frontend.css but we duplicate the
   necessary ones to be self-contained when only map is used */

.tc-mapa-wrapper .tc-filters {
  background: var(--tc-card-bg);
  border-bottom: 1px solid var(--tc-border);
  padding: 20px 24px;
  z-index: 2;
}

.tc-mapa-wrapper .tc-filters__inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.tc-mapa-wrapper .tc-filters__group {
  flex: 1;
  min-width: 100%;
}

.tc-mapa-wrapper .tc-filters__group--btn {
  flex: 0 0 auto;
  min-width: 100%;
}

.tc-mapa-wrapper .tc-filters__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tc-text-muted);
  margin-bottom: 8px;
}

.tc-mapa-wrapper .tc-filters__select-wrap {
  position: relative;
}

.tc-mapa-wrapper .tc-filters__select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 40px 10px 14px;
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-sm);
  background-color: var(--tc-bg);
  font-size: 14px;
  font-weight: 500;
  color: var(--tc-text);
  cursor: pointer;
  transition:
    border-color var(--tc-transition),
    box-shadow var(--tc-transition);
  line-height: 1.5;
}

.tc-mapa-wrapper .tc-filters__select:hover {
  border-color: var(--tc-primary-light);
}

.tc-mapa-wrapper .tc-filters__select:focus {
  outline: none;
  border-color: var(--tc-primary);
  box-shadow: 0 0 0 3px rgba(26, 39, 68, 0.1);
}

.tc-mapa-wrapper .tc-filters__select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tc-mapa-wrapper .tc-filters__chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--tc-text-muted);
}

.tc-mapa-wrapper .tc-filters__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius-sm);
  background: var(--tc-bg);
  color: var(--tc-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tc-transition);
  white-space: nowrap;
}

.tc-mapa-wrapper .tc-filters__clear:hover {
  border-color: #e74c3c;
  color: #e74c3c;
  background: #fdf2f2;
}

.tc-mapa-wrapper .tc-filters__count {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--tc-border);
  font-size: 13px;
  color: var(--tc-text-muted);
}

.tc-mapa-wrapper .tc-filters__count span {
  font-weight: 700;
  color: var(--tc-primary);
}

/* ── Layout: list + map ────────────────────────────────── */
.tc-mapa-layout {
  display: flex;
  gap: 0;
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  overflow: hidden;
  box-shadow: var(--tc-shadow);
  background: var(--tc-card-bg);
  height: var(--tc-map-height);
}

/* ── Left: Store Sidebar ──────────────────────────────────── */
.tc-mapa-sidebar {
  flex: 0 0 380px;
  width: 380px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--tc-border);
  background: var(--tc-card-bg);
  z-index: 2;
}

.tc-mapa-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.tc-mapa-list::-webkit-scrollbar {
  width: 6px;
}

.tc-mapa-list::-webkit-scrollbar-track {
  background: transparent;
}

.tc-mapa-list::-webkit-scrollbar-thumb {
  background: var(--tc-border);
  border-radius: 3px;
}

.tc-mapa-list::-webkit-scrollbar-thumb:hover {
  background: var(--tc-text-muted);
}

/* List items */
.tc-mapa-list__item {
  padding: 18px 20px;
  border-bottom: 1px solid var(--tc-border);
  cursor: pointer;
  transition:
    background var(--tc-transition),
    border-left-color var(--tc-transition);
  border-left: 3px solid transparent;
  position: relative;
}

.tc-mapa-list__item:last-child {
  border-bottom: none;
}

.tc-mapa-list__item:hover {
  background: var(--tc-bg);
}

.tc-mapa-list__item--active {
  background: #f0f4ff;
  border-left-color: var(--tc-primary);
}

.tc-mapa-list__item--active:hover {
  background: #e8eeff;
}

.tc-mapa-list__item--no-coords {
  cursor: default;
  opacity: 0.65;
}

.tc-mapa-list__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tc-mapa-list__title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--tc-text);
  line-height: 1.3;
  flex: 1;
}

.tc-mapa-list__locate {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--tc-border);
  border-radius: 6px;
  background: var(--tc-bg);
  color: var(--tc-primary-light);
  cursor: pointer;
  transition: all var(--tc-transition);
  padding: 0;
}

.tc-mapa-list__locate:hover {
  background: var(--tc-primary);
  color: #fff;
  border-color: var(--tc-primary);
}

.tc-mapa-list__meta {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: var(--tc-text-muted);
  line-height: 1.4;
  margin-bottom: 4px;
}

.tc-mapa-list__meta svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--tc-primary-light);
}

.tc-mapa-list__whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--tc-whatsapp);
  color: #ffffff !important;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none !important;
  transition:
    background var(--tc-transition),
    transform var(--tc-transition);
  cursor: pointer;
  border: none;
}

.tc-mapa-list__whatsapp:hover {
  background: var(--tc-whatsapp-hover);
  transform: translateY(-1px);
  color: #ffffff !important;
  text-decoration: none !important;
}

/* Empty list */
.tc-mapa-list__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 20px;
  text-align: center;
  color: var(--tc-text-muted);
  font-size: 14px;
}

.tc-mapa-list__empty p {
  margin: 0;
}

/* ── Right: Map Canvas ─────────────────────────────────── */
.tc-mapa-canvas-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}

.tc-mapa-canvas {
  width: 100%;
  height: 100%;
  min-height: var(--tc-map-height);
}

/* Google Maps InfoWindow customization */
.tc-infowindow {
  padding: 4px 0;
  min-width: 200px;
  max-width: 280px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tc-infowindow__image {
  width: 100%;
  height: 120px;
  margin-bottom: 12px;
  border-radius: var(--tc-radius-sm);
  overflow: hidden;
  background: var(--tc-bg);
}

.tc-infowindow__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tc-infowindow__title {
  font-size: 15px;
  font-weight: 700;
  color: #1a2744;
  margin: 0 0 6px;
  line-height: 1.3;
}

.tc-infowindow__meta {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 12px;
  color: #6b7a90;
  margin-bottom: 4px;
  line-height: 1.4;
}

.tc-infowindow__meta svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.tc-infowindow__whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 6px 12px;
  background: #25d366;
  color: #fff !important;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background 0.2s;
}

.tc-infowindow__whatsapp:hover {
  background: #1ebe5d;
  color: #fff !important;
}

/* ── Loading overlay ───────────────────────────────────── */
.tc-mapa-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--tc-radius);
  backdrop-filter: blur(2px);
}

/* Reuse spinner */
.tc-mapa-wrapper .tc-loading__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--tc-border);
  border-top-color: var(--tc-primary);
  border-radius: 50%;
  animation: tcSpin 0.7s linear infinite;
}

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

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .tc-mapa-sidebar {
    flex: 0 0 320px;
    width: 320px;
  }
}

@media (max-width: 768px) {
  .tc-mapa-layout {
    flex-direction: column-reverse;
    height: auto;
  }

  .tc-mapa-sidebar {
    flex: none;
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--tc-border);
  }

  .tc-mapa-list {
    max-height: 400px;
  }

  .tc-mapa-canvas-wrap {
    height: 400px;
  }

  .tc-mapa-canvas {
    min-height: 400px;
  }

  .tc-mapa-wrapper .tc-filters__inner {
    flex-direction: column;
  }

  .tc-mapa-wrapper .tc-filters__group {
    min-width: 100%;
  }

  .tc-mapa-wrapper .tc-filters {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .tc-mapa-canvas-wrap {
    height: 300px;
  }

  .tc-mapa-canvas {
    min-height: 300px;
  }

  .tc-mapa-list {
    max-height: 350px;
  }
}
