/* ===================================================
   ARM EV DASHBOARD - STYLESHEET
   Premium dark theme with glassmorphism
   =================================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #f0f4ff;
  --bg-secondary: #e8edf8;
  --bg-card: rgba(255, 255, 255, 0.85);
  --text-primary: #1e1b4b;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);

  --border-color: rgba(99, 102, 241, 0.12);
  --border-glow: rgba(28, 32, 245, 0.28);

  --success: #10b981;
  --danger: #ef4444;
  --info: #3b82f6;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

body.dark {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-color: rgba(99, 102, 241, 0.15);
  --border-glow: rgba(99, 102, 241, 0.3);

  --success: #34d399;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.01) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(59, 130, 246, 0.01) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

body.dark::before {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  margin: 10px 12px 0 12px;
  border-radius: 16px;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* atau contain kalau mau full logo */
}

.header-left {
  display: flex;
  align-items: center;
  justify-self: start;
}

.header-center {
  justify-self: center;
}

.header-right {
  display: flex;
  justify-self: end;
}




.logo h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  position: relative;
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1px var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.subtitle::before {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  color: var(--accent-primary);
  -webkit-text-stroke: 0px transparent;
  border-right: 2px solid var(--accent-primary);
  overflow: hidden;
  white-space: nowrap;
  animation: animateTextFill 6s linear infinite;
  filter: drop-shadow(0 0 8px var(--accent-primary));
}

@keyframes animateTextFill {
  0%, 10%, 100% {
    width: 0;
  }
  70%, 90% {
    width: 100%;
  }
}


.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-card);
  border-radius: 100px;
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}


.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  transition: var(--transition);
}

/* FIX: selector valid, bukan link markdown */
.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-dot 2s infinite;
}

.status-dot.warning {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.7;
    transform: scale(1.3);
  }
}

/* --- Main Grid --- */
.main-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  align-items: start;
  gap: 14px;
  padding: 14px 20px;
  min-height: calc(100vh - 62px);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.card-body {
  padding: 10px 16px;
}

/* --- Map --- */
.map-section {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 62px;
  height: calc(100vh - 90px);
}

.map-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* FIX: height dikontrol CSS saja, tidak pakai inline style di HTML */
#map, #historyMap {
  flex: 1;
  min-height: 300px;
  background: var(--bg-secondary);
}

/* --- Map marker: pin seperti Google Maps (bubble + shadow di tanah) --- */
.leaflet-div-icon.motor-leaflet-div-icon {
  background: transparent !important;
  border: none !important;
}

.motor-map-pin {
  position: relative;
  width: 44px;
  height: 52px;
  pointer-events: none;
}

/* Bayangan “mengapung” di permukaan peta */
.motor-map-pin__shadow {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 28px;
  height: 12px;
  margin-left: -14px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
      rgba(0, 0, 0, 0.38) 0%,
      rgba(0, 0, 0, 0.14) 45%,
      transparent 72%);
  transform: scaleY(0.55);
  filter: blur(1.5px);
}

