/**
 * Frontend Stylesheet for K-Tech Store Map
 * Bảng màu đồng bộ Flatsome: --fs-color-primary, --fs-color-secondary,
 * --fs-color-alert, --fs-color-success, #fff, #000.
 */

.ktech-map-wrap {
  --km-primary: var(--fs-color-primary);
  --km-secondary: var(--fs-color-secondary);
  --km-alert: var(--fs-color-primary);
  --km-success: var(--fs-color-success);
  --km-white: #fff;
  --km-black: #000;
  --km-height: 500px;

  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.ktech-map-heading {
  margin: 0 0 32px;
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--km-primary);
}

/* Bố cục 2 cột: Trái danh sách vùng, Phải bản đồ */
.ktech-map-layout {
  display: grid;
  grid-template-columns: minmax(320px, 37%) 1fr;
  gap: 16px;
  align-items: stretch;
}

/* ========== CỘT TRÁI: TAB VÙNG & SHOWROOM CARDS ========== */
.ktech-map-sidebar {
  display: flex;
  flex-direction: column;
  height: var(--km-height);
  padding: 12px;
  background-color: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  box-sizing: border-box;
}

/* Thanh Tab phân vùng */
.ktech-map-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  flex-shrink: 0;
  margin-bottom: 10px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.04);
  scrollbar-width: none;
}

.ktech-map-tabs::-webkit-scrollbar {
  display: none;
}

.ktech-map-tab {
  flex: 1 0 auto;
  min-width: 0;
  margin: 0 !important;
  padding: 11px 14px;
  border: 0;
  border-radius: 3px;
  background-color: transparent;
  color: var(--km-black);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ktech-map-tab:hover:not(.is-active) {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--km-black);
}

.ktech-map-tab.is-active {
  background-color: var(--km-alert);
  color: var(--km-white);
}

.ktech-map-tab:focus-visible {
  outline: 2px solid var(--km-alert);
  outline-offset: -2px;
}

/* Danh sách Showroom trong Tab */
.ktech-map-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ktech-map-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 6px 4px 2px;
  box-sizing: border-box;
}

.ktech-map-panel.is-active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ktech-map-panel::-webkit-scrollbar {
  width: 6px;
}

.ktech-map-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 99px;
}

.ktech-map-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.24);
  border-radius: 99px;
}

.ktech-map-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.4);
}

/* Thẻ Showroom (Card) */
.ktech-local-items {
  background-color: var(--km-white);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.ktech-local-items:hover {
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ktech-local-items.active {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.ktech-local-items:focus-visible {
  outline: 2px solid var(--km-alert);
  outline-offset: 1px;
}

.ktech-local-items .local-items-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.local-items-thumb {
  width: 76px;
  height: 76px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background-color: var(--km-white);
}

.local-items-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.local-items-content {
  flex: 1;
  min-width: 0;
}

.local-content-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.38;
  text-transform: uppercase;
  color: var(--km-black);
  transition: color 0.2s ease;
}

.ktech-local-items.active .local-content-title,
.ktech-local-items:hover .local-content-title {
  color: var(--km-alert);
}

/* Dòng thông tin (Địa chỉ, Hotline & thông tin tùy chọn) */
.local-content-meta {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 5px 0;
  font-size: 14px;
  width: max-content;
  line-height: 1.45;
  color: rgba(0, 0, 0, 0.72);
}

.local-content-meta .km-meta-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  color: rgba(0, 0, 0, 0.58);
}

.local-content-meta .km-meta-icon svg,
.local-content-meta .km-meta-icon img,
.local-content-meta .km-meta-icon .km-field-icon {
  width: 15px;
  height: 15px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.local-content-meta .local-meta-txt {
  flex: 1;
  min-width: 0;
  color: rgba(0, 0, 0, 0.78);
  word-break: break-word;
}

.local-content-meta .local-meta-link {
  color: rgba(0, 0, 0, 0.85);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.local-content-meta .local-meta-link:hover {
  color: var(--km-primary);
  text-decoration: underline;
}

/* Link Dẫn đường > */
.local-items-direction {
  margin-top: 8px;
}

.ktech-map-direction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--km-alert);
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.ktech-map-direction>span:not(.ktech-map-direction__arrow) {
  text-decoration: underline;
}

.ktech-map-direction__arrow {
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.ktech-map-direction:hover {
  color: var(--km-primary);
}

.ktech-map-direction:hover .ktech-map-direction__arrow {
  transform: translateX(2px);
}

/* ========== CỘT PHẢI: KHUNG GOOGLE MAPS ========== */
.ktech-map-viewer {
  min-width: 0;
}

.ktech-map-card {
  background-color: var(--km-white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
  box-sizing: border-box;
}

.kml-map {
  height: var(--km-height);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-color: rgba(0, 0, 0, 0.03);
}

.kml-map iframe {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

.kml-map__empty,
.kml-empty {
  padding: 36px 20px;
  text-align: center;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.55);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .ktech-map-layout {
    grid-template-columns: 1fr;
  }

  .ktech-map-sidebar {
    height: auto;
    max-height: 460px;
  }

  .kml-map {
    height: 380px;
  }
}

@media (max-width: 549px) {
  .ktech-map-heading {
    font-size: 22px;
    margin-bottom: 14px;
  }

  .ktech-map-sidebar {
    padding: 10px;
  }

  .ktech-map-tab {
    padding: 9px 10px;
    font-size: 13px;
  }

  .kml-map {
    height: 320px;
  }
}