/* ==========================================================================
   MotoPit Design System & Stylesheet (Premium Dark Theme)
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-main: #0a0e17;
    --bg-surface: #121824;
    --bg-card: #1b2336;
    --bg-card-hover: #222d45;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-active: rgba(0, 242, 254, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-accent: #00f2fe;
    --color-accent-grad: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --color-accent-hover: #33f6ff;
    --color-accent-rgb: 0, 242, 254;
    
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    /* Shadows & Transitions */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 15px rgba(0, 242, 254, 0.25);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-title: 'Outfit', var(--font-sans);
}

/* Reset & Global */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Application Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header Styles */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 26px;
    background: var(--color-accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(0, 242, 254, 0.4));
    animation: bikeRide 2s ease-in-out infinite alternate;
}

.logo-text {
    font-family: var(--font-title);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-text span {
    background: var(--color-accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.action-btn i {
    color: var(--color-accent);
}

/* App Main Body */
.app-body {
    display: flex;
    flex: 1;
    height: calc(100vh - 64px - 32px); /* subtract header and footer */
    position: relative;
}

/* Sidebar Panel */
.sidebar-panel {
    width: 420px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 999;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal);
}

.search-section {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(18, 24, 36, 0.95);
}

/* Search Box Input */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    font-size: 16px;
}

.search-box input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 40px 12px 42px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-glow);
    background-color: rgba(27, 35, 54, 0.8);
}

.clear-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    display: none;
    transition: color var(--transition-fast);
}

.clear-btn:hover {
    color: var(--text-primary);
}

/* Location Search Button */
.location-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--color-accent-grad);
    border: none;
    color: #000;
    font-weight: 600;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.location-btn:hover {
    filter: brightness(1.1);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

/* Custom Checkbox Grid */
.filters-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.filters-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.filters-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Custom Styled Checkboxes */
.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.custom-checkbox:hover {
    color: var(--text-primary);
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Toggle Switch Style Checkbox */
.custom-checkbox.toggle-style {
    font-weight: 500;
}

/* Results Metadata Banner */
.results-meta {
    padding: 12px 20px;
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Scrollable Results List */
.results-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Parking Lot Card Item */
.parking-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-normal);
}

.parking-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-accent-grad);
    border-radius: 4px 0 0 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.parking-card:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-color-active);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.parking-card.active {
    background-color: var(--bg-card-hover);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-glow);
}

.parking-card.active::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}

.badge-reservation {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.card-address {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.card-address i {
    color: var(--text-muted);
}

.card-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    font-size: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 10px;
    margin-bottom: 10px;
}

.detail-row {
    display: flex;
    gap: 8px;
}

.detail-label {
    color: var(--text-muted);
    font-weight: 500;
    width: 60px;
    flex-shrink: 0;
}

.detail-value {
    color: var(--text-secondary);
    word-break: break-all;
}

/* Card Badges and Limits info */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.04);
}

.distance-tag {
    color: var(--color-accent);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.displacement-badges {
    display: flex;
    gap: 4px;
}

.badge-cc {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
}

.badge-cc.allowed {
    background-color: rgba(0, 242, 254, 0.1);
    color: var(--color-accent);
    border-color: rgba(0, 242, 254, 0.2);
}

/* Empty States & Loading States */
.loading-state, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    gap: 12px;
    flex: 1;
}

.loading-state i {
    font-size: 32px;
    color: var(--color-accent);
}

.empty-state i {
    font-size: 40px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 14px;
}

/* Map Panel (Leaflet) */
.map-panel {
    flex: 1;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
    background-color: var(--bg-main);
}

/* Custom dark styling for Leaflet controls */
.leaflet-control-zoom {
    border: 1px solid var(--border-color) !important;
}

