:root {
  --bg-dark: #0f172a;
  --bg-panel: rgba(255, 255, 255, 0.96);
  --border-soft: rgba(15, 23, 42, 0.12);
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent-1896: #dc2626;
  --accent-gard: #ea580c;
  --accent-2026: #059669;
  --accent-b26: #1e40af;
  --accent-blue: #2563eb;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-main);
  overflow: hidden;
  background: #f8fafc;
}

/* Map area (stilurile antetului sunt în /assets/css/istorie-topbar.css) */
#map {
  position: fixed;
  top: 54px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  background: #f8fafc;
}

#map.bg-blank .leaflet-tile-pane {
  opacity: 0 !important;
}

#map.bg-light-osm .leaflet-tile-pane {
  opacity: 0.44;
  filter: saturate(0.45) contrast(0.95) brightness(1.04);
}

/* Swipe curtain */
.curtain-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  transform: translateX(-50%);
  background: transparent;
  z-index: 800;
  cursor: ew-resize;
  display: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}

.curtain-handle::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  background: #0f172a;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.78);
  pointer-events: none;
}

.curtain-handle.active {
  display: block;
}

.curtain-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0f172a;
  color: #fff;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.35);
  font-size: 1.1rem;
  touch-action: none;
  transition: top 0.25s ease, transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

body.has-user-locate .curtain-knob {
  top: clamp(200px, 32%, 240px);
}

.curtain-knob::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
}

.curtain-handle.dragging .curtain-knob,
.curtain-handle:focus-visible .curtain-knob {
  transform: translate(-50%, -50%) scale(1.1);
  background: #2563eb;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.24), 0 6px 18px rgba(15, 23, 42, 0.35);
}

.curtain-label {
  position: absolute;
  top: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.curtain-label-left {
  right: calc(50% + 12px);
  background: #dc2626;
  color: #fff;
}

.curtain-label-right {
  left: calc(50% + 12px);
  background: #059669;
  color: #fff;
}

/* Sidebar Drawer */
.sidebar {
  position: fixed;
  top: 66px;
  left: 12px;
  width: 390px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 80px);
  background: var(--bg-panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.22s ease;
}

.sidebar.collapsed {
  transform: translateX(calc(-100% - 20px));
}

.sidebar-toggle-fab {
  position: fixed;
  top: 66px;
  left: 12px;
  z-index: 1040;
  background: var(--bg-dark);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px 13px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 6px;
}

.sidebar.collapsed + .sidebar-toggle-fab {
  display: inline-flex;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 0 12px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(248, 250, 252, 0.8);
}

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.04);
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background: #fff;
}

.collapse-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
  padding: 0;
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-main);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.collapse-btn:hover {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.24);
  color: var(--text-main);
}

