/**
 * Frontend Stylesheet for K-Tech Store Map
 * Thiết kế giao diện section hệ thống cửa hàng chuẩn theo thiết kế.
 */

:root {
  --km-red: #dc2626;
  --km-red-hover: #b91c1c;
  --km-blue: #2563eb;
  --km-blue-hover: #1d4ed8;
  --km-dark: #1e293b;
  --km-header-gray: #52525b;
  --km-border: #e5e7eb;
  --km-border-input: #d1d5db;
  --km-bg-container: #F6F4F4;
  --km-text-main: #374151;
  --km-text-meta: #4b5563;
  --km-text-light: #9ca3af;
  --km-radius-container: 20px;
  --km-radius-card: 6px;
  --km-radius-input: 8px;
}

/* ================= CONTAINER SECTION ================= */
.ktech-map-section {
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.ktech-map-container {
  background-color: var(--km-bg-container);
  border-radius: var(--km-radius-container);
  padding: 20px;
  box-sizing: border-box;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  max-width: 1200px;
  margin: 0 auto;
}

/* Tiêu đề chính */
.kml-section-title {
  text-align: center;
  font-size: 42px;
  font-weight: 500;
  color: var(--km-dark);
  margin: 0 0 40px 0;
  line-height: 1.35;
  font-family: inherit;
}

/* ================= BỘ LỌC 3 CỘT ================= */
.kml-filter-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.kml-filter-col {
  width: 100%;
}

.kml-control {
  width: 100%;
  height: 40px;
  line-height: 40px;
  background-color: #ffffff;
  border: 1px solid var(--km-border-input);
  border-radius: var(--km-radius-input) !important;
  padding: 0 14px;
  font-size: 14px;
  color: var(--km-text-main);
  box-sizing: border-box;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.kml-control:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15);
}

.kml-search-input::placeholder {
  color: #9ca3af;
}

/* Custom Dropdown Select */
.kml-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 15px;
  padding-right: 36px;
}

.kml-select:disabled {
  background-color: #f1f5f9;
  color: #94a3af;
  cursor: not-allowed;
  opacity: 0.8;
}

/* ================= MAIN LAYOUT (DANH SÁCH & BẢN ĐỒ) ================= */
.kml-main-layout {
  display: flex;
  gap: 20px;
  align-items: stretch;
}

/* Cột danh sách (Trái) */
.kml-list-col {
  flex: 0 0 390px;
  width: 390px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Header xám đen trên danh sách */
.kml-list-header {
  background-color: var(--km-header-gray);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px;
  box-sizing: border-box;
  line-height: 1.4;
}

.kml-store-count {
  font-weight: 700;
}

/* Container cuộn danh sách */
.kml-store-list {
  background-color: #ffffff;
  border: 1px solid var(--km-border);
  border-top: none;
  height: 520px;
  max-height: 520px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Thanh cuộn mảnh thanh lịch */
.kml-store-list::-webkit-scrollbar {
  width: 6px;
}

.kml-store-list::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.kml-store-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.kml-store-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Thẻ Cửa hàng */
.ktech-local-items {
  padding: 14px 16px;
  border-bottom: 1px solid var(--km-border);
  background-color: #ffffff;
  cursor: pointer;
  transition: background-color 0.15s ease, border-left-color 0.15s ease;
  position: relative;
  text-align: left;
  outline: none;
}

.ktech-local-items:last-child {
  border-bottom: none;
}

.ktech-local-items:hover {
  background-color: #f9fafb;
}

/* Trạng thái Active khi được chọn */
.ktech-local-items.active {
  background-color: #fff9f9;
  padding-left: 12px;
}

/* Tiêu đề cửa hàng màu đỏ */
.kml-card-title {
  color: var(--e-global-color-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 6px 0;
  word-break: break-word;
  font-family: inherit;
}

/* Dòng meta thông tin (giờ mở cửa, sđt) */
.kml-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--km-text-meta);
  margin-bottom: 4px;
}

.kml-meta-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--km-text-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kml-meta-icon svg,
.kml-meta-icon img {
  width: 15px;
  height: 15px;
  display: block;
  object-fit: contain;
}

.kml-meta-val {
  color: var(--km-text-meta);
  line-height: 1.35;
}

/* Hàng liên kết hành động: Gọi điện | Chat Zalo | Xem bản đồ */
.kml-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
}

.kml-card-link {
  color: var(--km-blue);
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.15s ease;
  line-height: 1.3;
}

.kml-card-link:hover {
  color: var(--km-blue-hover);
}

.kml-card-sep {
  color: var(--km-text-light);
  font-size: 12px;
  user-select: none;
}

/* Cột bản đồ (Phải) */
.kml-map-col {
  flex: 1;
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

.kml-map-box {
  width: 100%;
  height: 100%;
  min-height: 560px;
  background-color: #e5e7eb;
  border: 1px solid var(--km-border);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Trạng thái trống */
.kml-empty,
.kml-map__empty {
  color: #64748b;
  font-size: 14px;
  text-align: center;
  padding: 30px 16px;
}

/* ================= RESPONSIVE ================= */
@media only screen and (max-width: 991px) {
  .kml-main-layout {
    flex-direction: column;
  }

  .kml-list-col {
    width: 100%;
    flex: none;
  }

  .kml-store-list {
    height: 380px;
    max-height: 380px;
  }

  .kml-map-col,
  .kml-map-box,
  .kml-map-box iframe {
    min-height: 420px !important;
    height: 420px !important;
  }
}

@media only screen and (max-width: 767px) {
  .ktech-map-container {
    padding: 24px 16px;
    border-radius: 14px;
  }

  .kml-section-title {
    font-size: 22px;
    margin-bottom: 18px;
  }

  .kml-filter-bar {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .kml-control {
    height: 42px;
    line-height: 40px;
    font-size: 13px;
  }

  .kml-store-list {
    height: 320px;
    max-height: 320px;
  }

  .kml-map-col,
  .kml-map-box,
  .kml-map-box iframe {
    min-height: 340px !important;
    height: 340px !important;
  }
}