/* ═══════════════════════════════════════════════════════════════
   PluginAny — Main Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ─── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  --green:        #16a34a;
  --green-light:  #22c55e;
  --green-dim:    #dcfce7;
  --ink:          #0f172a;
  --ink-soft:     #475569;
  --paper:        #ffffff;
  --surface:      #f8fafc;
  --border:       #e2e8f0;
  --shadow:       0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg:    0 16px 48px rgba(0,0,0,0.14);
  --radius:       14px;
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

/* ─── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font-body); background: var(--paper); color: var(--ink); }

/* ═══════════════════════════════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════════════════════════════ */
#landing {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--paper); overflow-y: auto;
  transition: opacity 0.5s ease;
}
#landing.fade-out { opacity: 0; pointer-events: none; }

/* Nav */
.l-nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; height: 64px;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.l-logo { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--ink); text-decoration: none; }
.l-logo span { color: var(--green); }
.l-nav-links { display: flex; gap: 32px; }
.l-nav-links a { font-size: 14px; font-weight: 500; color: var(--ink-soft); text-decoration: none; transition: color 0.2s; }
.l-nav-links a:hover { color: var(--ink); }
.l-nav-cta { display: flex; gap: 10px; align-items: center; }

/* Buttons */
.btn-ghost {
  padding: 8px 18px; border-radius: 8px; border: 1.5px solid var(--border);
  background: transparent; font-family: var(--font-body); font-size: 14px; font-weight: 500;
  cursor: pointer; color: var(--ink); transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.btn-primary {
  padding: 9px 20px; border-radius: 8px; border: none; background: var(--green);
  color: white; font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { background: #15803d; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(22,163,74,0.3); }

/* Hero */
.l-hero {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  min-height: calc(100vh - 64px); padding: 80px 40px 60px 80px;
  align-items: center; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 50%, #f8fafc 100%);
}
.l-hero::before {
  content: ''; position: absolute; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(34,197,94,0.08) 0%, transparent 70%);
  top: -100px; right: -100px; pointer-events: none;
}
.l-hero-text { position: relative; z-index: 2; }

.l-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-dim); color: var(--green); border-radius: 100px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; margin-bottom: 28px;
}
.l-badge::before {
  content: ''; width: 6px; height: 6px; background: var(--green);
  border-radius: 50%; animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.3); }
}

.l-headline {
  font-family: var(--font-display); font-size: clamp(40px, 5vw, 68px);
  font-weight: 800; line-height: 1.05; color: var(--ink); margin-bottom: 12px;
}
.l-headline em { color: var(--green); font-style: normal; }
.l-tagline { font-size: 22px; font-weight: 300; color: var(--ink-soft); letter-spacing: 0.1em; margin-bottom: 36px; }
.l-sub { font-size: 16px; color: var(--ink-soft); line-height: 1.7; max-width: 480px; margin-bottom: 44px; }

.l-cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-hero { padding: 14px 28px; border-radius: 10px; font-family: var(--font-body); font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s; border: none; }
.btn-hero-primary { background: var(--green); color: white; }
.btn-hero-primary:hover { background: #15803d; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(22,163,74,0.35); }
.btn-hero-outline { background: transparent; color: var(--ink); border: 2px solid var(--border); }
.btn-hero-outline:hover { border-color: var(--green); color: var(--green); }

/* Hero visual */
.l-hero-visual {
  position: relative; display: flex; align-items: center; justify-content: center; height: 500px;
}
.hero-map-card {
  width: 420px; height: 380px; background: var(--ink); border-radius: 24px;
  overflow: hidden; position: relative; box-shadow: var(--shadow-lg);
}
.hero-map-bg {
  position: absolute; inset: 0; background: #1a2744;
  background-image:
    radial-gradient(circle at 30% 40%, rgba(34,197,94,0.15) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(59,130,246,0.10) 0%, transparent 40%);
}
.hero-map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-card-overlay {
  position: absolute; bottom: 20px; left: 20px; right: 20px;
  background: rgba(255,255,255,0.1); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 14px; padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.hero-card-label { color: rgba(255,255,255,0.6); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-card-value { color: white; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.hero-card-stat { text-align: center; }

/* Stats bar */
.l-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--paper);
}
.l-stat {
  padding: 32px 40px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.l-stat:last-child { border-right: none; }
.l-stat-num { font-family: var(--font-display); font-size: 36px; font-weight: 800; color: var(--green); }
.l-stat-label { font-size: 14px; color: var(--ink-soft); }

/* Features */
.l-section { padding: 80px; }
.l-section-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--green); margin-bottom: 12px; }
.l-section-title { font-family: var(--font-display); font-size: 40px; font-weight: 800; color: var(--ink); margin-bottom: 48px; }
.l-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.l-feature {
  padding: 32px; border: 1px solid var(--border); border-radius: var(--radius);
  transition: all 0.25s; cursor: default;
}
.l-feature:hover { border-color: var(--green); box-shadow: 0 8px 32px rgba(22,163,74,0.1); transform: translateY(-2px); }
.l-feature-icon { font-size: 32px; margin-bottom: 16px; }
.l-feature-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.l-feature-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.65; }

