:root {
  --color-bg: #112716;
  --color-primary: #0B7138;
  --color-primary-dark: #085a2c;
  --color-surface: rgba(255, 255, 255, 0.08);
  --color-border: rgba(255, 255, 255, 0.15);
  --color-text: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.7);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background: #112716;
    color: white;
}

.container {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Spinner Animation */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Buttons */
.buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Download Section */
.download-section {
    background: #0B7138;
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
}

.platform {
    margin-bottom: 2rem;
}

.platform:last-child {
    margin-bottom: 0;
}

/* Station Info */
.station-info {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
}

#status {
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Station Information Styles */
.station-header {
    text-align: center;
    margin-bottom: 2rem;
}

.station-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.station-address {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.station-city {
    font-size: 1rem;
    opacity: 0.8;
    font-style: italic;
}

/* Image Carousel Styles */
.image-carousel {
    margin-bottom: 2rem;
}

.carousel-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    padding-bottom: 20px;
}

.carousel-track {
    display: flex;
    transition: transform 0.3s ease;
}

.carousel-slide {
    min-width: 100%;
    position: relative;
}

.carousel-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.carousel-image:hover {
    transform: scale(1.02);
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.carousel-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn-prev {
    left: 10px;
}

.carousel-btn-next {
    right: 10px;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.indicator.active {
    background: white;
    transform: scale(1.2);
}

/* Station Details Styles */
.station-details {
    background: #0B7138;
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
}

.detail-item {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.8;
}

.detail-value {
    font-size: 1rem;
}

/* Charging Ports Styles */
.charging-ports {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.port-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #112716;
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 4px solid #0B7138;
}

.port-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.port-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.port-type {
    font-weight: 600;
    font-size: 0.9rem;
}

.port-specs {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.port-power {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Billing Deeplink Styles */
.billing-deeplink-section {
    margin-top: 1rem;
    width: 100%;
}

.billing-deeplink-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #112716 !important;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
}

.billing-deeplink-btn:hover {
    background: #112716 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(11, 113, 56, 0.3);
}

.billing-deeplink-btn:visited {
    background: #112716 !important;
}

.billing-deeplink-btn:active {
    background: #112716 !important;
}

.billing-deeplink-text {
    flex: 1;
}

.billing-deeplink-icon {
    font-size: 1.2rem;
}

/* Download Section Styles */
.download-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    align-items: center;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 60px;
    padding: 0;
    background: rgba(11, 113, 56, 0.1);
    border-radius: 12px;
    text-decoration: none;
    color: white;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(11, 113, 56, 0.3);
}

.download-btn:hover {
    background: rgba(11, 113, 56, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.download-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Legacy App Store Images - keeping for backward compatibility */
.app-store-btn, .play-store-btn {
    padding: 0;
    background: none;
    border-radius: 8px;
    overflow: hidden;
}

.app-store-image, .play-store-image {
    height: 60px;
    width: auto;
    display: block;
}

.app-store-btn:hover, .play-store-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Fullscreen Image Carousel Modal */
.fullscreen-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

.fullscreen-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-carousel-container {
    position: relative;
    width: 90%;
    height: 90%;
    max-width: 1200px;
    max-height: 800px;
    overflow: hidden;
    border-radius: 12px;
}

.fullscreen-carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    height: 100%;
}

.fullscreen-carousel-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-carousel-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.fullscreen-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.fullscreen-carousel-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.fullscreen-carousel-btn-prev {
    left: 20px;
}

.fullscreen-carousel-btn-next {
    right: 20px;
}

.fullscreen-carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 2;
}

.fullscreen-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.fullscreen-indicator.active {
    background: white;
    transform: scale(1.3);
}

/* Close Button for Fullscreen Carousel */
.close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .download-section {
        padding: 1.5rem;
    }

    .buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .station-header h1 {
        font-size: 1.5rem;
    }

    .station-address {
        font-size: 1rem;
    }

    .carousel-container {
        max-width: 100%;
    }

    .carousel-image {
        height: 200px;
    }

    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }

    .carousel-btn-prev {
        left: 5px;
    }

    .carousel-btn-next {
        right: 5px;
    }

    .station-details {
        padding: 1rem;
    }

    .port-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .port-specs {
        align-items: flex-start;
    }

    .billing-deeplink-btn {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .download-btn {
        width: 150px;
        height: 45px;
    }

    .app-store-image, .play-store-image {
        height: 50px;
    }

    .fullscreen-carousel-container {
        width: 95%;
        height: 95%;
    }

    .fullscreen-carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .fullscreen-carousel-btn-prev {
        left: 10px;
    }

    .fullscreen-carousel-btn-next {
        right: 10px;
    }

    .fullscreen-carousel-indicators {
        bottom: 15px;
    }

    .fullscreen-indicator {
        width: 10px;
        height: 10px;
    }

    .close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 32px;
    }
}

/* ============================================================
   Pages: stations-list & analytics  (LIGHT THEME)
   ============================================================ */

body.page-body {
    display: block;
    min-height: 100vh;
    background: #f4f6f4;
    color: #1a1a1a;
    padding-top: 52px; /* compensate for fixed header */
}

/* Page Header / Nav — fixed so it always spans full viewport width */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: #0B7138;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    height: 52px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.page-header .logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.page-header nav {
    display: flex;
    gap: 0.25rem;
}

