/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #1e2433; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: #13161f;
  border-right: 1px solid #1e2433;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid #1e2433;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1rem; color: #f1f5f9; }
.brand-sub { font-size: 0.7rem; color: #64748b; }
.sidebar-section-label {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.08em;
  color: #475569; text-transform: uppercase;
  padding: 20px 20px 8px;
}
.sidebar-nav { list-style: none; padding: 0 10px; flex: 1; }
.sidebar-nav li { margin-bottom: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: #94a3b8; text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  transition: all 0.2s;
}
.nav-link:hover { background: #1e2433; color: #e2e8f0; }
.nav-link.active { background: linear-gradient(135deg, #6366f120, #8b5cf620); color: #a5b4fc; border: 1px solid #6366f130; }
.sidebar-footer { padding: 16px 20px; }
.version-badge { font-size: 0.7rem; color: #475569; background: #1e2433; padding: 4px 10px; border-radius: 20px; display: inline-block; }

/* ── Main Content ── */
.main-content { margin-left: 240px; flex: 1; min-height: 100vh; padding: 28px 32px; overflow-y: auto; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 8px; font-size: 0.875rem;
  font-weight: 500; cursor: pointer; border: none;
  text-decoration: none; transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 20px #6366f140; }
.btn-secondary { background: #1e2433; color: #94a3b8; border: 1px solid #2d3748; }
.btn-secondary:hover { background: #2d3748; color: #e2e8f0; }
.btn-outline { background: transparent; color: #94a3b8; border: 1px solid #2d3748; }
.btn-outline:hover { border-color: #6366f1; color: #a5b4fc; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; }
.full-width { width: 100%; justify-content: center; }

/* ── Home Page ── */
.hero {
  display: flex; align-items: center; gap: 40px;
  padding: 40px 0 48px;
  position: relative; overflow: hidden;
}
.hero-bg-orb {
  position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none;
}
.orb1 { width: 400px; height: 400px; background: #6366f120; top: -100px; left: -80px; }
.orb2 { width: 300px; height: 300px; background: #8b5cf615; bottom: -80px; right: 200px; }
.orb3 { width: 200px; height: 200px; background: #0ea5e915; top: 20px; right: 80px; }
.hero-content { flex: 1; position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: #6366f115; border: 1px solid #6366f130;
  color: #a5b4fc; padding: 5px 14px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 500; margin-bottom: 20px;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: #6366f1; animation: pulse 2s infinite; }
.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3rem; font-weight: 700;
  line-height: 1.15; color: #f1f5f9; margin-bottom: 16px;
}
.gradient-text { background: linear-gradient(135deg, #6366f1, #a78bfa, #38bdf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-subtitle { font-size: 1rem; color: #64748b; line-height: 1.7; max-width: 480px; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-visual { flex: 0 0 380px; position: relative; z-index: 1; }

/* Map Preview Card */
.map-preview-card {
  background: #13161f; border: 1px solid #1e2433;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 60px #00000060;
}
.map-preview-header {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; background: #1a1f2e;
  border-bottom: 1px solid #1e2433;
  font-size: 0.78rem; color: #64748b;
}
.map-dot { width: 10px; height: 10px; border-radius: 50%; }
.map-dot.red { background: #ef4444; }
.map-dot.yellow { background: #f59e0b; }
.map-dot.green { background: #10b981; }
.map-preview-header span { margin-left: 6px; }
.map-preview-body { height: 260px; }

/* Stats Row */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: #13161f; border: 1px solid #1e2433;
  border-radius: 12px; padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: #6366f140; }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.purple { background: #6366f120; color: #a5b4fc; }
.stat-icon.blue { background: #0ea5e920; color: #38bdf8; }
.stat-icon.green { background: #10b98120; color: #34d399; }
.stat-icon.orange { background: #f59e0b20; color: #fbbf24; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 1.8rem; font-weight: 700; color: #f1f5f9; }
.stat-label { font-size: 0.78rem; color: #64748b; margin-top: 2px; }

/* Section Card */
.section-card {
  background: #13161f; border: 1px solid #1e2433;
  border-radius: 14px; padding: 24px; margin-bottom: 24px;
}
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; font-weight: 600; color: #f1f5f9; }

/* Data Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  text-align: left; padding: 10px 14px;
  background: #1a1f2e; color: #64748b;
  font-weight: 500; font-size: 0.78rem; letter-spacing: 0.04em;
  border-bottom: 1px solid #1e2433;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid #1a1f2e; color: #cbd5e1; }
.data-table tr:hover td { background: #1a1f2e40; }
.td-num { color: #475569; width: 40px; }
.td-name { color: #f1f5f9; }
.td-mono { font-family: monospace; font-size: 0.8rem; color: #64748b; }

/* Badges */
.state-badge {
  background: #1e2433; color: #94a3b8;
  padding: 3px 10px; border-radius: 20px; font-size: 0.75rem;
}
.geo-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 500;
}
.geo-polygon, .geo-multipolygon { background: #6366f120; color: #a5b4fc; }
.geo-point, .geo-multipoint { background: #10b98120; color: #34d399; }
.geo-linestring, .geo-multilinestring { background: #f59e0b20; color: #fbbf24; }
.geo-unknown, .geo- { background: #1e2433; color: #64748b; }

/* Empty State */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 48px; color: #475569; text-align: center;
}
.empty-state svg { color: #2d3748; }

/* ── Onboarding Page ── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 32px;
}
.page-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.8rem; font-weight: 700; color: #f1f5f9; }
.page-subtitle { color: #64748b; font-size: 0.9rem; margin-top: 4px; }
.onboarding-layout { display: grid; grid-template-columns: 1fr 360px; gap: 24px; }

/* Form Card */
.form-card {
  background: #13161f; border: 1px solid #1e2433;
  border-radius: 16px; overflow: hidden;
}
.form-card-header {
  padding: 24px 28px; background: #1a1f2e;
  border-bottom: 1px solid #1e2433;
}

/* Step Indicator */
.form-step-indicator { display: flex; align-items: center; margin-bottom: 10px; }
.step {
  width: 32px; height: 32px; border-radius: 50%;
  background: #2d3748; color: #64748b;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 600;
  transition: all 0.3s;
}
.step.active { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; }
.step.completed { background: #10b981; color: white; }
.step-line { flex: 1; height: 2px; background: #2d3748; margin: 0 8px; }
.form-step-labels {
  display: flex; justify-content: space-between;
  font-size: 0.75rem; color: #475569;
}
.form-step-labels span.active { color: #a5b4fc; }

.form-step { padding: 28px; }
.form-step.hidden { display: none; }
.step-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; font-weight: 600; color: #f1f5f9; margin-bottom: 20px; }
.step-desc { font-size: 0.85rem; color: #64748b; margin-bottom: 20px; line-height: 1.6; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; color: #94a3b8; margin-bottom: 6px; }
.required { color: #ef4444; }
.form-input {
  width: 100%; background: #1a1f2e; border: 1px solid #2d3748;
  color: #f1f5f9; padding: 10px 14px; border-radius: 8px;
  font-size: 0.9rem; font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}
.form-input:focus { border-color: #6366f1; }
.form-input.input-error { border-color: #ef4444; }
.form-select { cursor: pointer; }
.form-select option { background: #1a1f2e; }

/* Dropzone */
.dropzone {
  border: 2px dashed #2d3748; border-radius: 12px;
  padding: 36px 20px; text-align: center;
  cursor: pointer; transition: all 0.2s;
  margin-bottom: 16px; position: relative;
}
.dropzone:hover, .dropzone.dz-hover { border-color: #6366f1; background: #6366f108; }
.dropzone.has-file { border-color: #10b981; background: #10b98108; }
.dropzone.dz-error { border-color: #ef4444; }
.dropzone-icon { color: #475569; margin-bottom: 12px; }
.dropzone.has-file .dropzone-icon { color: #10b981; }
.dropzone-text { color: #94a3b8; font-size: 0.9rem; margin-bottom: 4px; }
.dropzone-subtext { color: #475569; font-size: 0.78rem; }
.file-input { display: none; }

.file-info {
  display: flex; align-items: center; gap: 12px;
  background: #1a1f2e; border: 1px solid #10b98130;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 16px;
}
.file-info.hidden { display: none; }
.file-info-icon { font-size: 1.4rem; }
.file-info-details { flex: 1; display: flex; flex-direction: column; }
.file-name { font-size: 0.85rem; color: #f1f5f9; font-weight: 500; }
.file-size { font-size: 0.75rem; color: #64748b; }
.btn-clear { background: none; border: none; color: #64748b; cursor: pointer; font-size: 1rem; padding: 2px 6px; }
.btn-clear:hover { color: #ef4444; }

.btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* Review Card */
.review-card {
  background: #1a1f2e; border: 1px solid #2d3748;
  border-radius: 12px; overflow: hidden; margin-bottom: 20px;
}
.review-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #1e2433;
}
.review-row:last-child { border-bottom: none; }
.review-label { font-size: 0.8rem; color: #64748b; }
.review-value { font-size: 0.88rem; color: #f1f5f9; font-weight: 500; }
.review-mono { font-family: monospace; font-size: 0.82rem; }

/* Progress */
.progress-wrap { margin-bottom: 16px; }
.progress-wrap.hidden { display: none; }
.progress-bar-bg { height: 6px; background: #2d3748; border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.progress-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 3px; transition: width 0.3s ease; }
.progress-label { font-size: 0.78rem; color: #64748b; }

/* Spinner */
.spinner {
  width: 14px; height: 14px; border: 2px solid #ffffff40;
  border-top-color: white; border-radius: 50%;
  display: inline-block; animation: spin 0.7s linear infinite;
}

/* Monuments List Panel */
.monuments-list-panel {
  background: #13161f; border: 1px solid #1e2433;
  border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; max-height: 600px;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: #1a1f2e;
  border-bottom: 1px solid #1e2433;
  font-weight: 600; font-size: 0.9rem; color: #f1f5f9;
}
.count-badge {
  background: #6366f120; color: #a5b4fc;
  padding: 2px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
}
.monuments-list { flex: 1; overflow-y: auto; padding: 8px; }

.monument-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  transition: background 0.15s; margin-bottom: 4px;
}
.monument-item:hover { background: #1a1f2e; }
.monument-item-icon { font-size: 1.2rem; }
.monument-item-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mi-name { font-size: 0.85rem; font-weight: 500; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-state { font-size: 0.72rem; color: #64748b; }
.mi-meta { display: flex; align-items: center; gap: 6px; }
.btn-delete { background: none; border: none; color: #475569; cursor: pointer; font-size: 0.8rem; padding: 3px 6px; border-radius: 4px; transition: all 0.15s; }
.btn-delete:hover { color: #ef4444; background: #ef444415; }

.empty-list { padding: 32px; text-align: center; color: #475569; font-size: 0.85rem; }
.empty-list a { color: #a5b4fc; }

/* ── Dashboard Page ── */
.page-dashboard {
  display: flex; flex-direction: column;
  height: calc(100vh - 56px); gap: 12px;
}
.dash-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.dash-header-actions { display: flex; gap: 10px; }
.dash-body { display: grid; grid-template-columns: 240px 1fr; gap: 14px; flex: 1; min-height: 0; }

/* Layer Panel */
.layer-panel {
  background: #13161f; border: 1px solid #1e2433;
  border-radius: 14px; display: flex; flex-direction: column;
  overflow: hidden;
}
.lp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: #1a1f2e;
  border-bottom: 1px solid #1e2433;
  font-size: 0.88rem; font-weight: 600; color: #f1f5f9;
}
.layer-search-wrap { padding: 10px 10px 6px; }
.layer-search {
  width: 100%; background: #1a1f2e; border: 1px solid #2d3748;
  color: #f1f5f9; padding: 6px 10px; border-radius: 7px;
  font-size: 0.8rem; font-family: inherit; outline: none;
}
.layer-search:focus { border-color: #6366f1; }
.layer-list { flex: 1; overflow-y: auto; padding: 6px; }

.layer-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  margin-bottom: 3px; transition: background 0.15s;
}
.layer-item:hover { background: #1a1f2e; }
.layer-item.li-active {
  background: #6366f115;
  border: 1px solid #6366f140;
  box-shadow: 0 0 0 1px #6366f120 inset;
}
.li-color-swatch { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.li-info { flex: 1; min-width: 0; padding: 2px 0; }
.li-name { display: block; font-size: 0.8rem; font-weight: 500; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-state { font-size: 0.7rem; color: #64748b; }
.li-controls { display: flex; gap: 4px; }
.li-vis-btn, .li-zoom-btn {
  background: none; border: none; color: #475569;
  cursor: pointer; padding: 3px; border-radius: 4px;
  transition: all 0.15s; display: flex;
}
.li-vis-btn.active { color: #6366f1; }
.li-vis-btn:hover, .li-zoom-btn:hover { color: #e2e8f0; background: #2d3748; }

/* Map */
.map-container { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid #1e2433; }
#main-map { width: 100%; height: 100%; }

/* Charts */
.chart-card {
  background: #13161f; border: 1px solid #1e2433;
  border-radius: 12px; padding: 16px; flex-shrink: 0;
}
.chart-title { font-size: 0.82rem; font-weight: 600; color: #94a3b8; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.chart-wrap { position: relative; }

/* Analytics Page */
.page-analytics { display: flex; flex-direction: column; gap: 24px; }
.analytics-charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.an-chart-card {
  background: #13161f; border: 1px solid #1e2433;
  border-radius: 14px; padding: 20px;
}
.an-chart-card.wide { grid-column: 1; }
.an-chart-card:not(.wide) { grid-column: 2; }

/* Popup */
.popup-card { font-family: 'Inter', sans-serif; min-width: 200px; }
.popup-title { font-weight: 700; font-size: 0.95rem; color: #1e293b; margin-bottom: 2px; }
.popup-state { font-size: 0.78rem; color: #64748b; margin-bottom: 8px; }
.popup-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.pp-key { color: #64748b; padding: 2px 6px 2px 0; vertical-align: top; white-space: nowrap; }
.pp-val { color: #1e293b; padding: 2px 0; word-break: break-word; }
.popup-no-props { font-size: 0.78rem; color: #94a3b8; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 8px 32px #00000060;
  transform: translateY(20px); opacity: 0;
  transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.hidden { display: none; }
.toast-success { background: #10b981; color: white; }
.toast-error { background: #ef4444; color: white; }

/* Shimmer */
.loading-shimmer { padding: 8px; }
.shimmer-row {
  height: 44px; border-radius: 8px; margin-bottom: 8px;
  background: linear-gradient(90deg, #1a1f2e 25%, #2d3748 50%, #1a1f2e 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Animations */
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Leaflet override */
.leaflet-container { font-family: 'Inter', sans-serif; }
.leaflet-popup-content-wrapper { border-radius: 12px; }

/* Responsive */
@media (max-width: 1200px) {
  .stats-row, .analytics-row { grid-template-columns: repeat(2, 1fr); }
  .dash-body { grid-template-columns: 1fr; grid-template-rows: auto 400px auto; }
  .hero { flex-direction: column; }
  .hero-visual { display: none; }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .brand-text, .sidebar-section-label, .nav-link span { display: none; }
  .main-content { margin-left: 60px; padding: 20px 16px; }
  .onboarding-layout { grid-template-columns: 1fr; }
}