.sidebar-body {
  padding: 12px 14px 16px;
  overflow-y: auto;
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Metrics & cards */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.kpi-box {
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 10px;
}

.kpi-val {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
}

.kpi-lbl {
  font-size: 0.71rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.method-note {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 0.76rem;
  line-height: 1.45;
  margin-bottom: 12px;
}

.method-credits-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 800;
  color: #b45309;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(217, 119, 6, 0.45);
  text-underline-offset: 2px;
}

.method-credits-link:hover {
  color: #92400e;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.filter-pill {
  border: 1px solid var(--border-soft);
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.filter-pill.active {
  background: var(--bg-dark);
  color: #fff;
  border-color: var(--bg-dark);
}

.reper-card {
  border: 1px solid var(--border-soft);
  background: #fff;
  border-radius: 10px;
  padding: 10px 11px;
  margin-bottom: 9px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.reper-card:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.reper-card.active {
  border-color: var(--accent-blue);
  background: #eff6ff;
}

.reper-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.reper-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.reper-badge {
  font-size: 0.66rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-cladiri {
  background: #fee2e2;
  color: #991b1b;
}

.badge-limite {
  background: #ffedd5;
  color: #9a3412;
}

.badge-transform {
  background: #e2e8f0;
  color: #334155;
}

.reper-sub {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 5px;
}

.reper-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.42;
}

/* Controls & Layers */
.section-title {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
  margin: 12px 0 6px;
  letter-spacing: 0.01em;
}

.section-title:first-child {
  margin-top: 0;
}

.control-group {
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 10px;
}

.layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.8rem;
}

.layer-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  flex-shrink: 0;
}

.swatch-line {
  width: 16px;
  height: 4px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.range-row {
  margin-bottom: 9px;
}

.range-row:last-child {
  margin-bottom: 0;
}

.range-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.range-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-controls input[type="range"] {
  flex: 1;
  accent-color: var(--accent-blue);
}

.nudge-btn {
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
}

.nudge-btn:hover {
  background: #e2e8f0;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-btn {
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.action-btn:hover {
  background: #f1f5f9;
}

.action-btn.primary {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

.action-btn.primary:hover {
  background: #1d4ed8;
}

.action-btn.active-mode {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.seg-group {
  display: flex;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--bg-dark);
  color: #fff;
}

.pin-banner {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  background: #dc2626;
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(220, 38, 38, 0.35);
  display: none;
  align-items: center;
  gap: 10px;
}

.pin-banner.active {
  display: flex;
}

.pin-list {
  max-height: 190px;
  overflow-y: auto;
  margin-top: 8px;
}

.pin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  gap: 6px;
}

.pin-del {
  border: none;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

/* 1896 Map Labels */
.lbl-1896 {
  background: rgba(255, 251, 235, 0.9);
  border: 1px solid rgba(180, 83, 9, 0.45);
  color: #7c2d12;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.lbl-1896.apa {
  background: rgba(224, 242, 254, 0.92);
  border-color: rgba(2, 132, 199, 0.45);
  color: #0369a1;
}

/* Loading overlay */
.loading-mask {
  position: fixed;
  inset: 54px 0 0 0;
  background: rgba(248, 250, 252, 0.92);
  z-index: 1150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  color: var(--text-main);
}

.loading-mask.hidden {
  display: none;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #cbd5e1;
  border-top-color: #dc2626;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Bottom-right controls: photo layer toggle + collapsible legend */
.map-bottom-right {
  position: fixed;
  bottom: 24px;
  right: 14px;
  z-index: 960;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
}

.foto-toggle-btn {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(8px);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.foto-toggle-btn i {
  color: #d97706;
  font-size: 0.95rem;
}

.foto-toggle-btn:hover {
  background: #fff;
  border-color: rgba(217, 119, 6, 0.45);
}

.foto-toggle-btn.is-active {
  background: #0b162c;
  color: #fff;
  border-color: #d97706;
}

.foto-toggle-btn.is-active i {
  color: #f59e0b;
}

.foto-toggle-btn.is-active:hover {
  background: #162544;
}

.foto-toggle-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.67rem;
  font-weight: 800;
}

.foto-toggle-btn.is-active .foto-toggle-count {
  background: #d97706;
  color: #fff;
}

.legend-wrap {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 6px;
}

.legend-toggle-btn {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(8px);
}

.legend-toggle-btn:hover {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.24);
}

.legend-chevron {
  transition: transform 0.18s ease;
}

.legend-wrap:not(.collapsed) .legend-chevron {
  transform: rotate(180deg);
}

.map-legend {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.73rem;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: calc(100vw - 28px);
}

.legend-wrap.collapsed .map-legend {
  display: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

@media (max-width: 900px) {
  .sidebar {
    width: calc(100vw - 24px);
    max-height: 55vh;
    top: auto;
    bottom: 12px;
    left: 12px;
  }
  .sidebar.collapsed {
    transform: translateY(calc(100% + 24px));
  }
  .sidebar-toggle-fab {
    top: auto;
    bottom: 24px;
    left: 12px;
  }
  .map-bottom-right {
    bottom: 24px;
    right: 12px;
  }
  .map-legend {
    padding: 8px 10px;
    font-size: 0.7rem;
  }
}

@media (max-width: 560px) {
  .map-bottom-right {
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 6px;
  }
}

@media (pointer: coarse), (max-width: 1024px) {
  .curtain-handle {
    width: 34px;
  }
  .curtain-knob {
    width: 52px;
    height: 52px;
    font-size: 1.25rem;
  }
  .curtain-knob::after {
    inset: -14px;
  }
  .curtain-label {
    top: 10px;
    padding: 3px 8px;
    font-size: 0.68rem;
  }
  .collapse-btn {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
  }
}

/* Etichete 1896 din zone fara puncte de control (pozitie neconfirmata) */
.lbl-1896.nec {
  opacity: 0.5;
  font-style: italic;
}

/* --- Fotografii istorice: badge tab, swatch, filtru & carduri sidebar --- */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.65rem;
  font-weight: 800;
}

.tab-btn.active .tab-badge {
  background: #d97706;
  color: #fff;
}

.swatch-foto {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0b162c;
  color: #f59e0b;
  border: 1.5px solid #d97706;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  flex-shrink: 0;
}

.foto-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 8px;
}

.sidebar-credits-strip {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 9px;
  padding: 6px 9px;
  margin-bottom: 10px;
  font-size: 0.72rem;
  line-height: 1.38;
  color: #78350f;
}

.sidebar-credits-strip i {
  color: #d97706;
  font-size: 0.88rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.sidebar-credits-btn {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 800;
  color: #b45309;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(217, 119, 6, 0.45);
  text-underline-offset: 2px;
  text-align: left;
}

.sidebar-credits-btn:hover {
  color: #92400e;
}

.foto-select,
.foto-search {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--text-main);
  background: #fff;
}

.foto-select:focus,
.foto-search:focus {
  outline: none;
  border-color: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.16);
}

.foto-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.foto-empty-state {
  text-align: center;
  padding: 20px 14px;
  background: #fffbeb;
  border: 1px dashed #f59e0b;
  border-radius: 10px;
  color: #78350f;
  font-size: 0.78rem;
  line-height: 1.48;
}

.foto-empty-state i {
  font-size: 1.5rem;
  color: #d97706;
  display: block;
  margin-bottom: 6px;
}

.foto-empty-state p {
  margin: 0;
}

.foto-side-card {
  display: flex;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.foto-side-card:hover {
  border-color: #d97706;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.12);
}

.foto-side-card.active {
  border-color: #d97706;
  background: #fffbeb;
}

.foto-side-thumb-wrap {
  width: 74px;
  height: 56px;
  border-radius: 7px;
  overflow: hidden;
  background: #0b162c;
  flex-shrink: 0;
}

.foto-side-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.foto-side-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.foto-side-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foto-side-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.foto-side-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}

.foto-dir-chip {
  font-size: 0.69rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.foto-open-btn {
  border: 1px solid #d97706;
  background: #d97706;
  color: #fff;
  font-family: inherit;
  font-size: 0.69rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.foto-open-btn:hover {
  background: #b45309;
}

/* --- Pini direcționali pe hartă & tooltip hover --- */
.foto-divicon {
  background: transparent;
  border: none;
}

.foto-pin-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.14s ease;
}

@media (hover: hover) and (pointer: fine) {
  .foto-pin-wrap:hover {
    transform: scale(1.16);
  }
}

.foto-pin-wrap.active {
  transform: scale(1.16);
}

.foto-pin-dir {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.foto-pin-dir span {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5.5px solid transparent;
  border-right: 5.5px solid transparent;
  border-bottom: 10px solid #d97706;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.foto-pin-wrap.active .foto-pin-dir span {
  border-bottom-color: #ef3e3e;
}

.foto-pin-core {
  position: relative;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0b162c;
  color: #f59e0b;
  border: 2px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  box-shadow: 0 3px 9px rgba(11, 22, 44, 0.45);
}

.foto-pin-wrap.active .foto-pin-core {
  background: #d97706;
  color: #fff;
  border-color: #fff;
}

.foto-cluster {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0b162c 0%, #1e293b 100%);
  border: 2.5px solid #f59e0b;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(11, 22, 44, 0.45);
  cursor: pointer;
}

.foto-cluster i {
  font-size: 0.72rem;
  color: #f59e0b;
}

.foto-cluster span {
  font-size: 0.72rem;
  font-weight: 900;
  margin-top: 1px;
}

.leaflet-tooltip.foto-leaflet-tooltip {
  padding: 5px;
  border-radius: 10px;
  border: 1px solid rgba(11, 22, 44, 0.15);
  background: #fff;
  box-shadow: 0 10px 26px rgba(11, 22, 44, 0.22);
}

.foto-hover-card {
  width: 176px;
  overflow: hidden;
  border-radius: 7px;
}

.foto-hover-card img {
  width: 100%;
  height: 104px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: #0b162c;
}

.foto-hover-txt {
  padding: 5px 3px 2px;
}

.foto-hover-cat {
  font-size: 0.65rem;
  font-weight: 800;
  color: #b45309;
}

.foto-hover-title {
  font-size: 0.74rem;
  font-weight: 800;
  color: #0f172a;
  white-space: normal;
  line-height: 1.25;
}

.leaflet-tooltip.foto-target-lbl {
  background: rgba(11, 22, 44, 0.9);
  color: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 5px;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 2px 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* --- Modala fotografie istorică --- */
.foto-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.foto-modal.open {
  display: flex;
}

.foto-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 14, 28, 0.78);
  backdrop-filter: blur(4px);
}

.foto-modal-dialog {
  position: relative;
  z-index: 2;
  width: min(1160px, 100%);
  height: min(760px, calc(100vh - 40px));
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 62%) minmax(310px, 38%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.foto-modal-stage {
  background: #070e1c;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.foto-stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(11, 22, 44, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 3;
}

.foto-stage-counter {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 9px;
  border-radius: 999px;
}

.foto-stage-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.foto-stage-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: background 0.15s;
}

.foto-stage-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.foto-stage-btn.close {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
  font-size: 1rem;
  padding: 4px 8px;
}

.foto-stage-btn.close:hover {
  background: #dc2626;
}

.foto-stage-viewport {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 14px;
}

#foto-modal-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
  user-select: none;
  transition: transform 0.16s ease-out;
}

#foto-modal-img.is-zoomed {
  cursor: grab;
  transition: none;
}

#foto-modal-img.is-zoomed:active {
  cursor: grabbing;
}

