/* ==========================================
   iSplit Premium Transit — Design System
   Modern Uber/Bolt-inspired light theme
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@600;700;800&display=swap');

:root {
    --bg-base: #f7f7f7;
    --bg-white: #ffffff;
    --acc-primary: #d32f2f;
    --acc-primary-hover: #b71c1c;
    --acc-primary-glow: rgba(211, 47, 47, 0.18);
    --acc-blue: #276ef1;
    --acc-blue-light: rgba(39, 110, 241, 0.08);
    --acc-green: #05944f;
    --acc-green-light: rgba(5, 148, 79, 0.08);
    --acc-danger: #e11900;
    --acc-danger-light: rgba(225, 25, 0, 0.08);
    --acc-orange: #ff6937;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #6b6b6b;
    --text-light: #999999;
    --border-light: #e2e2e2;
    --border-subtle: #eeeeee;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-smooth: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-spring: 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

html, body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    height: 100dvh;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', 'Inter', sans-serif;
    letter-spacing: -0.5px;
    font-weight: 700;
}

/* ==========================================
   Fullscreen Map Layer
   ========================================== */
#map {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100vh; height: 100dvh;
    z-index: 1;
}

/* ==========================================
   Glass Header — Floating Top Bar
   ========================================== */
.glass-header {
    position: fixed; top: 0; left: 0; right: 0;
    padding: 0 20px;
    height: 64px;
    display: flex; justify-content: space-between; align-items: center;
    background: linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(255,255,255,0.85) 70%, rgba(255,255,255,0) 100%);
    z-index: 100;
    pointer-events: none;
}
.glass-header > * { pointer-events: auto; }

.logo {
    font-weight: 800; font-size: 1.6rem;
    color: var(--acc-primary);
    letter-spacing: -1px;
}

.user-status {
    padding: 6px 14px;
    border-radius: 100px;
    font-weight: 600; font-size: 0.78rem;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
    display: flex; align-items: center; gap: 6px;
}
.user-status::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-light);
    display: inline-block;
}
.user-status.online::before { background: var(--acc-green); }
.user-status.searching::before { background: var(--acc-orange); animation: pulse-dot 1.5s infinite; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}

/* ==========================================
   Button System
   ========================================== */
.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 16px 24px;
    margin-top: 10px;
    font-size: 1rem; font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    letter-spacing: -0.2px;
    position: relative;
    overflow: hidden;
}
.btn:active { transform: scale(0.97); opacity: 0.9; }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary {
    background: var(--acc-primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--acc-primary-glow);
}
.btn-primary:hover { background: var(--acc-primary-hover); }

.btn-accent {
    background: var(--acc-blue);
    color: #fff;
    box-shadow: 0 4px 14px rgba(39, 110, 241, 0.25);
}

.btn-success {
    background: var(--acc-green);
    color: #fff;
    box-shadow: 0 4px 14px rgba(5, 148, 79, 0.25);
}

.btn-danger {
    background: var(--acc-danger);
    color: #fff;
    box-shadow: 0 4px 14px rgba(225, 25, 0, 0.2);
}

.btn-secondary {
    background: var(--bg-base);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-light);
}

.btn-sm {
    padding: 10px 16px;
    font-size: 0.88rem;
    margin-top: 0;
}

.btn-icon {
    width: 48px; height: 48px;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0;
}

/* ==========================================
   Bottom Sheet / Drawer System
   ========================================== */
.glass-drawer {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px 20px 28px;
    transform: translateY(0);
    transition: transform var(--transition-spring);
    z-index: 50;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.08);
    max-height: 85vh;
    overflow-y: auto;
}
.glass-drawer.hidden-down { transform: translateY(120%); pointer-events: none; }

.drawer-handle {
    width: 36px; height: 4px;
    background: var(--border-light);
    border-radius: 100px;
    margin: 0 auto 16px auto;
}

/* ==========================================
   Input System
   ========================================== */
.input-group { position: relative; margin-bottom: 12px; }

.input-row {
    display: flex; align-items: center; gap: 12px;
    position: relative;
}

.input-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid var(--text-muted);
    background: transparent;
}
.input-dot.pickup { border-color: var(--acc-primary); background: var(--acc-primary); }
.input-dot.dropoff { border-color: var(--acc-blue); background: var(--acc-blue); }

