/* МЗС RONX — Municipal EV Charging Network Bishkek */
/* Brand: blue #0A7BFF, green #00E676 */

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

:root {
  --bg: #0a1628;
  --bg2: #132038;
  --bg3: #1a2d4a;
  --card: #132038;
  --border: #1e3a5f;
  --accent: #0A7BFF;
  --accent2: #0066DD;
  --green: #00E676;
  --red: #ef4444;
  --yellow: #eab308;
  --card2: rgba(255,255,255,0.05);
  --text1: #f1f5f9;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --radius: 16px;
  --radius-sm: 10px;
  --primary: var(--accent);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -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; }

.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 { align-items: center; justify-content: center; }
.loading-inner { text-align: center; }

.logo-img {
  height: 56px; width: auto; display: block; object-fit: contain;
  margin: 0 auto; filter: drop-shadow(0 0 16px rgba(10,123,255,0.4));
}

.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); } }

.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, #0d2240 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 { flex: 1; padding: 24px 20px; max-width: 480px; margin: 0 auto; width: 100%; animation: fadeSlideUp 0.35s ease-out; }

.charger-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; animation: cardEntry 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.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(0, 230, 118, 0.15); color: var(--green); border: 1px solid rgba(0, 230, 118, 0.3); animation: availPulse 2s ease-in-out infinite; }
.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(10, 123, 255, 0.15); color: #0A7BFF; border: 1px solid rgba(10, 123, 255, 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 { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 16px; text-align: center; animation: rateReveal 0.5s ease-out 0.2s both; }
.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; }

.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: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, #0A7BFF, #0066DD); color: white; }
.btn-primary:hover { box-shadow: 0 4px 20px rgba(10, 123, 255, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary.btn-ready { background: linear-gradient(135deg, #00C853, #00E676); }
.btn-primary.btn-ready:hover { box-shadow: 0 4px 20px rgba(0, 230, 118, 0.4); }
.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-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-pdf { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; padding: 14px; border-radius: 12px; background: rgba(10, 123, 255, 0.1); border: 1px solid rgba(10, 123, 255, 0.3); color: var(--accent); text-decoration: none; font-weight: 600; font-size: 15px; }

.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.2s ease, box-shadow 0.2s ease; }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 123, 255, 0.2); }
.form-input::placeholder { color: var(--text3); }

.power-display { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 20px; margin-bottom: 16px; text-align: center; }
.power-value { font-size: 80px; font-weight: 900; background: linear-gradient(135deg, #0A7BFF, #00E676); -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; }
.stat-value.mono { font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace; }

.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; }

.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 { background: rgba(10, 123, 255, 0.08); border: 1px solid rgba(10, 123, 255, 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); }

.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-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; animation: errorShake 0.4s ease-out; }

.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; }
.hidden { display: none !important; }

.live-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--green); font-weight: 600; margin-bottom: 8px; animation: live-pulse 2s ease-in-out infinite; }
.live-dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse-green 1.5s ease-in-out infinite; }

.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; }

.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-overlay { position: absolute; inset: 0; z-index: 1050; background: rgba(10,22,40,0.7); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text2); font-size: 14px; }

.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.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s 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: white; }

.locate-banner { position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%); width: 80%; max-width: 320px; 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 { 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); }

.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; }

.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, #00C853, #00E676); 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); }

.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; }

