/* ============================================
   Navu Maps - Dark Theme with Teal Accents
   ============================================ */

:root {
    /* Core Colors */
    --bg-primary: #0a0f14;
    --bg-secondary: #111921;
    --bg-elevated: #1a242f;
    --bg-hover: #243040;
    
    /* Accent Colors */
    --accent-primary: #00d4aa;
    --accent-secondary: #00b894;
    --accent-glow: rgba(0, 212, 170, 0.3);
    --accent-subtle: rgba(0, 212, 170, 0.1);
    
    /* Route Colors */
    --route-origin: #ffd93d;
    --route-dest: #ff6b6b;
    --route-line: #00d4aa;
    
    /* Text Colors */
    --text-primary: #f0f4f8;
    --text-secondary: #8b9caa;
    --text-muted: #5a6a7a;
    
    /* Borders */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: var(--accent-primary);
    
    /* Shadows */
    --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 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);
    
    /* Typography */
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   Reset & Base
   ============================================ */

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ============================================
   Map Container
   ============================================ */

#map {
    position: absolute;
    inset: 0;
    z-index: 0;
}

#map canvas {
    outline: none;
}

#map.dragging {
    cursor: grabbing !important;
}

#map.dragging * {
    cursor: grabbing !important;
}

/* Deck.gl tooltip */
.deck-tooltip {
    line-height: 1.4;
}

.deck-tooltip strong {
    color: #00d4aa;
}

.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib-inner,
.maplibregl-ctrl-bottom-right,
.maplibregl-ctrl-bottom-left {
    display: none !important;
}

/* ============================================
   Search Panel
   ============================================ */

.search-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    width: 380px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    overflow: visible;
    animation: slideIn 0.5s var(--transition-slow);
}

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

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--accent-subtle) 0%, transparent 100%);
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo span {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search Container */
.search-container {
    position: relative;
    padding: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.search-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.origin-icon {
    color: var(--route-origin);
}

.dest-icon {
    color: var(--route-dest);
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 400;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
}

.search-box:focus-within .clear-btn,
.search-box:hover .clear-btn {
    opacity: 0.5;
}

.clear-btn:hover {
    opacity: 1 !important;
    background: var(--bg-hover);
}

.clear-btn svg {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

/* Route Connector */
.route-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 32px;
    margin: -4px 0;
}

.connector-line {
    position: absolute;
    left: 26px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--route-origin), var(--route-dest));
    border-radius: 1px;
}

.swap-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.swap-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: rotate(180deg);
}

.swap-btn svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

/* Search Results */
.search-results {
    position: absolute;
    top: 60px; /* Default, will be overridden by JS */
    left: 16px;
    right: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 500;
}

.search-results.active {
    display: block;
    animation: fadeSlideDown 0.2s ease;
}

@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.result-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-address {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Route Info */
.route-info {
    display: none;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--accent-subtle) 0%, transparent 100%);
    animation: fadeIn 0.3s ease;
}

.route-info.active {
    display: block;
}

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

.route-summary {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.route-stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.clear-route-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clear-route-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    border-color: var(--route-dest);
    color: var(--route-dest);
}

.clear-route-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   Map Controls
   ============================================ */

.map-controls {
    position: absolute;
    right: 20px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: slideInRight 0.5s var(--transition-slow);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn:hover {
    background: var(--bg-hover);
}

.control-btn:active {
    background: var(--accent-subtle);
}

.control-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.control-btn:hover svg {
    color: var(--accent-primary);
}

.control-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 8px;
}

/* ============================================
   Loading Overlay
   ============================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 20, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader span {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 14px;
    color: var(--text-primary);
    animation: toastIn 0.3s ease;
}

.toast.error {
    border-color: var(--route-dest);
    background: rgba(255, 107, 107, 0.1);
}

.toast.success {
    border-color: var(--accent-primary);
    background: var(--accent-subtle);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ============================================
   Custom Markers
   ============================================ */

.marker {
    width: 32px;
    height: 42px;
    cursor: pointer;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.marker:hover {
    transform: scale(1.1);
}

.marker-origin {
    color: var(--route-origin);
}

.marker-dest {
    color: var(--route-dest);
}

.user-location {
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 6px var(--accent-glow), var(--shadow-sm);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 6px var(--accent-glow), var(--shadow-sm);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(0, 212, 170, 0.1), var(--shadow-sm);
    }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 480px) {
    .search-panel {
        left: 10px;
        right: 10px;
        width: auto;
        top: 10px;
    }
    
    .map-controls {
        right: 10px;
        bottom: 80px;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
    }
    
    .logo {
        padding: 12px 16px;
    }
    
    .search-container {
        padding: 12px;
    }
    
    .search-box {
        padding: 10px 12px;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

