/* ==========================================================================
   UWS Maps - Global & Layout Reset
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

html, body {
    width: 100vw;
    height: 100vh;
    font-family: 'Inter', sans-serif;
    background-color: #0f172a;
    color: #f8fafc;
    overflow: hidden;
    touch-action: none; /* Native app feel */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Map & UI Layers
   ========================================================================== */
.map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: none; /* Allow clicks to pass through to the map */
    display: flex;
    flex-direction: column;
}

/* Re-enable pointer events for interactive components */
.glass-panel, 
.action-btn, 
.start-nav-btn, 
.cancel-btn, 
input, 
.icon-btn, 
.swap-btn,
.pac-container {
    pointer-events: auto;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* ==========================================================================
   Glassmorphism & Common Panel Styles
   ========================================================================== */
.glass-panel {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Search Panel
   ========================================================================== */
.search-panel {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 380px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: slideInLeft 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
}

.logo-icon {
    color: #a855f7;
    font-size: 1.4rem;
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
}

.ai-badge {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.2), rgba(217, 70, 239, 0.2));
    color: #e879f9;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid rgba(217, 70, 239, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 0 15px rgba(217, 70, 239, 0.15);
}

/* ==========================================================================
   Routing Inputs Area
   ========================================================================== */
.routing-inputs {
    display: flex;
    gap: 16px;
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.route-line-graphic {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #0f172a;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    z-index: 2;
}

.origin-dot {
    background: #ffffff;
}

.dest-dot {
    background: #a855f7;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.8);
}

.line {
    width: 2px;
    flex-grow: 1;
    background: linear-gradient(to bottom, rgba(255,255,255,0.3), rgba(168,85,247,0.5));
    margin: 6px 0;
    border-radius: 2px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    position: relative;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="text"] {
    width: 100%;
    padding: 14px 44px 14px 16px;
    background-color: rgba(0, 0, 0, 0.3);
    background-repeat: no-repeat;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #f8fafc;
    outline: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-family: inherit;
}

input[type="text"]::placeholder {
    color: #64748b;
}

input[type="text"]:focus {
    border-color: #a855f7;
    background-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15);
}

.icon-btn {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.2s ease;
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    transform: scale(1.05);
}

.input-divider {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
}

.swap-btn {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.swap-btn:hover {
    color: #a855f7;
    background: #334155;
    transform: rotate(180deg);
    border-color: rgba(168, 85, 247, 0.4);
}

/* ==========================================================================
   AI Action Button
   ========================================================================== */
.action-btn {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.ai-glow {
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    color: white;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.ai-glow::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.ai-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(217, 70, 239, 0.6);
}

.ai-glow:hover::before {
    left: 150%;
    transition: 0.7s ease-in-out;
}

/* ==========================================================================
   AI Result Panel
   ========================================================================== */
.result-panel {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 440px;
    padding: 24px;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Loading State */
.ai-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px 0;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(217, 70, 239, 0.1);
    border-top-color: #d946ef;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.ai-loading-state p {
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 500;
    animation: pulseText 1.5s infinite;
}

/* Result Content */
.ai-result-content {
    animation: fadeIn 0.5s ease-in;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.eta-text {
    font-size: 2.8rem;
    font-weight: 800;
    color: #2dd4bf;
    margin: 0;
    letter-spacing: -1px;
    line-height: 1;
    text-shadow: 0 0 20px rgba(45, 212, 191, 0.2);
}

.distance-badge {
    background: rgba(45, 212, 191, 0.15);
    color: #5eead4;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(45, 212, 191, 0.3);
    box-shadow: 0 0 10px rgba(45, 212, 191, 0.1);
}

/* AI Insight Box */
.ai-insight-box {
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 24px;
    box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.05);
}

.insight-icon {
    color: #d946ef;
    font-size: 1.6rem;
    margin-top: 2px;
    filter: drop-shadow(0 0 8px rgba(217, 70, 239, 0.4));
    animation: float 3s ease-in-out infinite;
}

.insight-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e2e8f0;
    margin: 0;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 12px;
}

.start-nav-btn {
    flex: 2;
    background: #2dd4bf;
    color: #0f172a;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(45, 212, 191, 0.3);
}

.start-nav-btn:hover {
    background: #14b8a6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 212, 191, 0.4);
}

.cancel-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ==========================================================================
   Google Maps Autocomplete Theming (Proactive UX Touch)
   ========================================================================== */
.pac-container {
    background-color: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6) !important;
    font-family: 'Inter', sans-serif !important;
    margin-top: 8px !important;
}

.pac-item {
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 12px 16px !important;
    color: #94a3b8 !important;
    cursor: pointer;
    transition: background 0.2s;
}

.pac-item:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

.pac-item-query {
    color: #f8fafc !important;
    font-size: 0.95rem;
    font-weight: 600;
}

.pac-matched {
    color: #a855f7 !important;
}

.pac-logo::after {
    filter: invert(1) opacity(0.5); /* Dim dark mode google logo */
}

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

@keyframes pulseText {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translate(-50%, 40px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ==========================================================================
   Responsive Mobile Design
   ========================================================================== */
@media (max-width: 640px) {
    .search-panel {
        top: 16px;
        left: 16px;
        right: 16px;
        width: auto;
        padding: 20px;
    }

    .result-panel {
        bottom: 16px;
        left: 16px;
        right: 16px;
        width: auto;
        transform: none; /* Reset center transform */
        padding: 20px;
        animation: slideUpMobile 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .routing-inputs {
        padding: 12px;
    }

    .eta-text {
        font-size: 2.4rem;
    }

    @keyframes slideUpMobile {
        from { opacity: 0; transform: translateY(40px); }
        to { opacity: 1; transform: translateY(0); }
    }
}
```