/* ============================================================
   Product Zone Map — Core Styles
   Map logic lives in zone-map-core.js and zone-map-core.css.
   Do not add platform-specific code to these files.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Playfair+Display:wght@400;600;700&display=swap');

/* ── RESET ─────────────────────────────────────────── */

:root {
  --ink:       #1a1a2e;
  --cream:     #f5f0e8;
  --gold:      #c9a84c;
  --country:   #1a3a4a;
  --border:    rgba(255, 255, 255, 0.35);
}

#zone-map-container {
  position: relative;
  width: 100%;
  height: 600px;
  background: #ffffff;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}

/* ── MAP ───────────────────────────────────────────── */

#zone-map-container .leaflet-container {
  background: #ffffff;
  font-family: 'DM Sans', sans-serif;
}

#zone-map-container .leaflet-control-attribution {
  display: none;
}

#zone-map-container .leaflet-control-zoom {
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#zone-map-container .leaflet-control-zoom a {
  background: rgba(26, 26, 46, 0.85);
  color: var(--cream);
  border: none;
  width: 32px;
  height: 32px;
  line-height: 32px;
  font-size: 16px;
  backdrop-filter: blur(8px);
}

#zone-map-container .leaflet-control-zoom a:hover {
  background: rgba(26, 26, 46, 1);
}

/* Push draw controls below header */
#zone-map-container .leaflet-top.leaflet-left {
  top: 70px;
}

/* ── ZONES ─────────────────────────────────────────── */

.zone-overlay-path {
  transition: fill-opacity 0.3s ease;
  filter: blur(4px);
}

/* Crisp edges in editor mode for precise polygon alignment */
.editor-active .zone-overlay-path {
  filter: none;
}

/* ── PROVINCE HOVER ────────────────────────────────── */

#zone-map-container .leaflet-interactive {
  cursor: pointer;
}

/* ── EDITOR VERTEX MARKERS ─────────────────────────── */

.leaflet-editing-icon {
  width: 8px !important;
  height: 8px !important;
  margin-left: -4px !important;
  margin-top: -4px !important;
  border-radius: 50% !important;
  background: var(--node-color, #ffffff) !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5) !important;
}

/* ── LABELS ────────────────────────────────────────── */

.province-label {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: #2d3748;
  font-family: 'Playfair Display', serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-shadow:
    -1px -1px 0 rgba(255,255,255,0.85),
     1px -1px 0 rgba(255,255,255,0.85),
    -1px  1px 0 rgba(255,255,255,0.85),
     1px  1px 0 rgba(255,255,255,0.85),
     0    0   4px rgba(255,255,255,0.6);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.province-label--callout {
  font-size: 11px;
  color: rgba(45, 55, 72, 0.85);
}

.province-label--editable {
  pointer-events: auto !important;
  cursor: grab;
}

.province-label--editable:active {
  cursor: grabbing;
}

/* ── HEADER ────────────────────────────────────────── */

.zone-map-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 28px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6) 0%, transparent 100%);
  pointer-events: none;
}

