/* =====================================================
   APLICATIE CIMITIR 2026 – STYLE.CSS
   Design: Dark Mode, Modern, Premium
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;600&display=swap');

:root {
  --bg-primary: #0f1117;
  --bg-card: #1a1d27;
  --bg-card2: #22263a;
  --bg-sidebar: #13161f;
  --border: #2a2d3e;
  --text-primary: #e8eaf0;
  --text-secondary: #8b91a8;
  --text-muted: #555b70;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --gray: #64748b;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --transition: all 0.2s ease;
  --sidebar-w: 380px;
  --topbar-h: 60px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

/* ── TOP BAR ── */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: rgba(15, 17, 23, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#topbar::-webkit-scrollbar {
  display: none;
}

#topbar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#topbar .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #c026d3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

#topbar .logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

#topbar .logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

/* ── SEARCH ── */
#search-container {
  flex: 1;
  max-width: 400px;
  position: relative;
}

#search-input {
  width: 100%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 8px 16px 8px 40px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

#search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 320px;
  overflow-y: auto;
  display: none;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
}

#search-results.open {
  display: block;
}

.search-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: var(--bg-card2);
}

.search-item .si-name {
  font-size: 14px;
  font-weight: 500;
}

.search-item .si-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.search-item .si-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-start;
  margin-top: 2px;
}

.si-badge.achitat {
  background: rgba(59, 130, 246, 0.2);
  color: var(--blue);
}

.si-badge.neachitat {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red);
}

/* ── LAYER CONTROLS (TOP RIGHT) ── */
#layer-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.layer-btn {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.layer-btn:hover {
  border-color: var(--accent-light);
  color: var(--text-primary);
}

.layer-btn.active {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ── MOD SWITCH ── */
#mod-switch {
  display: flex;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  flex-shrink: 0;
}

.mod-btn {
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.mod-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ── HARTA ── */
#map {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  transition: right 0.3s ease;
}

#map.panel-open {
  right: var(--sidebar-w);
}

/* ── SIDEBAR PANEL ── */
#panel {
  position: fixed;
  top: var(--topbar-h);
  right: calc(-1 * var(--sidebar-w));
  width: var(--sidebar-w);
  bottom: 0;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  z-index: 900;
  transition: right 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#panel.open {
  right: 0;
}

#panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  transition: var(--transition);
  z-index: 10;
}

#panel-close:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

#panel-foto {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--bg-card2);
  flex-shrink: 0;
}

#panel-foto-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg-card2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  gap: 8px;
  flex-shrink: 0;
}

#panel-foto-placeholder .ico {
  font-size: 40px;
  opacity: 0.4;
}

#panel-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#panel-plot-id {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
}

#panel-nume {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.panel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.panel-row .pr-label {
  font-size: 11px;
  color: var(--text-muted);
  width: 90px;
  flex-shrink: 0;
  font-weight: 500;
}

.panel-row .pr-val {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

#panel-taxa {
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid;
}

#panel-taxa.achitat {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

#panel-taxa.neachitat {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

#panel-taxa .taxa-icon {
  font-size: 20px;
}

#panel-taxa .taxa-text {
  flex: 1;
}

#panel-taxa .taxa-label {
  font-size: 11px;
  color: var(--text-muted);
}

#panel-taxa .taxa-val {
  font-size: 14px;
  font-weight: 700;
}

.achitat .taxa-val {
  color: var(--blue);
}

.neachitat .taxa-val {
  color: var(--red);
}

#panel-pozitie {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.pozitie-card {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}

.pozitie-card .poz-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.pozitie-card .poz-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-light);
}

#panel-obs {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--bg-card2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: none;
}

#panel-obs.has-obs {
  display: block;
}

/* ── STATUS BAR (BOTTOM) ── */
#statusbar {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 28px;
  background: rgba(15, 17, 23, 0.95);
  border-top: 1px solid var(--border);
  z-index: 800;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  font-size: 11px;
  color: var(--text-muted);
  transition: right 0.3s ease;
  right: 0;
}

#statusbar.panel-open {
  right: var(--sidebar-w);
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.sb-dot.verde {
  background: var(--green);
}

.sb-dot.galben {
  background: var(--yellow);
}

.sb-dot.gri {
  background: var(--gray);
}

.sb-dot.albastru {
  background: var(--blue);
}

.sb-dot.rosu {
  background: var(--red);
}

/* ── LEGENDA ── */
#legenda {
  position: fixed;
  bottom: 36px;
  left: 12px;
  background: rgba(26, 29, 39, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  z-index: 800;
  min-width: 180px;
  box-shadow: var(--shadow);
}

#legenda-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.leg-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── INFO CIMITIR CARD ── */
#info-cimitir {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  left: 12px;
  background: rgba(26, 29, 39, 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  z-index: 800;
  min-width: 200px;
  max-width: 260px;
  box-shadow: var(--shadow);
}

#info-cimitir .ic-titlu {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

#info-cimitir .ic-parohie {
  font-size: 11px;
  color: var(--accent-light);
  margin-bottom: 8px;
}

#info-cimitir .ic-row {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

#info-cimitir .ic-row span:first-child {
  flex-shrink: 0;
}

#info-cimitir .ic-data {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

#info-cimitir .ic-toggle {
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: right;
  margin-top: 4px;
  -webkit-user-select: none;
  user-select: none;
}

#info-cimitir .ic-toggle:hover {
  color: var(--accent-light);
}

#info-cimitir.collapsed .ic-body {
  display: none;
}

/* ── LEAFLET OVERRIDES ── */
.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
  border-radius: var(--radius) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border) !important;
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-card2) !important;
}

.leaflet-control-attribution {
  background: rgba(15, 17, 23, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a {
  color: var(--text-muted) !important;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── TOOLTIP MORMANT ── */
.leaflet-tooltip.morm-tooltip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  padding: 5px 10px;
  box-shadow: var(--shadow);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 100vw;
  }

  #topbar .logo-text {
    display: none;
  }

  #layer-controls .layer-btn span {
    display: none;
  }

  #info-cimitir {
    max-width: 180px;
  }
}