.motor-map-pin__bubble {
  position: absolute;
  left: 50%;
  top: 0;
  width: 38px;
  height: 38px;
  margin-left: -19px;
  background: linear-gradient(155deg, #a5b4fc 0%, #6366f1 42%, #4338ca 100%);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid #fff;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.28),
    0 2px 6px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.motor-map-pin__bubble>span {
  transform: rotate(45deg);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Ujung jarum — dasar lingkaran sejajar dengan titik koordinat di peta */
.motor-map-pin__tip {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: linear-gradient(180deg, #4f46e5, #312e81);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.map-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

.map-controls {
  display: flex;
  gap: 6px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-sm {
  padding: 5px 8px;
  font-size: 11px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: rgba(69, 69, 156, 0.777);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* --- Controls Section --- */
.controls-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
}

/* --- Status Grid --- */
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.stat-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 16px;
  flex-shrink: 0;
}

.stat-icon.parked {
  background: rgba(99, 102, 241, 0.15);
}

.stat-icon.active {
  background: rgba(16, 185, 129, 0.15);
}

.stat-icon.throttle {
  background: rgba(239, 68, 68, 0.15);
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.stat-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Gauge Card --- */
.gauge-card-wrapper {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  padding: 12px 6px;
}

.gauge-wrapper {
  position: relative;
  width: 64px;
  height: 64px;
}

.circular-gauge {
  width: 100%;
  height: 100%;
  transform: rotate(135deg);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.circular-gauge circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.gauge-bg {
  stroke: var(--border-color);
  stroke-dasharray: 188.5 251.3;
}

.gauge-progress {
  stroke: url(#gaugeGradient);
  stroke-dasharray: 251.3;
  stroke-dashoffset: 251.3;
  transition: stroke-dashoffset 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
}

.gauge-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.gauge-unit {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 1px;
}

.mt-1 {
  margin-top: 2px;
}

/* --- Throttle Chart Panel --- */
.gauge-card-wrapper {
  cursor: pointer;
  user-select: none;
}

.gauge-card-wrapper:active {
  transform: scale(0.97);
}

.throttle-chart-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease;
  opacity: 0;
}

.throttle-chart-panel.open {
  max-height: 300px;
  opacity: 1;
}

.chart-body {
  padding: 8px 12px 12px !important;
  position: relative;
}

.chart-body canvas {
  width: 100%;
  height: 160px;
  display: block;
  border-radius: 8px;
}

.chart-label {
  font-size: 14px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Sound Selector --- */
.sound-selector {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sound-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  width: calc(33.333% - 6px);
  min-width: 90px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
}

.sound-btn:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}

.sound-btn.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

/* FIX: content checkmark pakai unicode escape agar tidak corrupt */
.sound-btn.active::after {
  content: '\2713';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 9px;
  font-weight: 900;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.2);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.sound-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  isolation: isolate;
}

.sound-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  filter: none !important;
  mix-blend-mode: normal !important;
  color-scheme: light dark;
  forced-color-adjust: none;
}


.sound-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.sound-desc {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
}

.current-sound {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 6px 12px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.current-sound strong {
  color: var(--accent-primary);
}

/* --- Alarm Control --- */
.alarm-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.alarm-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alarm-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
}

.alarm-indicator.active {
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
  animation: pulse-dot 2s infinite;
}

.alarm-label {
  font-size: 13px;
  font-weight: 600;
  display: block;
}

.alarm-desc {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
}

.alarm-info {
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 12px;
  background: rgba(34, 197, 94, 0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(34, 197, 94, 0.12);
  line-height: 1.4;
  transition: var(--transition);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(2, 108, 255, 0.548);
  border-radius: 100px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(2, 108, 255, 0.4);
}



.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}



.theme-toggle input:checked+.toggle-slider::after {
  content: "\1F319";
  /* ?? */
  transform: translateX(20px);
}

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

.alarm-toggle .toggle-slider::after {
  content: '';
}


.theme-toggle .toggle-slider::after {
  content: "\2600";
  position: absolute;
  left: 6px;
  top: 2px;
  font-size: 12px;
  transition: var(--transition);
}


/* --- Activity Log --- */
.activity-log {
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.2) transparent;
}

.activity-log::-webkit-scrollbar {
  width: 3px;
}

.activity-log::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 10px;
}

.log-entry {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(99, 102, 241, 0.06);
  font-size: 11px;
  animation: fadeInLog 0.3s ease;
}

@keyframes fadeInLog {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-time {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  font-family: 'Courier New', monospace;
  font-size: 10px;
}

.log-msg {
  color: var(--text-secondary);
  line-height: 1.3;
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  animation: slideInToast 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 320px;
}

body:not(.dark) .toast {
  background: rgba(255, 255, 255, 0.9);
  color: #1e1b4b;
}

body.dark .toast {
  background: rgba(17, 24, 39, 0.95);
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

/* FIX: selector valid, bukan link markdown */
.toast.info {
  border-left: 3px solid var(--info);
}

@keyframes slideInToast {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px;
  }

  .map-section {
    position: static;
    height: auto;
  }

  #map, #historyMap {
    height: 300px;
    flex: none;
  }

  .status-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .header-nav span {
    display: none;
  }

  .header {
    grid-template-columns: auto 1fr auto;
    padding: 10px 16px;
  }
}

@media (max-width: 600px) {
  .header {
    padding: 8px 10px;
    margin: 8px 8px 0 8px;
    gap: 8px;
  }

  .logo-text .subtitle {
    display: none;
  }

  .logo h1 {
    font-size: 16px;
  }

  .header-actions {
    gap: 8px;
  }

  #connectionText {
    display: none;
  }

  .connection-status {
    padding: 6px;
  }

  .main-grid {
    padding: 8px;
    gap: 8px;
  }

  .status-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* .sound-selector layout is flex-centered natively */
}

/* --- Loading shimmer --- */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.loading {
  background: linear-gradient(90deg,
      var(--bg-card) 25%,
      rgba(99, 102, 241, 0.1) 50%,
      var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ================= HISTORY ================= */

.history-controls {
  padding: 10px;
  border-top: 1px solid var(--border-color);
  background: rgba(99, 102, 241, 0.05);
}

#historySlider {
  width: 100%;
  cursor: pointer;
}

.history-info {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* --- Header Nav --- */
.header-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.nav-link:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-primary);
}

.nav-link.active {
  background: var(--bg-card);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* --- Page System --- */
.pages-container {
  position: relative;
  width: 100%;
}

.page {
  display: none;
  animation: fadeIn 0.4s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Account Page --- */
.account-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  justify-items: center;
}

.account-settings {
  width: 100%;
}

.profile-card {
  width: 100%;
  max-width: 420px;
  height: fit-content;
  text-align: center;
  padding: 32px 24px;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  margin: 0 auto 16px;
  border-radius: 50%;
  padding: 4px;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-md);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: white;
  object-fit: cover;
}

.profile-info h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.profile-info p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.dark .badge {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-primary);
}

.stat-desc {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.account-form {
  display: grid;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input {
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input[readonly] {
  cursor: not-allowed;
  opacity: 0.7;
}

.security-list {
  display: grid;
  gap: 16px;
}

.security-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.security-info h4 {
  font-size: 14px;
  margin-bottom: 2px;
}

.security-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.mt-4 {
  margin-top: 24px;
}

/* --- Custom Leaflet Control (Minimized) --- */
.leaflet-control-layers {
  background: var(--bg-card) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-sm) !important;
  padding: 2px !important;
  transition: var(--transition);
  min-width: 32px;
  min-height: 32px;
}

.leaflet-control-layers-toggle {
  width: 30px !important;
  height: 30px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 2 7 12 12 22 7 12 2'/%3E%3Cpolyline points='2 17 12 22 22 17'/%3E%3Cpolyline points='2 12 12 17 22 12'/%3E%3C/svg%3E") !important;
  background-size: 16px !important;
}

.leaflet-control-layers-list {
  padding: 4px;
}

.map-mode-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  margin-left: 2px;
}

.leaflet-control-layers-base label {
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}


.leaflet-control-layers-base label:hover {
  background: rgba(99, 102, 241, 0.1);
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.5) !important;
  backdrop-filter: blur(4px);
  font-size: 9px !important;
  border-top-left-radius: 8px;
}

body.dark .leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.5) !important;
  color: #888 !important;
}

/* --- Custom Leaflet Zoom (Modern) --- */
.leaflet-control-zoom {
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: hidden;
  margin-right: 12px !important;
  margin-bottom: 12px !important;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  background: var(--bg-card) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--accent-primary) !important;
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  font-size: 16px !important;
  border: none !important;
  transition: var(--transition);
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background: rgba(99, 102, 241, 0.1) !important;
  color: var(--accent-secondary) !important;
}

.leaflet-control-zoom-in {
  border-bottom: 1px solid var(--border-color) !important;
}

/* --- Wide Screen Layouts --- */
@media (min-width: 1400px) {
  .account-grid {
    grid-template-columns: 320px 1fr;
    justify-items: stretch;
    align-items: start;
  }

  .profile-card {
    max-width: none;
  }
}