/* CF Harta Clubul Familiei — style.css v1.5.1 */

/* ── Container responsive ──────────────────────────────────────────────── */
.cf-harta-wrapper {
  width: 100%;
  position: relative;
}

.cf-harta-canvas {
  width: 100%;
  height: 600px;
  position: relative;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  /* touch-action implicit: permite scroll vertical pe pagină (P1#7) */
  touch-action: pan-y;
}

/* Când pan/pinch activ — blochează toate gesturile native (P1#7) */
.cf-harta-canvas.is-active {
  touch-action: none;
}

.cf-harta-canvas svg {
  width: 100%;
  height: 100%;
  display: block;
  /* SVG-ul moștenește touch-action de la canvas; nu blocăm global */
  touch-action: inherit;
}

/* ── Loading / Error ────────────────────────────────────────────────────── */
.cf-harta-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 500 16px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #666;
}

/* ── Județe (P2#25 — specificitate prin descendent, fără !important flood) */
.cf-harta-canvas svg .cf-county {
  fill: #0fa9a3;
  stroke: #0a8f8a;
  stroke-width: 1;
  cursor: pointer;
  transition: fill 0.15s ease, stroke-width 0.15s ease;
}

.cf-harta-canvas svg .cf-county:hover {
  fill: #0cc1b9;
  stroke-width: 1.5;
}

/* Județe fără grădinițe înregistrate — subton turcoaz desaturat */
.cf-harta-canvas svg .cf-county.cf-county--empty {
  fill: #87c4be;
  stroke: #5bb5ad;
}

.cf-harta-canvas svg .cf-county.cf-county--empty:hover {
  fill: #5bb5ad;
}

/* Reduced motion — dezactivare tranziție hover (P2#CSS-7) */
@media (prefers-reduced-motion: reduce) {
  .cf-harta-canvas svg .cf-county {
    transition: none;
  }
}

/* Focus vizibil pe paths interactive (A11y) */
.cf-harta-canvas svg .cf-county:focus-visible {
  outline: 3px solid #0fa9a3;
  outline-offset: 2px;
}

/* ── Etichete județe (prescurtări) ─────────────────────────────────────── */
.cf-county-label {
  pointer-events: none;
  font: 700 12px/1 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  fill: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* ── Popup — position: fixed, mai robust pe scroll (P1#4, P2#26) ────────── */
.cf-popup {
  position: fixed;
  min-width: 280px;
  max-width: 420px;
  max-height: 70vh;
  overflow: hidden; /* scroll gestionat de .content */
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 0;
  z-index: 9999;
  display: none;
  /* flex layout — header fix + body scroll (P2#26) */
  flex-direction: column;
}

/* Header popup cu buton close aliniat dreapta (P2#26) */
.cf-popup-header {
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px 0;
  flex-shrink: 0;
}

/* Buton close ca element interactiv real (P1#8) */
.cf-popup .close {
  background: #f0f0f0;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: #333;
  /* Focus vizibil */
  outline-offset: 2px;
}

.cf-popup .close:hover {
  background: #e0e0e0;
}

.cf-popup .close:focus-visible {
  outline: 3px solid #0fa9a3;
}

/* Conținut scrollabil al popup-ului */
.cf-popup .content {
  overflow: auto;
  padding: 4px 16px 12px;
  flex: 1 1 auto;
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.cf-popup h3 {
  margin: 0.25rem 0 0.5rem;
  font-size: 16px;
  font-weight: 700;
}

/* Card-style block pentru fiecare unitate — separare clară când sunt mai multe */
.cf-popup .item {
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: #fafafa;
  border-left: 3px solid #f05b40;
  border-radius: 6px;
}

.cf-popup .item:last-child {
  margin-bottom: 0;
}

.cf-popup .loc {
  font-weight: 700;
  font-size: 1.05em;
  color: #0a8f8a;
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.cf-popup .fld {
  margin-bottom: 0.3rem;
  line-height: 1.45;
}

.cf-popup .fld:last-child {
  margin-bottom: 0;
}

/* Label colorat distinct (#f05b40) — face câmpurile ușor de identificat */
.cf-popup .fld .lbl {
  font-weight: 700;
  color: #f05b40;
}

.cf-popup .fld.unit { color: #111827; }
.cf-popup .fld.edu { color: #374151; }

/* ── Mobil — popup full-screen modal (peste GDPR / WCAG widgets) ───────── */
@media (max-width: 768px) {
  .cf-popup {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    transform: none !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
    /* permite scroll touch în interior */
    touch-action: pan-y;
  }
  .cf-popup .content {
    padding: 8px 20px 24px;
    font-size: 15px;
  }
  .cf-popup h3 {
    font-size: 20px;
    padding: 4px 0 8px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
  }
  .cf-popup-header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    padding: 12px 16px 4px;
  }
  .cf-popup .close {
    padding: 10px 14px;
    font-size: 18px;
  }
}

/* Body scroll lock când popup full-screen e activ pe mobil */
@media (max-width: 768px) {
  body.cf-harta-popup-open {
    overflow: hidden;
  }
}

/* ── Reset View button (top-right, circular 36×36) ─────────────────────── */
.cf-reset-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  background: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  user-select: none;
  outline-offset: 2px;
}

.cf-reset-btn:hover {
  background: #f0f0f0;
}

.cf-reset-btn:focus-visible {
  outline: 3px solid #0fa9a3;
}