/* Footer */
.l-footer {
  background: var(--ink); color: rgba(255,255,255,0.5);
  padding: 40px 80px; display: flex; justify-content: space-between; align-items: center;
}
.l-footer-logo { font-family: var(--font-display); font-weight: 800; font-size: 18px; color: white; }
.l-footer-logo span { color: var(--green-light); }
.l-footer-copy { font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════
   MAP APP
   ═══════════════════════════════════════════════════════════════ */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 1; }

/* Top bar */
#topbar {
  height: 56px; background: var(--paper); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); flex-shrink: 0;
}
.tb-logo { font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--ink); }
.tb-logo span { color: var(--green); }
.tb-search { flex: 1; max-width: 360px; position: relative; }
.tb-search input {
  width: 100%; padding: 8px 14px 8px 36px; border: 1.5px solid var(--border);
  border-radius: 8px; font-family: var(--font-body); font-size: 14px; outline: none;
  transition: border-color 0.2s; background: var(--surface);
}
.tb-search input:focus { border-color: var(--green); background: white; }
.tb-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); font-size: 16px; pointer-events: none; }
.tb-actions { margin-left: auto; display: flex; gap: 8px; }
.tb-btn {
  padding: 7px 14px; border-radius: 8px; border: 1.5px solid var(--border);
  background: transparent; font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; color: var(--ink); display: flex; align-items: center; gap: 6px; transition: all 0.2s;
}
.tb-btn:hover { border-color: var(--green); color: var(--green); }
.tb-btn-home { border-color: transparent; }

/* Filter bar */
#filterbar {
  height: 44px; background: var(--paper); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 8px;
  overflow-x: auto; scrollbar-width: none; flex-shrink: 0;
}
#filterbar::-webkit-scrollbar { display: none; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; margin-right: 4px; }
.filter-pill {
  padding: 5px 14px; border-radius: 100px; border: 1.5px solid var(--border);
  background: transparent; font-family: var(--font-body); font-size: 12px; font-weight: 500;
  cursor: pointer; white-space: nowrap; color: var(--ink-soft); transition: all 0.15s;
}
.filter-pill:hover,
.filter-pill.active { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.filter-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

/* Map */
#map { flex: 1; z-index: 1; min-height: 0; }

/* Loader */
#map-loader {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: white; padding: 10px 20px; border-radius: 100px;
  font-size: 13px; font-weight: 500; z-index: 50; transition: opacity 0.3s;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  box-shadow: var(--shadow-lg);
}
#map-loader.hide { opacity: 0; pointer-events: none; }
.loader-dot { width: 6px; height: 6px; background: var(--green-light); border-radius: 50%; animation: blink 1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* Data source badge */
#data-source {
  position: absolute; bottom: 20px; right: 16px; z-index: 50;
  background: var(--paper); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 10px; font-size: 11px; font-weight: 600; color: var(--ink-soft);
  box-shadow: var(--shadow); display: none;
}
#data-source.show { display: block; }
#data-source.supabase { border-color: var(--green); color: var(--green); }
#data-source.ocm { border-color: #3b82f6; color: #3b82f6; }