.foto-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 38px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(11, 22, 44, 0.78);
  color: #fff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.foto-nav-btn:hover {
  background: #d97706;
  border-color: #f59e0b;
}

.foto-nav-btn.prev {
  left: 10px;
}

.foto-nav-btn.next {
  right: 10px;
}

.foto-filmstrip {
  display: flex;
  gap: 7px;
  padding: 9px 14px;
  background: rgba(11, 22, 44, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
}

.foto-strip-item {
  width: 66px;
  height: 46px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #0f172a;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity 0.15s, border-color 0.15s;
}

.foto-strip-item:hover {
  opacity: 0.95;
}

.foto-strip-item.active {
  opacity: 1;
  border-color: #f59e0b;
}

.foto-strip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.foto-modal-aside {
  background: #fff;
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.foto-aside-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.foto-cat-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}

.foto-period-pill {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}

.foto-code-pill {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.foto-modal-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 900;
  color: #0b162c;
  line-height: 1.25;
}

.foto-orient-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.foto-orient-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.foto-compass-svg {
  flex-shrink: 0;
}

.foto-orient-main {
  font-size: 0.84rem;
  color: #78350f;
}

.foto-orient-sub {
  font-size: 0.74rem;
  color: #92400e;
  margin-top: 2px;
}

.foto-orient-coords {
  font-size: 0.68rem;
  color: #b45309;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-top: 2px;
}

.foto-fly-btn {
  align-self: flex-start;
  border: 1px solid #d97706;
  background: #d97706;
  color: #fff;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.foto-fly-btn:hover {
  background: #b45309;
}

.foto-desc-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #1e293b;
}

