/* ============================================================
   ITS Romania Platform - Main Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg:        #0f172a;
  --c-surface:   #1e293b;
  --c-border:    #334155;
  --c-text:      #f1f5f9;
  --c-muted:     #94a3b8;
  --c-accent:    #3b82f6;

  /* Domenii */
  --c-rutier:     #3b82f6;
  --c-naval:      #0ea5e9;
  --c-feroviar:   #f97316;
  --c-urban:      #22c55e;
  --c-aerian:     #a855f7;
  --c-multimodal: #64748b;

  /* Status */
  --c-planificat: #f59e0b;
  --c-activ:      #22c55e;
  --c-finalizat:  #6b7280;

  --sidebar-w: 360px;
  --header-h:  60px;
  --radius:    8px;
  --shadow:    0 4px 20px rgba(0,0,0,0.4);
}

html, body { height: 100%; font-family: 'Inter', 'Segoe UI', sans-serif; background: var(--c-bg); color: var(--c-text); overflow: hidden; }

/* ---- Header ---- */
#header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; padding: 0 20px; gap: 16px;
  z-index: 1100; box-shadow: var(--shadow);
}
#header .logo {
  display: flex; align-items: center; gap: 10px; font-weight: 700;
  font-size: 16px; color: var(--c-text); text-decoration: none;
}
#header .logo svg { width: 28px; height: 28px; }
#header .logo span { color: var(--c-accent); }
#header-spacer { flex: 1; }
#header .btn-admin {
  background: var(--c-accent); color: #fff; border: none;
  padding: 8px 16px; border-radius: var(--radius); cursor: pointer;
  font-size: 13px; font-weight: 600; text-decoration: none;
  display: flex; align-items: center; gap: 6px; transition: background 0.2s;
}
#header .btn-admin:hover { background: #2563eb; }

/* ---- Layout ---- */
#app {
  display: flex; height: 100vh;
  padding-top: var(--header-h);
}

/* ---- Sidebar ---- */
#sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--c-surface); border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform 0.3s ease;
  z-index: 1000;
}
#sidebar-header {
  padding: 16px; border-bottom: 1px solid var(--c-border);
}
#sidebar-header h2 { font-size: 14px; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }

/* Search */
.search-box {
  position: relative;
}
.search-box input {
  width: 100%; background: var(--c-bg); border: 1px solid var(--c-border);
  color: var(--c-text); padding: 9px 12px 9px 36px;
  border-radius: var(--radius); font-size: 13px; outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--c-accent); }
.search-box .icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--c-muted); width: 16px; height: 16px;
}

