/* Stroomlijnen Charge App — Mobile-first Dark Theme */

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

:root {
  --bg: #0a1929;
  --bg2: #0d2137;
  --bg3: #132f4c;
  --card: #0d2137;
  --border: #1e3a5f;
  --accent: #00B0E4;
  --accent2: #0090c0;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --text1: #f1f5f9;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --radius: 16px;
  --radius-sm: 10px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Screens ── */

.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}

.screen.active {
  display: flex;
}

/* ── Loading ── */

#loading {
  align-items: center;
  justify-content: center;
}

.loading-inner {
  text-align: center;
}

.logo-img {
  height: 48px;
  width: auto;
  display: block;
  object-fit: contain;
  margin: 0 auto;
  filter: drop-shadow(0 0 12px rgba(0,176,228,0.3));
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Header ── */

.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
}

.header-subtitle {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.app-footer {
  text-align: center;
  padding: 16px 20px;
  font-size: 12px;
  color: var(--text3);
  border-top: 1px solid var(--border);
}

.app-footer a {
  color: var(--text3);
  text-decoration: none;
}

/* ── Page content ── */

.page-content {
  flex: 1;
  padding: 24px 20px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* ── Charger card ── */

.charger-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.charger-location {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.location-icon {
  font-size: 18px;
}

.location-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text2);
}

.charger-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.status-badge.available {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge.preparing {
  background: rgba(234, 179, 8, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.status-badge.occupied {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-badge.loading {
  background: rgba(234, 179, 8, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

/* ── Rate display ── */

.rate-display {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}

.rate-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

.rate-label {
  font-size: 13px;
  color: var(--text2);
  margin-top: 4px;
}

.rate-note {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

/* ── Step guide ── */

.step-guide {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  opacity: 0.4;
  transition: opacity 0.3s;
}

.step-item + .step-item {
  margin-top: 8px;
}

.step-item.active {
  opacity: 1;
}

.step-item.done {
  opacity: 0.5;
}

.step-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text1);
}

.step-desc {
  font-size: 12px;
  color: var(--text3);
}

/* ── Info note ── */

.info-note {
  background: rgba(0, 176, 228, 0.08);
  border: 1px solid rgba(0, 176, 228, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 20px;
  line-height: 1.5;
}

.info-note strong {
  color: var(--accent);
}

/* ── Buttons ── */

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary.btn-ready {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
}

.btn-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 176, 228, 0.1);
  border: 1px solid rgba(0, 176, 228, 0.3);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

/* ── Form ── */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 176, 228, 0.15);
}

.form-input::placeholder {
  color: var(--text3);
}

/* ── Live session ── */

.power-display {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  margin-bottom: 16px;
  text-align: center;
}

.power-value {
  font-size: 64px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #86efac);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.power-unit {
  font-size: 20px;
  color: var(--text2);
  margin-top: 4px;
}

.session-stats {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 14px;
  color: var(--text2);
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── Receipt ── */

.receipt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.receipt-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.receipt-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.receipt-subtitle {
  font-size: 13px;
  color: var(--text2);
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.receipt-row:last-child {
  border-bottom: none;
}

.receipt-row.total {
  font-size: 18px;
  font-weight: 700;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  color: var(--accent);
}

.receipt-row .label {
  color: var(--text2);
}

.receipt-row .value {
  font-weight: 600;
  color: var(--text);
}

.success-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ── QR scan prompt ── */

.scan-prompt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.scan-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.7;
}

.scan-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.scan-text {
  font-size: 15px;
  color: var(--text2);
  line-height: 1.6;
  max-width: 280px;
}

/* ── Error ── */

.error-card {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--red);
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── Utility ── */

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.text-center { text-align: center; }
.text-muted { color: var(--text2); font-size: 13px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Pulse animation for live session ── */
@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse-green 1.5s ease-in-out infinite;
}

/* ── Preparing pulse for status badge ── */
.status-badge.preparing .live-dot {
  background: var(--yellow);
}

/* ── Map & Tab Layout ── */
.hidden { display: none !important; }
.home-screen { display: flex; flex-direction: column; height: 100dvh; }
.home-tab-content { flex: 1; position: relative; overflow: hidden; }
#charger-map { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }

.bottom-tab-bar {
  display: flex; align-items: center;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}
.bottom-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 8px; background: none; border: none;
  color: var(--text3); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: color 0.15s;
}
.bottom-tab.active { color: var(--accent); }
.bottom-tab-icon { display: block; height: 24px; }
.bottom-tab-label { font-size: 11px; }
.tab-logo { padding: 0 12px; }
.tab-logo img { height: 28px; filter: drop-shadow(0 0 6px rgba(0,176,228,0.3)); }

/* Map controls */
.map-geo-btn {
  position: absolute; bottom: 100px; right: 12px; z-index: 1100;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.map-zoom-controls {
  position: absolute; bottom: 160px; right: 12px; z-index: 1100;
  display: flex; flex-direction: column; gap: 4px;
}
.map-zoom-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.theme-toggle {
  position: absolute; top: 12px; right: 12px; z-index: 1100;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* Map loading */
.map-loading-overlay {
  position: absolute; inset: 0; z-index: 1050;
  background: rgba(10,25,41,0.7);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text2); font-size: 14px;
}

/* Bottom sheet */
.map-bottom-sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0; padding: 0;
  transform: translateY(100%); transition: transform 0.3s ease;
  z-index: 1200; max-height: 60vh; overflow-y: auto;
}
.map-bottom-sheet.open { transform: translateY(0); padding: 16px 20px 24px; }
.sheet-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 12px;
}
.sheet-charger-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.sheet-charger-addr { font-size: 13px; color: var(--text2); margin-bottom: 8px; }
.map-popup-dist { font-size: 12px; color: var(--accent); margin-bottom: 12px; }
.sheet-connector-list { margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 8px; }
.sheet-btn {
  flex: 1; padding: 10px 16px; border-radius: 8px; border: none;
  font-size: 14px; font-weight: 600; text-align: center;
  text-decoration: none; cursor: pointer; display: flex;
  align-items: center; justify-content: center; gap: 4px;
}
.sheet-btn-nav { background: var(--accent); color: #0C2340; }

/* Scanner */
@keyframes scanLine {
  0%, 100% { top: 10%; }
  50% { top: 90%; }
}

/* Pin marker */
.charger-marker-wrap { background: none !important; border: none !important; }
.pin-marker { position: relative; }
.pin-pulse { animation: pinPulse 2s ease-in-out infinite; }
@keyframes pinPulse {
  0%, 100% { filter: drop-shadow(0 0 0px transparent); }
  50% { filter: drop-shadow(0 0 8px rgba(0,176,228,0.5)); }
}

/* User dot */
.user-dot-outer {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,176,228,0.3); display: flex;
  align-items: center; justify-content: center;
  animation: userPulse 2s ease-in-out infinite;
}
.user-dot-inner { width: 10px; height: 10px; border-radius: 50%; background: #00B0E4; }
@keyframes userPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* Locate banner */
.locate-banner {
  position: absolute; bottom: 80px; left: 12px; right: 12px; z-index: 1100;
}
.locate-banner-btn {
  width: 100%; padding: 12px 16px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: center;
}

/* Empty state */
.empty-state { text-align: center; padding: 16px 0; }
.empty-state-icon { margin-bottom: 8px; }
.empty-state-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.empty-state-text { font-size: 13px; color: var(--text3); }

/* ── Leaflet z-index overrides ── */
.leaflet-top, .leaflet-bottom { z-index: 999 !important; }
.leaflet-pane { z-index: 400 !important; }
.leaflet-tile-pane { z-index: 200 !important; }
.leaflet-overlay-pane { z-index: 400 !important; }
.leaflet-marker-pane { z-index: 600 !important; }
.leaflet-tooltip-pane { z-index: 650 !important; }
.leaflet-popup-pane { z-index: 700 !important; }

/* ── Live session extras ── */

/* Monospace stat values */
.stat-value.mono {
  font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
}

/* SoC battery bar */
.soc-bar {
  position: relative;
  height: 40px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}
.soc-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  transition: width 1s ease;
}
.soc-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Charging glow on power value */
@keyframes charging-glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(0,176,228,0.3)); }
  50%       { filter: drop-shadow(0 0 24px rgba(0,176,228,0.7)) drop-shadow(0 0 48px rgba(34,197,94,0.2)); }
}
.power-value.charging {
  animation: charging-glow 2s ease-in-out infinite;
}

/* LIVE indicator pulse */
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(1.08); }
}
.live-indicator {
  animation: live-pulse 2s ease-in-out infinite;
}

/* Charger info header */
.session-charger-info {
  text-align: center;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.session-charger-name {
  font-size: 16px;
  font-weight: 700;
}
.session-charger-detail {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

/* Bigger power display */
.power-display {
  padding: 40px 20px;
}
.power-value {
  font-size: 80px;
}