.foto-desc-empty {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
  font-style: italic;
}

.foto-editor-note-box {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f1f5f9;
  border-left: 3px solid #64748b;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #334155;
}

.foto-monograph-section {
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.foto-mono-heading {
  font-size: 0.82rem;
  font-weight: 900;
  color: #0b162c;
  display: flex;
  align-items: center;
  gap: 6px;
}

.foto-mono-heading i {
  color: #d97706;
}

.foto-mono-card {
  background: #f8fafc;
  border: 1px solid var(--border-soft);
  border-left: 3.5px solid #d97706;
  border-radius: 8px;
  padding: 10px 12px;
}

.foto-mono-summary {
  font-size: 0.79rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.45;
  margin-bottom: 5px;
}

.foto-mono-quote {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #0f172a;
}

.foto-mono-cite {
  margin-top: 5px;
  font-size: 0.73rem;
  font-weight: 700;
  color: #475569;
}

.foto-mono-placeholder {
  font-size: 0.77rem;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  line-height: 1.45;
}

.foto-meta-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.foto-credit-line {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.76rem;
  color: #0b162c;
}

.foto-credit-line i {
  color: #d97706;
  font-size: 0.9rem;
}

.foto-tech-line {
  font-size: 0.69rem;
  color: #64748b;
}

@media (max-width: 900px) {
  .foto-modal {
    padding: 0;
  }
  .foto-modal-dialog {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    grid-template-columns: 1fr;
    grid-template-rows: 45vh 1fr;
  }
  .foto-modal-stage {
    min-height: 220px;
  }
  .foto-stage-viewport {
    padding: 8px;
  }
  .foto-nav-btn {
    width: 32px;
    height: 38px;
    font-size: 1.2rem;
  }
  .foto-filmstrip {
    padding: 6px 10px;
  }
  .foto-strip-item {
    width: 54px;
    height: 38px;
  }
  .foto-modal-aside {
    padding: 14px 15px 24px;
  }
  .foto-modal-title {
    font-size: 1.04rem;
  }
}

/* Fullscreen toggle control (antetul .ba-topbar rămâne vizibil) */
.leaflet-control-fullscreen .ba-fs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: var(--text-main);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.leaflet-control-fullscreen .ba-fs-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.leaflet-control-fullscreen .ba-fs-btn.is-active {
  background: var(--bg-dark);
  color: #fff;
}

.leaflet-control-fullscreen .ba-fs-btn.is-active:hover {
  background: #1e293b;
  color: #fff;
}

/* Control localizare GPS utilizator */
.leaflet-control-locate .ba-locate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  font-size: 1.08rem;
  color: var(--text-main);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.leaflet-touch .leaflet-control-locate .ba-locate-btn {
  width: 30px;
  height: 30px;
  border-radius: 2px;
}

.leaflet-control-locate .ba-locate-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.leaflet-control-locate .ba-locate-btn.is-locating {
  background: #eff6ff;
  color: #2563eb;
  animation: locateBtnPulse 1.2s ease-in-out infinite;
}

.leaflet-control-locate .ba-locate-btn.is-active {
  background: #2563eb;
  color: #ffffff;
}

.leaflet-control-locate .ba-locate-btn.is-active:hover {
  background: #1d4ed8;
  color: #ffffff;
}

.leaflet-control-locate .ba-locate-btn.is-paused {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1.5px #3b82f6;
}

.leaflet-control-locate .ba-locate-btn.is-paused:hover {
  background: #dbeafe;
  color: #1e40af;
}

@keyframes locateBtnPulse {
  0%, 100% {
    background-color: #eff6ff;
  }
  50% {
    background-color: #dbeafe;
  }
}

/* Marker poziție utilizator pe hartă */
.user-loc-divicon {
  background: transparent;
  border: none;
}

.user-loc-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-loc-pulse {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.35);
  animation: userLocPulse 2s ease-out infinite;
  pointer-events: none;
}