/* Filters */
#filters { padding: 14px 16px; border-bottom: 1px solid var(--c-border); display: flex; flex-direction: column; gap: 12px; }
.filter-group label { font-size: 11px; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.07em; display: block; margin-bottom: 7px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--c-border); background: transparent;
  color: var(--c-muted); transition: all 0.15s;
}
.pill:hover { border-color: var(--c-accent); color: var(--c-text); }
.pill.active { color: #fff; border-color: transparent; }
.pill[data-domain="RUTIER"].active     { background: var(--c-rutier); }
.pill[data-domain="NAVAL"].active      { background: var(--c-naval); }
.pill[data-domain="FEROVIAR"].active   { background: var(--c-feroviar); }
.pill[data-domain="URBAN"].active      { background: var(--c-urban); }
.pill[data-domain="AERIAN"].active     { background: var(--c-aerian); }
.pill[data-domain="MULTIMODAL"].active { background: var(--c-multimodal); }
.pill[data-status="PLANIFICAT"].active { background: var(--c-planificat); }
.pill[data-status="ACTIV"].active      { background: var(--c-activ); }
.pill[data-status="FINALIZAT"].active  { background: var(--c-finalizat); }

/* Project list */
#project-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
#project-list::-webkit-scrollbar { width: 4px; }
#project-list::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 2px; }

.project-card {
  background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 12px; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  border-left: 3px solid transparent;
}
.project-card:hover { border-color: var(--c-accent); transform: translateX(2px); }
.project-card.active { border-color: var(--c-accent); background: rgba(59,130,246,0.08); }
.project-card .pc-header { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.project-card .pc-title { font-size: 13px; font-weight: 600; line-height: 1.4; flex: 1; }
.project-card .pc-body { font-size: 11px; color: var(--c-muted); display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 7px;
  border-radius: 10px; font-size: 10px; font-weight: 700; white-space: nowrap;
}
.badge-RUTIER     { background: rgba(59,130,246,0.2);  color: var(--c-rutier); }
.badge-NAVAL      { background: rgba(14,165,233,0.2);  color: var(--c-naval); }
.badge-FEROVIAR   { background: rgba(249,115,22,0.2);  color: var(--c-feroviar); }
.badge-URBAN      { background: rgba(34,197,94,0.2);   color: var(--c-urban); }
.badge-AERIAN     { background: rgba(168,85,247,0.2);  color: var(--c-aerian); }
.badge-MULTIMODAL { background: rgba(100,116,139,0.2); color: var(--c-multimodal); }
.badge-PLANIFICAT { background: rgba(245,158,11,0.2);  color: var(--c-planificat); }
.badge-ACTIV      { background: rgba(34,197,94,0.2);   color: var(--c-activ); }
.badge-FINALIZAT  { background: rgba(107,114,128,0.2); color: var(--c-finalizat); }

/* Count */
#results-count { padding: 10px 16px; font-size: 12px; color: var(--c-muted); border-top: 1px solid var(--c-border); }

/* ---- Map ---- */
#map {
  flex: 1; height: 100%;
}
.leaflet-container { background: #1a2332; }

/* Custom markers */
.its-marker {
  width: 32px; height: 32px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); border: 2px solid rgba(255,255,255,0.8);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}
.its-marker-inner {
  width: 12px; height: 12px; border-radius: 50%;
  background: rgba(255,255,255,0.9); transform: rotate(45deg);
}
.its-marker-point {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Popup */
.leaflet-popup-content-wrapper {
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--c-surface); }
.leaflet-popup-content { margin: 16px; min-width: 240px; max-width: 320px; }
.popup-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.popup-badges { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.popup-row { font-size: 12px; color: var(--c-muted); margin-bottom: 4px; display: flex; gap: 6px; }
.popup-row strong { color: var(--c-text); min-width: 80px; }
.popup-desc { font-size: 12px; color: var(--c-muted); margin-top: 8px; line-height: 1.5; border-top: 1px solid var(--c-border); padding-top: 8px; }
.popup-link { display: inline-block; margin-top: 10px; color: var(--c-accent); font-size: 12px; text-decoration: none; }
.popup-link:hover { text-decoration: underline; }

/* ---- Maintenance page ---- */
#maintenance-screen {
  position: fixed; inset: 0; background: var(--c-bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; flex-direction: column; gap: 20px; text-align: center;
  padding: 40px;
}
#maintenance-screen svg { width: 80px; height: 80px; color: var(--c-accent); opacity: 0.7; }
#maintenance-screen h1 { font-size: 28px; font-weight: 800; }
#maintenance-screen p { color: var(--c-muted); font-size: 16px; max-width: 480px; line-height: 1.7; }

/* ---- Sidebar toggle (mobile) ---- */
#toggle-sidebar {
  display: none; position: fixed; bottom: 20px; left: 20px;
  z-index: 1200; background: var(--c-accent); border: none;
  color: #fff; width: 48px; height: 48px; border-radius: 50%;
  cursor: pointer; box-shadow: var(--shadow); font-size: 20px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  #sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0;
    transform: translateX(-100%);
  }
  #sidebar.open { transform: translateX(0); }
  #toggle-sidebar { display: flex; align-items: center; justify-content: center; }
  :root { --sidebar-w: 100vw; }
}

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 20px; color: var(--c-muted);
  text-align: center; gap: 10px;
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.4; }
.empty-state p { font-size: 13px; }

/* Loading */
.loading-state {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--c-muted); gap: 10px; font-size: 13px;
}
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--c-border);
  border-top-color: var(--c-accent); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