.leaflet-control-zoom-in, .leaflet-control-zoom-out {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.leaflet-control-zoom-in:hover, .leaflet-control-zoom-out:hover {
    background-color: var(--bg-card) !important;
    color: var(--color-accent) !important;
}

.leaflet-bar {
    box-shadow: var(--shadow-md) !important;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 6px !important;
}

.leaflet-popup-tip {
    background-color: var(--bg-surface) !important;
    border-left: 1px solid var(--border-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.popup-container {
    font-family: var(--font-sans);
    min-width: 220px;
    max-width: 280px;
}

.popup-title {
    font-family: var(--font-title);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.popup-row {
    font-size: 12px;
    margin-bottom: 4px;
    line-height: 1.4;
}

.popup-row strong {
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 4px;
}

.popup-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    font-size: 11px;
}

.popup-link {
    background: var(--color-accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
}

/* Modal Overlay & Card (Scraper) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(5, 7, 12, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-family: var(--font-title);
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--color-accent);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.status-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.status-value {
    font-family: var(--font-title);
    font-size: 14px;
    font-weight: 700;
}

#scrape-status {
    color: var(--color-accent);
}

.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.primary-btn:hover:not(:disabled) {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-glow);
    background-color: var(--bg-card-hover);
}

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

/* Scraper Progress Bar */
.progress-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
}

.progress-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-bar-bg {
    height: 8px;
    background-color: var(--bg-surface);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    width: 0;
    background: var(--color-accent-grad);
    box-shadow: var(--shadow-glow);
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Footer Section */
.app-footer {
    height: 32px;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    font-size: 11px;
    color: var(--text-muted);
}

.credits a {
    color: var(--text-secondary);
    font-weight: 500;
}

.credits a:hover {
    color: var(--color-accent);
}

/* Micro-Animations */
@keyframes bikeRide {
    0% { transform: translateY(0); }
    100% { transform: translateY(-3px); }
}

/* Search Toggle (Mobile Only) */
.search-toggle-container {
    display: none;
}

/* Responsive Rules */
@media (max-width: 900px) {
    .app-body {
        flex-direction: column-reverse;
    }
    
    .sidebar-panel {
        width: 100%;
        height: 50%;
        border-right: none;
        border-top: 1px solid var(--border-color);
    }
    
    .map-panel {
        height: 50%;
    }

    .search-toggle-container {
        display: block;
        padding: 8px 16px;
        background-color: var(--bg-surface);
        border-bottom: 1px solid var(--border-color);
    }
    
    .search-toggle-btn {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 8px;
        background-color: var(--bg-card);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        font-size: 13px;
        font-weight: 600;
        border-radius: 6px;
        cursor: pointer;
        transition: all var(--transition-fast);
        outline: none;
    }
    
    .search-toggle-btn:hover {
        background-color: var(--bg-card-hover);
        border-color: var(--color-accent);
        box-shadow: var(--shadow-glow);
    }
    
    .search-section.collapsed {
        display: none !important;
    }
}

@media (max-width: 600px) {
    .app-header {
        padding: 0 16px;
    }
    .logo-text {
        font-size: 20px;
    }
    .action-btn span {
        display: none;
    }
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    .status-grid {
        grid-template-columns: 1fr;
    }
    .app-footer {
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        height: 48px;
        text-align: center;
        padding: 8px;
    }
    .app-body {
        height: calc(100vh - 64px - 48px);
    }
}

/* Custom Map Marker Styling */
.custom-map-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-pin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--color-accent);
    border: 2px solid #fff;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.8);
    transition: all 0.2s ease;
}

.marker-pin.active {
    background-color: #ff007f;
    box-shadow: 0 0 12px #ff007f;
    transform: scale(1.2);
}

.user-marker-pin {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--color-success);
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

/* Custom Leaflet Marker Cluster Theme */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.marker-cluster div {
    width: 32px;
    height: 32px;
    text-align: center;
    border-radius: 50%;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster-small {
    background-color: rgba(0, 242, 254, 0.2);
}

.marker-cluster-small div {
    background-color: rgba(0, 242, 254, 0.7);
    color: #000;
    border: 2px solid #fff;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.8);
}

.marker-cluster-medium {
    background-color: rgba(0, 180, 255, 0.3);
}

.marker-cluster-medium div {
    background-color: rgba(0, 150, 255, 0.8);
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(0, 150, 255, 0.8);
}

.marker-cluster-large {
    background-color: rgba(255, 0, 127, 0.3);
}

.marker-cluster-large div {
    background-color: rgba(255, 0, 127, 0.85);
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 0 12px rgba(255, 0, 127, 0.85);
}

/* Google AdSense Card Styles */
.adsense-container {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all var(--transition-normal);
}

.adsense-container:hover {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
}

.adsense-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
}

.adsense-slot-wrapper {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

/* Fallback/Mock styling when AdSense is not loaded */
.adsense-slot-wrapper::after {
    content: 'Google AdSense Banner Placeholder\n(Will display live ads after approval)';
    white-space: pre-line;
    text-align: center;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    z-index: 1;
}