.user-loc-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2563eb;
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.45);
  z-index: 2;
}

.user-loc-heading {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 1;
}

.user-loc-heading::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid #1d4ed8;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.9));
}

@keyframes userLocPulse {
  0% {
    transform: scale(0.75);
    opacity: 0.75;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

/* Toast status localizare GPS */
.locate-toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  z-index: 1030;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.28);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 32px);
}

.locate-toast.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.locate-toast-btn {
  border: 1px solid rgba(147, 197, 253, 0.6);
  background: #2563eb;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.locate-toast-btn:hover {
  background: #1d4ed8;
}

@media (max-width: 560px) {
  .locate-toast {
    bottom: 124px;
    font-size: 0.74rem;
    width: max-content;
    max-width: calc(100vw - 24px);
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    border-radius: 14px;
  }
}

/* Card persistent de previzualizare fotografie istorică pe ecrane tactile */
.foto-preview-card {
  position: fixed;
  bottom: 118px;
  left: 12px;
  right: 12px;
  max-width: 420px;
  margin: 0 auto;
  z-index: 1035;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(11, 22, 44, 0.24);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.foto-preview-card.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.foto-preview-thumb {
  width: 78px;
  height: 62px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #0b162c;
}

.foto-preview-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.foto-preview-meta {
  font-size: 0.67rem;
  font-weight: 800;
  color: #b45309;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.foto-preview-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.foto-preview-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #2563eb;
}

.foto-preview-close {
  flex-shrink: 0;
  align-self: flex-start;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.foto-preview-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Pastilă flotantă de creditare pe harta 1896–2026 */
.map-credits-pill {
  position: fixed;
  bottom: 24px;
  left: 14px;
  z-index: 960;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid rgba(217, 119, 6, 0.42);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  color: #0f172a;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  max-width: calc(100vw - 28px);
  transition: left 0.22s ease, border-color 0.15s ease, background-color 0.15s ease, opacity 0.18s ease;
}

.map-credits-pill i {
  color: #d97706;
  font-size: 0.96rem;
  flex-shrink: 0;
}

.map-credits-pill strong {
  color: #0b162c;
  font-weight: 800;
}

.map-credits-pill:hover {
  background: #fffbeb;
  border-color: #d97706;
}

.map-credits-pill .mcp-compact {
  display: none;
}

@media (min-width: 1180px) {
  .sidebar:not(.collapsed) ~ .map-credits-pill {
    left: 416px;
  }
}

@media (max-width: 1179px) and (min-width: 901px) {
  .sidebar:not(.collapsed) ~ .map-credits-pill {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 900px) {
  .map-credits-pill {
    top: auto;
    bottom: 65px;
    left: 12px;
    padding: 5px 10px;
    font-size: 0.72rem;
    max-width: calc(100vw - 165px);
  }
}

@media (max-width: 640px) {
  .map-credits-pill .mcp-full {
    display: none;
  }
  .map-credits-pill .mcp-compact {
    display: inline;
    white-space: nowrap;
  }
}