.input-connector {
    position: absolute;
    left: 4px; top: 34px;
    width: 2px; height: calc(100% - 24px);
    background: var(--border-light);
}

.beautiful-input {
    width: 100%;
    background: var(--bg-base);
    border: 2px solid transparent;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem; font-weight: 500;
    outline: none;
    transition: all var(--transition-fast);
}
.beautiful-input::placeholder { color: var(--text-light); font-weight: 400; }
.beautiful-input:focus {
    background: var(--bg-white);
    border-color: var(--acc-primary);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.04);
}

/* Google Places Autocomplete dropdown styling */
.pac-container {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: var(--shadow-lg) !important;
    margin-top: 4px !important;
    font-family: 'Inter', sans-serif !important;
    z-index: 10000 !important;
}
.pac-item {
    padding: 10px 14px !important;
    font-size: 0.9rem !important;
    border-top: 1px solid var(--border-subtle) !important;
    cursor: pointer;
}
.pac-item:first-child { border-top: none !important; }
.pac-item:hover { background: var(--bg-base) !important; }
.pac-item-query { font-weight: 600 !important; color: var(--text-primary) !important; }
.pac-icon { display: none !important; }

/* ==========================================
   Vehicle Selector
   ========================================== */
.vehicle-selector {
    display: flex; gap: 10px;
    overflow-x: auto;
    padding: 4px 0;
    margin: 16px 0;
    scrollbar-width: none;
}
.vehicle-selector::-webkit-scrollbar { display: none; }

.vehicle-option {
    flex: 1; min-width: 0;
    background: var(--bg-base);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 14px 12px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.vehicle-option:hover { border-color: var(--border-light); }
.vehicle-option.selected {
    border-color: var(--acc-primary);
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
}
.vehicle-option .vehicle-icon { font-size: 1.6rem; margin-bottom: 4px; }
.vehicle-option .vehicle-name { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.vehicle-option .vehicle-price { font-size: 0.85rem; font-weight: 800; color: var(--acc-primary); margin-top: 2px; }
.vehicle-option .vehicle-eta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ==========================================
   Fare Estimate Bar
   ========================================== */
.fare-estimate {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0;
    margin-top: 8px;
    border-top: 1px solid var(--border-subtle);
}
.fare-estimate .est-label { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }
.fare-estimate .est-price { font-size: 1.6rem; font-weight: 800; color: var(--acc-primary); letter-spacing: -0.5px; }

.fare-breakdown {
    display: flex; gap: 16px; align-items: center;
}
.fare-detail {
    display: flex; flex-direction: column; align-items: center;
}
.fare-detail .label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.fare-detail .value { font-size: 0.9rem; font-weight: 700; color: var(--text-secondary); }

/* ==========================================
   Ride Info Cards
   ========================================== */
.ride-info-card {
    background: var(--bg-base);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.ride-info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0;
}
.ride-info-row + .ride-info-row { border-top: 1px solid var(--border-subtle); }
.ride-info-row .label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.ride-info-row .value { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }

/* Driver Card (shown to passenger during tracking) */
.driver-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px;
    background: var(--bg-base);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}
.driver-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--border-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; font-weight: 700; color: var(--text-muted);
    flex-shrink: 0;
}
.driver-details { flex: 1; min-width: 0; }
.driver-details .name { font-weight: 700; font-size: 1.05rem; color: var(--text-primary); }
.driver-details .car { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.driver-details .rating { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.driver-fare {
    text-align: right; flex-shrink: 0;
}
.driver-fare .price-label { font-size: 0.72rem; color: var(--text-muted); }
.driver-fare .price { font-size: 1.3rem; font-weight: 800; color: var(--acc-primary); }

/* ==========================================
   Route Summary (shown after directions calculated)
   ========================================== */
.route-summary {
    display: flex; gap: 20px; align-items: center;
    padding: 12px 0;
    margin-bottom: 8px;
}
.route-stat {
    display: flex; flex-direction: column;
}
.route-stat .stat-value { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.route-stat .stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* ==========================================
   Incoming Ride Request (Driver Side)
   ========================================== */
.request-card {
    background: var(--bg-base);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}
.request-card .location-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 0;
}
.request-card .location-row + .location-row { border-top: 1px solid var(--border-subtle); }
.request-card .location-dot {
    width: 8px; height: 8px; border-radius: 50%;
    margin-top: 5px; flex-shrink: 0;
}
.request-card .location-dot.pickup-dot { background: var(--acc-primary); }
.request-card .location-dot.dropoff-dot { background: var(--acc-blue); }
.request-card .location-text {
    font-size: 0.9rem; font-weight: 500; color: var(--text-primary);
}
.request-card .request-fare {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 12px; padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}
.request-card .request-fare .fare-amount {
    font-size: 1.4rem; font-weight: 800; color: var(--acc-primary);
}
.request-card .request-fare .fare-distance {
    font-size: 0.85rem; color: var(--text-muted); font-weight: 500;
}

.action-buttons {
    display: flex; gap: 10px;
}
.action-buttons .btn { flex: 1; margin-top: 0; }

/* ==========================================
   Driver Dashboard Stats
   ========================================== */
.stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px; margin: 16px 0;
}
.stat-card {
    background: var(--bg-base);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    text-align: center;
}
.stat-card .stat-number { font-size: 1.3rem; font-weight: 800; color: var(--acc-primary); }
.stat-card .stat-desc { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* ==========================================
   Landing / Auth Screens
   ========================================== */
.landing-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-white);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 200; padding: 32px 24px;
}
.landing-wrapper h2 {
    font-size: 2.4rem;
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.1;
    color: var(--acc-primary);
    letter-spacing: -1px;
}
.landing-wrapper p {
    color: var(--text-muted);
    margin-bottom: 32px;
    text-align: center;
    font-weight: 500;
    font-size: 0.95rem;
}
.landing-wrapper .btn { max-width: 320px; }

