/* search-pixel-perfect.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Scoped to search page only — prevents overflow:hidden from blocking scroll on all other pages */
body[data-page="search"],
body[data-page="search"] html {
    margin: 0;
    padding: 0;
    height: 100vh;
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Apply the search-page layout constraints only on search page */
body:not([data-page="search"]) .sp-sidebar,
body:not([data-page="search"]) .sp-map-container,
body:not([data-page="search"]) .sp-results-panel {
    /* Allow normal flow on non-search pages */
}

/* Header */
.sp-header {
    height: 70px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    z-index: 1000;
    flex-shrink: 0;
}
.sp-header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}
.sp-logo {
    height: 36px;
}
.sp-nav {
    display: flex;
    gap: 32px;
}
.sp-nav a {
    text-decoration: none;
    color: #4b5563;
    font-weight: 500;
    font-size: 14px;
    height: 70px;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
}
.sp-nav a.active {
    color: #00a859;
    border-bottom: 2px solid #00a859;
}
.sp-nav a:hover:not(.active) {
    color: #111827;
}

.sp-header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}
.sp-lang {
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.sp-icon-btn {
    color: #4b5563;
    font-size: 18px;
    cursor: pointer;
}
.sp-btn-primary {
    background: #00a859;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

/* Main Layout */
.sp-main {
    display: flex;
    flex-wrap: wrap;
    flex-grow: 1;
    overflow: hidden;
}

/* Sidebar */
.sp-sidebar {
    width: 100%;
    max-width: 440px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    z-index: 500;
    flex-shrink: 0;
}
.sp-sidebar-header {
    background: #ffffff;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    border-bottom-right-radius: 16px;
    box-shadow: 2px 4px 12px rgba(0,0,0,0.03);
}
.sp-sidebar-title {
    font-size: 19px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px 0;
}
.sp-sidebar-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 12px 0;
}
.sp-search-box {
    position: relative;
    margin-bottom: 12px;
}
.sp-search-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 14px;
    color: #111827;
    outline: none;
}
.sp-search-input::placeholder {
    color: #9ca3af;
}
.sp-search-icon-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 32px;
    height: 32px;
    background: #e8f5e9;
    color: #00a859;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
}

.sp-filters-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.sp-filters-row::-webkit-scrollbar { display: none; }
.sp-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    cursor: pointer;
}
.sp-filter-btn.active {
    background: #e8f5e9;
    color: #00a859;
    border-color: #00a859;
}

/* Results Area */
.sp-results-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 14px 16px;
}
.sp-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.sp-results-count {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}
.sp-sort-dropdown {
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
}
.sp-sort-dropdown span {
    color: #374151;
    font-weight: 500;
}