.zone-map-header__left h2 {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.zone-map-header__left p {
  margin: 4px 0 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  opacity: 0.7;
}

.zone-map-header__chip {
  background: rgba(26, 26, 46, 0.85);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

/* ── POPUP ─────────────────────────────────────────── */

.zone-popup .leaflet-popup-content-wrapper {
  background: rgba(20, 20, 38, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: none;
  border-radius: 12px;
  color: var(--cream);
  padding: 0;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.zone-popup .leaflet-popup-tip {
  background: rgba(20, 20, 38, 0.96);
  border: none;
}

.zone-popup .leaflet-popup-content {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
}

.zone-popup__link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px 10px 10px;
  text-decoration: none;
  color: var(--cream);
  cursor: pointer;
}

.zone-popup__link:hover {
  opacity: 0.9;
}

.zone-popup__thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}

.zone-popup__thumb--emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.zone-popup__info {
  flex: 1;
  min-width: 0;
}

.zone-popup__product-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zone-popup__region {
  font-size: 11px;
  opacity: 0.5;
  margin-top: 2px;
}

/* CTA removed — popup links directly to product */

/* ── LEGEND ────────────────────────────────────────── */

.zone-legend {
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.zone-legend__title {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(245, 240, 232, 0.5);
  margin-bottom: 8px;
}

.zone-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.zone-legend__item:hover {
  opacity: 0.8;
}

.zone-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.zone-legend__name {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--cream);
  white-space: nowrap;
}

/* ── TOAST ─────────────────────────────────────────── */

.zone-toast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 24px;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.zone-toast--hidden {
  opacity: 0;
}

.zone-scroll-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 10px;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

/* ── EDITOR ────────────────────────────────────────── */

.zone-editor-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.zone-editor-list-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.zone-editor-list-item.selected {
  background: rgba(201, 168, 76, 0.15);
  outline: 1px solid rgba(201, 168, 76, 0.3);
}

.zone-editor-list-item--add {
  border: 1px dashed rgba(255, 255, 255, 0.12);
  margin-top: 6px;
}

.zone-editor-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  z-index: 1001;
  background: rgba(20, 20, 38, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid rgba(201, 168, 76, 0.15);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  display: none;
  box-sizing: border-box;
}

.zone-editor-panel.active {
  display: block;
}

.zone-editor-panel__scroll {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 72px;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

.zone-editor-panel__footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(20, 20, 38, 0.99);
  box-sizing: border-box;
}

/* When editor is active, constrain header to not overlap panel */
.zone-editor-panel.active ~ .zone-map-header,
.zone-map-header.editor-active {
  right: 330px;
}

.zone-editor-panel h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  margin: 0 0 16px;
  color: var(--gold);
}

.zone-editor-panel label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(245, 240, 232, 0.5);
  margin-bottom: 4px;
  margin-top: 12px;
}

.zone-editor-panel input,
.zone-editor-panel select,
.zone-editor-panel textarea {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  box-sizing: border-box;
}

.zone-editor-panel input:focus,
.zone-editor-panel select:focus,
.zone-editor-panel textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.zone-editor-panel input[type="color"] {
  padding: 2px;
  height: 36px;
  cursor: pointer;
}

.zone-editor-panel textarea {
  resize: vertical;
  min-height: 60px;
}

.zone-editor-panel__actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.zone-editor-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.zone-editor-btn:hover {
  opacity: 0.85;
}

.zone-editor-btn--save {
  background: var(--gold);
  color: var(--ink);
}

.zone-editor-btn--copy {
  background: rgba(255, 255, 255, 0.1);
  color: var(--cream);
}

.zone-editor-btn--delete {
  background: #c0392b;
  color: #fff;
}

.zone-editor-btn--new {
  background: rgba(42, 157, 143, 0.8);
  color: #fff;
}

.zone-editor-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: rgba(26, 26, 46, 0.95);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 10px 24px;
  border-radius: 8px;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

/* ── MOBILE ────────────────────────────────────────── */

@media (max-width: 640px) {
  #zone-map-container {
    height: 100svh;
  }

  .zone-map-header {
    padding: 16px 18px;
  }

  .zone-map-header__left h2 {
    font-size: 18px;
  }

  .zone-map-header__left p {
    font-size: 11px;
  }

  .zone-legend {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 16px 16px 0 0;
    padding: 12px 18px 20px;
    max-height: 40vh;
    overflow-y: auto;
    z-index: 1000;
  }

  .zone-legend__drag-handle {
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 0 auto 10px;
  }

  .zone-popup .leaflet-popup-content {
    width: 220px !important;
  }

  .zone-editor-panel {
    width: 100%;
    height: 50%;
    top: auto;
    bottom: 0;
    border-left: none;
    border-top: 1px solid rgba(201, 168, 76, 0.15);
    border-radius: 16px 16px 0 0;
  }

  .province-label {
    font-size: 9px;
  }

  .province-label--callout {
    font-size: 9px;
  }
}