.auth-container {
    width: 100%; max-width: 340px;
}
.auth-container .beautiful-input { margin-bottom: 12px; }
.auth-divider {
    text-align: center;
    color: var(--text-light);
    font-size: 0.8rem;
    margin: 16px 0;
}

/* ==========================================
   Fullscreen Modals / Overlays
   ========================================== */
.overlay-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}
.overlay-modal.visible { opacity: 1; pointer-events: auto; }

.modal-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    padding: 40px 32px;
    border-radius: var(--radius-xl);
    text-align: center;
    width: 85%; max-width: 340px;
    box-shadow: var(--shadow-xl);
}
.modal-card h2 { margin: 16px 0 8px; color: var(--acc-primary); font-size: 1.3rem; }
.modal-card p { color: var(--text-muted); font-weight: 500; font-size: 0.9rem; line-height: 1.5; }

/* ==========================================
   Spinner / Loading
   ========================================== */
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--acc-primary);
    border-radius: 50%;
    animation: spin 0.8s infinite linear;
    margin: 0 auto;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, var(--bg-base) 25%, var(--border-subtle) 50%, var(--bg-base) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ==========================================
   Utility Classes
   ========================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }

/* Section title in drawers */
.section-title {
    font-size: 1.2rem; font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.section-subtitle {
    font-size: 0.85rem; color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 16px;
}

/* ==========================================
   Legal Pages
   ========================================== */
.legal-wrapper {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-white);
    z-index: 500;
    overflow-y: auto;
    color: var(--text-primary);
    line-height: 1.8;
    padding: 48px 24px 48px;
}
.legal-wrapper > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.legal-wrapper h2 { font-size: 2rem; margin-bottom: 0.25rem; color: var(--acc-primary); }
.legal-wrapper h3 { font-size: 1.1rem; margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--acc-primary); }
.legal-wrapper p { color: var(--text-primary); margin-bottom: 0.8rem; }
.legal-wrapper ul { margin: 0.5rem 0 1rem 1.5rem; list-style: disc; padding-left: 1rem; }
.legal-wrapper li { margin-bottom: 0.4rem; display: list-item; }
.legal-wrapper a { color: var(--acc-blue); text-decoration: none; }
.legal-wrapper a:hover { text-decoration: underline; }
.legal-back { display: inline-block; margin-top: 1rem; font-weight: 600; }

/* ==========================================
   Footer
   ========================================== */
.app-footer {
    text-align: center;
    padding: 20px 16px;
    font-size: 0.78rem;
    color: var(--text-light);
}
.app-footer a { color: var(--text-light); text-decoration: none; }
.app-footer a:hover { color: var(--text-muted); }

/* ==========================================
   Responsive — Small phones (< 360px)
   ========================================== */
