/* ==========================================================================
   Component: Map (.mc-map-wrapper)
   ========================================================================== */

.mc-map-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  isolation: isolate;
}

/* Biến thể Fill trọn vẹn 100% cột / container */
.mc-map-wrapper.mc-map--fill {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.mc-map-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  z-index: 1;
}

.mc-map-canvas iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: none;
}

/* ==========================================================================
   Floating Info Card (Thẻ thông tin góc trên bên phải)
   Border, border-radius và background được giữ đồng nhất ở cả 2 trạng thái
   ========================================================================== */

.mc-map__info-card {
  position: absolute;
  top: 16px;
  right: 16px;
  left: auto;
  z-index: 10;
  width: 320px;
  max-width: calc(100% - 32px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  color: #0f172a;
  box-sizing: border-box;
}

.mc-map__info-card:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

/* Tùy chỉnh vị trí nếu có thuộc tính info_position */
.mc-map-wrapper.has-pos-top-left .mc-map__info-card {
  top: 16px;
  left: 16px;
  right: auto;
}
.mc-map-wrapper.has-pos-top-right .mc-map__info-card {
  top: 16px;
  right: 16px;
  left: auto;
}
.mc-map-wrapper.has-pos-bottom-right .mc-map__info-card {
  bottom: 16px;
  right: 16px;
  top: auto;
  left: auto;
}
.mc-map-wrapper.has-pos-bottom-left .mc-map__info-card {
  bottom: 16px;
  left: 16px;
  top: auto;
  right: auto;
}

/* ==========================================================================
   Header: Chỉ chứa Tiêu đề và Nút thu nhỏ/mở rộng, căn giữa hoàn hảo
   ========================================================================== */

.mc-map__info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.mc-map__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mc-map__title-pin {
  font-size: 14px;
  flex-shrink: 0;
}

.mc-map__toggle-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.mc-map__toggle-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Icon mũi tên xoay đơn giản khi đóng/mở */
.mc-map__toggle-chevron {
  transition: transform 0.25s ease;
  transform: rotate(180deg);
}

/* ==========================================================================
   Collapsible Wrapper (Đóng mở đơn giản, không biến đổi hình dạng card)
   ========================================================================== */

.mc-map__info-collapsible-wrapper {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.25s ease;
}

.mc-map__info-content {
  min-height: 0;
  overflow: hidden;
}

/* Trạng thái thu nhỏ (Collapsed): Chỉ đóng nội dung, giữ nguyên border và form card */
.mc-map__info-card.is-collapsed .mc-map__toggle-chevron {
  transform: rotate(0deg);
}

.mc-map__info-card.is-collapsed .mc-map__info-collapsible-wrapper {
  grid-template-rows: 0fr;
}

/* ==========================================================================
   Chi tiết nội dung bên trong Card
   ========================================================================== */

.mc-map__meta-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mc-map__badge {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-radius: 5px;
  background: #ecfdf5;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.mc-map__subtitle {
  margin: 0 0 10px 0;
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.4;
}

.mc-map__info-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.mc-map__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.4;
}

.mc-map__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #15803d;
  margin-top: 1px;
}

.mc-map__icon svg {
  width: 13px;
  height: 13px;
}

.mc-map__text {
  display: flex;
  flex-direction: column;
}

.mc-map__label {
  font-size: 10.5px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}

.mc-map__val {
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 500;
  word-break: break-word;
}

.mc-map__link {
  color: #0ea5e9;
  text-decoration: none;
  transition: color 0.2s ease;
}

.mc-map__link:hover {
  color: #15803d;
  text-decoration: underline;
}

/* Footer Buttons */
.mc-map__info-footer {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mc-map__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  box-sizing: border-box;
}

.mc-map__btn--primary {
  flex: 1;
  background: #24a148;
  color: #ffffff;
}

.mc-map__btn--primary:hover {
  background: #1f8b3d;
  color: #ffffff;
  transform: translateY(-1px);
}

.mc-map__btn--copy {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.mc-map__btn--copy:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.mc-map__btn--copy.is-copied {
  background: #ecfdf5;
  color: #15803d;
  border-color: #86efac;
}

/* ==========================================================================
   Huy hiệu khẳng định chủ quyền Biển đảo Việt Nam (Hoàng Sa & Trường Sa)
   Đặt ở góc DƯỚI BÊN TRÁI cân đối
   ========================================================================== */

.mc-map__sovereignty-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: auto;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  font-size: 11px;
  color: #475569;
  pointer-events: auto;
  user-select: none;
  transition: all 0.2s ease;
}

.mc-map__sovereignty-badge:hover {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.mc-map__flag {
  font-size: 14px;
  line-height: 1;
}

.mc-map__sovereignty-label strong {
  color: #0f172a;
  font-weight: 600;
}

/* ==========================================================================
   Dark Theme Support
   ========================================================================== */

.dark .mc-map-wrapper,
[data-theme="dark"] .mc-map-wrapper {
  border-color: rgba(255, 255, 255, 0.1);
  background-color: #0b1220;
}

.dark .mc-map__info-card,
[data-theme="dark"] .mc-map__info-card {
  background: rgba(11, 18, 32, 0.92);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.dark .mc-map__title,
[data-theme="dark"] .mc-map__title {
  color: #ffffff;
}

.dark .mc-map__val,
[data-theme="dark"] .mc-map__val {
  color: #e2e8f0;
}

.dark .mc-map__icon,
[data-theme="dark"] .mc-map__icon {
  background: rgba(255, 255, 255, 0.06);
  color: #4ade80;
}

.dark .mc-map__meta-row,
[data-theme="dark"] .mc-map__meta-row {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.dark .mc-map__btn--copy,
[data-theme="dark"] .mc-map__btn--copy {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .mc-map__toggle-btn,
[data-theme="dark"] .mc-map__toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.dark .mc-map__sovereignty-badge,
[data-theme="dark"] .mc-map__sovereignty-badge {
  background: rgba(11, 18, 32, 0.88);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

.dark .mc-map__sovereignty-label strong,
[data-theme="dark"] .mc-map__sovereignty-label strong {
  color: #ffffff;
}

/* ==========================================================================
   Responsive (Mobile & Tablet)
   ========================================================================== */

@media (max-width: 640px) {
  .mc-map__info-card {
    top: 10px;
    right: 10px;
    left: auto;
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
    padding: 12px;
  }

  .mc-map__sovereignty-badge {
    bottom: 8px;
    left: 8px;
    font-size: 10px;
    padding: 3px 8px;
  }
}