/* Charger count */
#charger-count {
  position: absolute; top: 12px; right: 12px; z-index: 50;
  background: var(--paper); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--ink);
  box-shadow: var(--shadow); display: none;
}
#charger-count span { color: var(--green); }

/* Search dropdown */
#search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--paper); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); z-index: 200; max-height: 240px; overflow-y: auto; display: none;
}
.search-item { padding: 10px 14px; cursor: pointer; font-size: 14px; transition: background 0.15s; }
.search-item:hover { background: var(--surface); }
.search-item-name { font-weight: 500; }
.search-item-addr { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* ─── STATION DETAIL DRAWER ──────────────────────────── */
#det {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--paper); border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 48px rgba(0,0,0,0.15);
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
  max-height: 75vh; overflow-y: auto;
}
#det.open { transform: translateY(0); }
.det-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 12px auto 0;
}
.det-close {
  position: absolute; top: 16px; right: 16px; width: 28px; height: 28px;
  border-radius: 50%; border: none; background: var(--surface); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--ink-soft);
}
.det-close:hover { background: var(--border); }
.det-body { padding: 20px 20px 32px; }
.det-network { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.det-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.det-network-name { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.det-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 6px; line-height: 1.2; }
.det-addr { font-size: 13px; color: var(--ink-soft); margin-bottom: 20px; }
.det-code { font-size: 11px; color: #94a3b8; margin-bottom: 16px; font-family: monospace; }
.det-connectors { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.det-conn {
  padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--ink);
}
.det-conn span { color: var(--green); }
.det-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.det-info-cell { background: var(--surface); border-radius: 10px; padding: 12px; }
.det-info-cell-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 4px; }
.det-info-cell-val { font-size: 15px; font-weight: 600; color: var(--ink); }
.det-actions { display: flex; gap: 10px; }
.det-btn {
  flex: 1; padding: 12px; border-radius: 10px; border: none; font-family: var(--font-body);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.det-btn-nav { background: var(--green); color: white; }
.det-btn-nav:hover { background: #15803d; }
.det-btn-share { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border); }
.det-btn-share:hover { border-color: var(--green); color: var(--green); }

/* Status badges */
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.status-active      { background: #dcfce7; color: #15803d; }
.status-inactive    { background: #fee2e2; color: #dc2626; }
.status-maintenance { background: #fef9c3; color: #854d0e; }

/* ─── MAP PINS ───────────────────────────────────────── */
.cpin {
  width: 28px; height: 28px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.cpin-ultra { background: #7c3aed; }
.cpin-dc    { background: #f97316; }
.cpin-ac    { background: #16a34a; }
.cpin-slow  { background: #3b82f6; }

/* Leaflet popup */
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { font-family: var(--font-body); font-size: 13px; margin: 12px 16px; }
.popup-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.popup-sub  { color: var(--ink-soft); font-size: 12px; margin-bottom: 8px; }
.popup-kw   { display: inline-block; background: var(--green-dim); color: var(--green); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ─── RESPONSIVE ─────────────────────────────────────── */
@media (min-width: 768px) {
  #det {
    left: auto; width: 380px; top: 100px; bottom: 0;
    right: 16px; border-radius: 16px 16px 0 0;
    max-height: calc(100vh - 116px);
  }
}

@media (max-width: 768px) {
  .l-nav         { padding: 0 20px; }
  .l-nav-links   { display: none; }
  .l-hero        { grid-template-columns: 1fr; padding: 40px 20px 60px; min-height: auto; }
  .l-hero-visual { display: none; }
  .l-stats       { grid-template-columns: repeat(2, 1fr); }
  .l-stat        { padding: 20px; }
  .l-section     { padding: 48px 20px; }
  .l-features    { grid-template-columns: 1fr; }
  .l-footer      { flex-direction: column; gap: 12px; padding: 32px 20px; text-align: center; }
}