@media (max-width: 359px) {
    .glass-header { padding: 0 12px; height: 56px; }
    .logo { font-size: 1.3rem; }
    .user-status { font-size: 0.7rem; padding: 4px 10px; }

    .glass-drawer { padding: 16px 14px 20px; }
    .section-title { font-size: 1.05rem; }
    .section-subtitle { font-size: 0.8rem; }

    .beautiful-input { padding: 12px 14px; font-size: 0.88rem; }
    .btn { padding: 14px 16px; font-size: 0.92rem; }

    .vehicle-selector { gap: 6px; }
    .vehicle-option { padding: 10px 8px; }
    .vehicle-option .vehicle-icon { font-size: 1.3rem; }
    .vehicle-option .vehicle-name { font-size: 0.7rem; }
    .vehicle-option .vehicle-price { font-size: 0.78rem; }

    .fare-estimate .est-price { font-size: 1.3rem; }
    .landing-wrapper h2 { font-size: 1.8rem; }
    .landing-wrapper p { font-size: 0.85rem; }

    .driver-card { padding: 12px; gap: 10px; }
    .driver-avatar { width: 42px; height: 42px; font-size: 1.1rem; }
    .driver-fare .price { font-size: 1.1rem; }

    .stats-grid { gap: 6px; }
    .stat-card { padding: 10px 8px; }
    .stat-card .stat-number { font-size: 1.1rem; }
}

/* ==========================================
   Responsive — Standard phones (360–479px)
   ========================================== */
@media (min-width: 360px) and (max-width: 479px) {
    .glass-drawer { padding: 18px 18px 24px; }
}

/* ==========================================
   Responsive — Large phones (480–767px)
   ========================================== */
@media (min-width: 480px) and (max-width: 767px) {
    .glass-drawer {
        max-width: 440px;
        left: 50%;
        transform: translateX(-50%);
    }
    .glass-drawer.hidden-down {
        transform: translateX(-50%) translateY(120%);
    }
    .modal-card { max-width: 380px; }
}

/* ==========================================
   Responsive — Tablets (768–1023px)
   ========================================== */
@media (min-width: 768px) {
    .glass-header { padding: 0 24px; height: 68px; }

    .glass-drawer {
        max-width: 400px;
        left: 20px;
        bottom: 20px;
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-lg);
        max-height: 80vh;
    }
    .glass-drawer.hidden-down { transform: translateY(120%); }

    .landing-wrapper h2 { font-size: 3rem; }
    .landing-wrapper p { font-size: 1.05rem; }
    .auth-container { max-width: 380px; }

    .modal-card { max-width: 400px; width: 70%; }

    .legal-wrapper { padding: 60px 40px; }
}

/* ==========================================
   Responsive — Desktop (1024px+)
   ========================================== */
@media (min-width: 1024px) {
    .glass-header { padding: 0 32px; }

    .glass-drawer {
        max-width: 420px;
        left: 24px;
        bottom: 24px;
        padding: 24px 24px 32px;
    }

    .landing-wrapper h2 { font-size: 3.5rem; }
    .landing-wrapper { padding: 48px; }

    .vehicle-selector { gap: 12px; }
    .vehicle-option { padding: 16px 14px; }

    .stats-grid { gap: 12px; }
    .stat-card { padding: 18px 16px; }
    .stat-card .stat-number { font-size: 1.5rem; }
}

/* ==========================================
   Responsive — Wide desktop (1440px+)
   ========================================== */
@media (min-width: 1440px) {
    .glass-drawer {
        max-width: 440px;
        left: 32px;
        bottom: 32px;
    }
}

/* ==========================================
   Safe area insets (notched phones)
   ========================================== */
@supports (padding-top: env(safe-area-inset-top)) {
    .glass-header {
        padding-top: env(safe-area-inset-top);
        height: calc(64px + env(safe-area-inset-top));
    }
    .glass-drawer {
        padding-bottom: calc(28px + env(safe-area-inset-bottom));
    }
}

/* ==========================================
   Landscape orientation
   ========================================== */
@media (orientation: landscape) and (max-height: 500px) {
    .glass-drawer {
        max-height: 70vh;
        padding: 14px 18px 18px;
    }
    .drawer-handle { margin-bottom: 10px; }
    .section-title { font-size: 1rem; }
    .vehicle-selector { margin: 10px 0; }
    .vehicle-option { padding: 10px 8px; }
    .btn { padding: 12px 16px; }
    .landing-wrapper h2 { font-size: 2rem; }
}

/* ==========================================
   Reduced motion preference
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