.charger-marker-wrap { background: none !important; border: none !important; }
.pin-marker { position: relative; }
.pin-pulse { animation: pinPulse 2s ease-in-out infinite; }
.leaflet-marker-icon { animation: pinDrop 0.4s ease-out; }
.user-dot-outer { width: 20px; height: 20px; border-radius: 50%; background: rgba(10,123,255,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: var(--accent); }

@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cardEntry { from { opacity: 0; transform: translateY(30px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes rateReveal { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes live-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.08); } }
@keyframes pulse-green { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes pinPulse { 0%, 100% { filter: drop-shadow(0 0 0px transparent); } 50% { filter: drop-shadow(0 0 8px rgba(10,123,255,0.5)); } }
@keyframes pinDrop { 0% { transform: translateY(-20px); opacity: 0; } 60% { transform: translateY(3px); opacity: 1; } 100% { transform: translateY(0); } }
@keyframes userPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }
@keyframes availPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(0,230,118,0.3); } 50% { box-shadow: 0 0 12px 4px rgba(0,230,118,0.15); } }
@keyframes prepPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(234,179,8,0.3); } 50% { box-shadow: 0 0 12px 4px rgba(234,179,8,0.15); } }
@keyframes charging-glow { 0%, 100% { filter: drop-shadow(0 0 8px rgba(10,123,255,0.3)); } 50% { filter: drop-shadow(0 0 24px rgba(10,123,255,0.7)); } }
@keyframes errorShake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes checkBounce { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes successFade { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes statEntry { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.power-value.charging { animation: charging-glow 2s ease-in-out infinite; }
.check-bounce { animation: checkBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.success-card { animation: successFade 0.3s ease-out; }
.skeleton { background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: 8px; }

.step-item:nth-child(1) { animation: fadeSlideUp 0.3s ease-out 0.1s both; }
.step-item:nth-child(2) { animation: fadeSlideUp 0.3s ease-out 0.25s both; }
.step-item:nth-child(3) { animation: fadeSlideUp 0.3s ease-out 0.4s both; }
.stat-card { animation: statEntry 0.3s ease-out both; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } }
html { scroll-behavior: smooth; }

/* ═══════════════════════════════════════════════════ */
/* МЗС RONX — Light Theme                             */
/* ═══════════════════════════════════════════════════ */
html[data-theme="light"] {
  --bg: #f5f7fa;
  --bg2: #ffffff;
  --bg3: #e8ecf1;
  --card: #ffffff;
  --border: #d1d9e0;
  --accent: #0A7BFF;
  --accent2: #0066DD;
  --green: #00C853;
  --red: #dc2626;
  --yellow: #d97706;
  --card2: rgba(0,0,0,0.03);
  --text1: #1a2332;
  --text: #1a2332;
  --text2: #4a5568;
  --text3: #8896a6;
}

html[data-theme="light"] body { background: var(--bg); color: var(--text); }
html[data-theme="light"] .app-header { background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%); }
html[data-theme="light"] .charger-card { box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
html[data-theme="light"] .power-value { background: linear-gradient(135deg, #0A7BFF, #00C853); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
html[data-theme="light"] .btn-primary { background: linear-gradient(135deg, #0A7BFF, #0066DD); }
html[data-theme="light"] .btn-primary.btn-ready { background: linear-gradient(135deg, #00A846, #00C853); }
html[data-theme="light"] .form-input { background: #f0f3f7; border-color: #d1d9e0; color: #1a2332; }
html[data-theme="light"] .form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,123,255,0.12); }
html[data-theme="light"] .form-input::placeholder { color: #8896a6; }
html[data-theme="light"] .info-note { background: rgba(10,123,255,0.06); border-color: rgba(10,123,255,0.15); }
html[data-theme="light"] .error-card { background: rgba(220,38,38,0.06); border-color: rgba(220,38,38,0.2); }
html[data-theme="light"] .receipt-card { box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
html[data-theme="light"] .session-stats { box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
html[data-theme="light"] .bottom-tab-bar { background: #ffffff; border-top-color: #d1d9e0; }
html[data-theme="light"] .map-geo-btn,
html[data-theme="light"] .map-zoom-btn,
html[data-theme="light"] .theme-toggle { background: #ffffff; border-color: #d1d9e0; color: #1a2332; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
html[data-theme="light"] .map-bottom-sheet { background: #ffffff; border-color: #d1d9e0; }
html[data-theme="light"] .map-loading-overlay { background: rgba(245,247,250,0.8); }
html[data-theme="light"] .soc-fill { background: linear-gradient(90deg, #00A846, #00C853); }
html[data-theme="light"] .soc-text { color: #ffffff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
html[data-theme="light"] #floating-logo { background: rgba(255,255,255,0.9) !important; box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important; }
html[data-theme="light"] .locate-banner-btn { background: #ffffff; border-color: #d1d9e0; color: #1a2332; }
html[data-theme="light"] .app-footer { border-top-color: #d1d9e0; color: #8896a6; }
html[data-theme="light"] .skeleton { background: linear-gradient(90deg, #e8ecf1 25%, #f0f3f7 50%, #e8ecf1 75%); }
