:root {
  --bg-main: #0b0f19;
  --bg-panel: rgba(17, 24, 39, 0.85);
  --bg-panel-solid: #111827;
  --border-panel: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-width: 420px;
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

#map-container {
  flex: 1;
  height: 100%;
  width: 100%;
}

#zoom-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
}

/* Sidebar Styling */
.sidebar {
  position: absolute;
  top: 20px;
  left: 20px;
  bottom: 20px;
  width: var(--sidebar-width);
  z-index: 10;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-panel);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-panel);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* Floating toggle btn when sidebar is hidden */
.floating-toggle-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 9;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-panel);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.floating-toggle-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.floating-toggle-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* Scrollbar Container */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Card Panels / Collapsible Sections */
.panel-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-panel);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.panel-section summary {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.2s;
}

.panel-section summary:hover {
  background: rgba(255, 255, 255, 0.04);
}

.panel-section summary::-webkit-details-marker {
  display: none;
}

.summary-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-chevron {
  transition: transform 0.2s;
  color: var(--text-muted);
}

.panel-section[open] .section-chevron {
  transform: rotate(180deg);
}

.section-body {
  padding: 16px;
  border-top: 1px solid var(--border-panel);
  background: rgba(0, 0, 0, 0.15);
}

/* Form & Input Elements */
.form-group {
  margin-bottom: 14px;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.text-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-panel);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn:hover {
  background: var(--accent-hover);
}

/* Layer Row Control */
.layer-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.layer-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.layer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.layer-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.layer-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Custom Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 22px;
  border: 1px solid var(--border-panel);
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

input:checked + .slider-toggle {
  background-color: var(--accent);
}

input:checked + .slider-toggle:before {
  transform: translateX(22px);
}

/* Sub-controls for Layer styling (collapsible nested) */
.layer-styling-trigger {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  user-select: none;
}

.layer-styling-trigger:hover {
  color: var(--text-main);
}

.layer-styling-trigger svg {
  transition: transform 0.2s;
}

.layer-styling-trigger.expanded svg {
  transform: rotate(90deg);
}

.layer-style-options {
  display: none;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--border-panel);
  margin-top: 8px;
  font-size: 0.85rem;
}

.layer-style-options.visible {
  display: block;
}

.style-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

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

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 32px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.color-picker-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-input::-webkit-color-swatch {
  border: 1px solid var(--border-panel);
  border-radius: 6px;
}

.slider-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.value-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.style-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: background 0.2s;
}

.style-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.1s;
}

.style-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Inspector Panel styling */
.inspector-placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 24px 12px;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--border-panel);
  border-radius: 8px;
}

.inspector-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inspector-feature {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
}

.feature-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
}

.feature-layer-badge {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.prop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.prop-table tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.prop-table tr:last-child {
  border-bottom: none;
}

.prop-table td {
  padding: 6px 4px;
  vertical-align: top;
}

.prop-key {
  color: var(--text-muted);
  font-weight: 500;
  width: 40%;
}

.prop-value {
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
}

/* Metadata Panel */
.metadata-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metadata-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-panel);
  border-radius: 8px;
  padding: 10px 12px;
}

.metadata-card-header {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metadata-status {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.status-loading {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.status-loaded {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.status-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.metadata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.metadata-label {
  font-weight: 500;
}

.metadata-val {
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  text-align: right;
}

.metadata-error-msg {
  font-size: 0.75rem;
  color: #fc8181;
  margin-top: 4px;
  word-break: break-word;
}

/* Toast Notifications */
.toast-container {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-panel);
  padding: 12px 18px;
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-info { border-left: 4px solid var(--accent); }
.toast-success { border-left: 4px solid var(--success); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-error { border-left: 4px solid var(--danger); }

/* Map Zoom controls positioning correction */
.maplibregl-ctrl-top-right {
  top: 20px !important;
  right: 20px !important;
}

/* Footer info */
.footer-credits {
  margin-top: 15px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-panel);
  padding-top: 12px;
}

.footer-credits a {
  color: var(--accent);
  text-decoration: none;
}

.footer-credits a:hover {
  text-decoration: underline;
}