.nav-btn {
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    text-decoration: none;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
}

.nav-btn.active {
    background: rgba(255,255,255,0.25);
    color: #ffffff;
    font-weight: 600;
}

.download-nav-btn {
    background: rgba(255,255,255,0.2);
    color: #ffffff !important;
}

.download-nav-btn:hover {
    background: rgba(255,255,255,0.3) !important;
}

/* Page content wrapper */
.page-content {
    padding: 1rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: auto;
}

/* Stations Page */
.stations-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
    padding-top: 0.75rem;
}

.stations-count {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.75rem;
}

/* Stations Table */
.stations-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-radius: 10px;
}

.stations-table thead th {
    background: #f0f2f0;
    padding: 0.65rem 0.85rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 52px; /* height of fixed page header */
    cursor: pointer;
    user-select: none;
    border-bottom: 2px solid #d8e0d8;
    color: #333;
    transition: background 0.15s;
    z-index: 10;
}

.stations-table thead th:hover {
    background: #e4e8e4;
}

.stations-table thead th.sort-asc::after {
    content: " ↑";
    font-size: 0.75rem;
    color: #0B7138;
}

.stations-table thead th.sort-desc::after {
    content: " ↓";
    font-size: 0.75rem;
    color: #0B7138;
}

.stations-table tbody tr {
    border-bottom: 1px solid #eef0ee;
    transition: background 0.1s;
}

.stations-table tbody tr:hover {
    background: #f5faf5;
}

.stations-table td {
    padding: 0.55rem 0.85rem;
    color: #555;
}

.stations-table td:first-child {
    color: #1a1a1a;
    font-weight: 500;
}

.stations-table td a {
    color: #0B7138;
    text-decoration: none;
}

.stations-table td a:hover {
    text-decoration: underline;
}

/* Analytics Page */
.analytics-page {
    padding: 1rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Filter chip bar (shared) */
.filter-chip-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.filter-chip-wrap {
    position: relative;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.8rem;
    background: #ffffff;
    border: 1px solid #cdd5cd;
    border-radius: 20px;
    color: #333;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.filter-chip:hover {
    border-color: #0B7138;
    background: #f5faf5;
}

.filter-chip.active {
    background: #0B7138;
    border-color: #0B7138;
    color: #ffffff;
}

.filter-chip .chip-arrow {
    font-size: 0.7rem;
    opacity: 0.6;
}

.filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid #d0d8d0;
    border-radius: 8px;
    padding: 0.75rem;
    z-index: 200;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    max-height: 320px;
    overflow-y: auto;
}

.filter-dropdown.open {
    display: block;
}

/* Thin scrollbar + bottom fade to hint scrollability */
.filter-dropdown::-webkit-scrollbar {
    width: 4px;
}
.filter-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.filter-dropdown::-webkit-scrollbar-thumb {
    background: #c8d4c8;
    border-radius: 2px;
}
.filter-dropdown.has-scroll {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12), inset 0 -28px 18px -18px rgba(0,0,0,0.07);
}

.filter-dropdown label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #444;
    cursor: pointer;
    padding: 0.2rem 0;
    transition: color 0.15s;
}

.filter-dropdown label:hover {
    color: #0B7138;
}

.filter-dropdown input[type="checkbox"],
.filter-dropdown input[type="radio"] {
    accent-color: #0B7138;
    cursor: pointer;
}

.filter-dropdown-apply {
    margin-top: 0.6rem;
    width: 100%;
    padding: 0.4rem;
    background: #0B7138;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

.filter-dropdown-apply:hover {
    background: #085a2c;
}

/* Analytics Grid — 3 columns, year chart spans 2 */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    width: 100%;
}

.chart-card {
    background: #ffffff;
    border: 1px solid #e0e8e0;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    min-width: 0; /* allow grid cell to shrink */
}

.chart-card--double {
    grid-column: span 2;
}

.chart-card h3 {
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

/* Fixed-height canvas wrapper — pie only, no legend inside */
.chart-canvas-wrap {
    position: relative;
    height: 300px;
}

/* Area chart has no legend — canvas fills the full equivalent height */
.chart-canvas-wrap--full {
    height: calc(300px + 150px);
}

/* Legend rendered separately below the canvas */
.chart-legend-wrap {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 6px 4px 0;
}

.analytics-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.summary-card {
    background: #ffffff;
    border: 1px solid #e0e8e0;
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    min-width: 140px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.summary-card .summary-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a1a;
}

.summary-card .summary-label {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.1rem;
}

/* Responsive breakpoints */
@media (max-width: 960px) {
    .analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    /* year chart still spans full row width */
    .chart-card--double {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .page-content {
        padding: 0.75rem;
    }

    .analytics-page {
        padding: 0.75rem;
    }

    .analytics-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .chart-card--double {
        grid-column: span 1;
    }

    .filter-chip-bar {
        gap: 0.4rem;
    }

    .page-header nav .download-nav-btn {
        display: none;
    }
}