/* Station Card */
.sp-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.sp-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.sp-brand {
    display: flex;
    gap: 16px;
}
.sp-brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}
.sp-brand-logo.tata { color: #f97316; }
.sp-brand-logo.ather { background: #1e3a8a; color: white; }
.sp-brand-logo.bolt { color: #00a859; }
.sp-brand-logo.statiq { background: #7c3aed; color: white; }
.sp-brand-logo.chargezone { background: #0891b2; color: white; }

.sp-brand-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}
.sp-brand-info p {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}
.sp-card-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.sp-badge-featured {
    background: #e8f5e9;
    color: #00a859;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}
.sp-distance {
    font-size: 14px;
    font-weight: 600;
    color: #00a859;
}
.sp-rating {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}
.sp-rating i {
    color: #fbbf24;
}

.sp-tags {
    display: flex;
    gap: 8px;
}
.sp-tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.sp-tag.dc {
    background: #e8f5e9;
    color: #00a859;
}
.sp-tag.ac {
    background: #f3f4f6;
    color: #374151;
}
.sp-tag.power {
    color: #2563eb;
    background: #eff6ff;
}

.sp-load-more {
    width: 100%;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* Map Area */
.sp-map-area {
    flex-grow: 1;
    position: relative;
}
#spMap {
    width: 100%;
    height: 100%;
    background: #e5e5e5;
}

/* Map Floating Elements */
.sp-map-search-btn {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    color: #00a859;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    cursor: pointer;
}
.sp-map-legend {
    position: absolute;
    top: 24px;
    right: 24px;
    background: #ffffff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    width: 200px;
}
.sp-map-legend h5 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}
.sp-legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #4b5563;
    font-weight: 500;
}
.sp-legend-item:last-child { margin-bottom: 0; }
.sp-legend-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.sp-map-controls {
    position: absolute;
    right: 24px;
    bottom: 140px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}
.sp-map-control-group {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sp-map-control-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111827;
    font-size: 18px;
    cursor: pointer;
    background: transparent;
    border: none;
}
.sp-map-control-btn:not(:last-child) {
    border-bottom: 1px solid #f3f4f6;
}

.sp-plan-journey {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 24px;
    z-index: 1000;
}
.sp-journey-icon {
    width: 48px;
    height: 48px;
}
.sp-journey-text h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sp-journey-badge {
    background: #e8f5e9;
    color: #00a859;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 12px;
}
.sp-journey-text p {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}
.sp-btn-outline {
    border: 1px solid #00a859;
    color: #00a859;
    background: transparent;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Bottom Features Bar */
.sp-features-bar {
    height: 80px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1000;
    flex-shrink: 0;
}
.sp-feature-item {
    display: flex;
    align-items: center;
    gap: 16px;
}
.sp-feature-icon {
    width: 40px;
    height: 40px;
    background: #e8f5e9;
    color: #00a859;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.sp-feature-text h6 {
    margin: 0 0 2px 0;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}
.sp-feature-text p {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
}

/* Custom Marker */
.sp-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.sp-marker-dc { background: #00a859; }
.sp-marker-ac { background: #10b981; }
.sp-marker-coming { background: #f59e0b; }
.sp-marker-cluster { background: #059669; font-size: 14px; width: 36px; height: 36px; }

/* Global overrides for Leaflet */
.leaflet-control-attribution { display: none; }

/* Responsive Mobile & Tablet Adaptations */
@media (max-width: 991.98px) {
    .sp-main {
        flex-direction: column;
        height: auto !important;
        min-height: auto;
        overflow: visible;
        margin-top: 65px !important;
    }
    .sp-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        flex-shrink: 0;
    }
    .sp-sidebar-header {
        padding: 16px 18px !important;
        border-bottom-right-radius: 0 !important;
    }
    .sp-sidebar-title {
        font-size: 1.25rem !important;
        margin-bottom: 4px !important;
    }
    .sp-sidebar-subtitle {
        font-size: 0.825rem !important;
        margin-bottom: 14px !important;
    }
    .sp-filters-row {
        display: flex !important;
        gap: 8px !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        padding-bottom: 6px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none;
    }
    .sp-filters-row::-webkit-scrollbar {
        display: none;
    }
    .sp-filter-btn {
        flex-shrink: 0 !important;
        padding: 6px 14px !important;
        font-size: 0.8rem !important;
    }
    .sp-results-area {
        padding: 16px !important;
        overflow-y: visible !important;
    }
    .sp-map-area {
        width: 100% !important;
        height: 350px !important;
        min-height: 320px !important;
        position: relative;
        flex-shrink: 0;
    }
    .sp-plan-journey {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        margin: 16px !important;
        flex-direction: column !important;
        text-align: center !important;
        gap: 10px !important;
        padding: 16px !important;
    }
    .sp-map-legend {
        top: 10px !important;
        right: 10px !important;
        padding: 8px 12px !important;
        width: auto !important;
        max-width: 160px;
        font-size: 0.75rem !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(4px);
    }
    .sp-map-controls {
        right: 10px !important;
        bottom: 20px !important;
    }
    .sp-features-bar {
        height: auto !important;
        padding: 20px 16px !important;
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
}

@media (max-width: 575.98px) {
    .sp-main {
        margin-top: 60px !important;
    }
    .sp-card {
        padding: 14px !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
    }
    .sp-card-top {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    .sp-brand-info h4 {
        font-size: 0.95rem !important;
    }
    .sp-brand-info p {
        font-size: 0.78rem !important;
    }
    .sp-card-meta {
        align-items: flex-end !important;
        text-align: right !important;
    }
    .sp-distance {
        font-size: 0.8rem !important;
    }
    .sp-rating {
        font-size: 0.8rem !important;
    }
    .sp-tags {
        margin-top: 10px !important;
        gap: 6px !important;
    }
    .sp-tag {
        font-size: 0.725rem !important;
        padding: 3px 8px !important;
    }
    .sp-features-bar {
        grid-template-columns: 1fr !important;
    }
}
