:root {
    --bg-color: #0f172a;
    --card-bg: rgba(15, 23, 42, 0.4); 
    --accent: #007aff; 
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --border: rgba(255, 255, 255, 0.1);
    --header-bg: rgba(15, 23, 42, 0.3);
    --shadow-depth: 0 10px 30px rgba(0, 0, 0, 0.3);
    --accent: #3498db;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-color: #f8fafc;
        --card-bg: rgba(255, 255, 255, 0.5); 
        --accent: #007aff;
        --text-primary: #1e293b;
        --text-secondary: #64748b;
        --border: rgba(0, 0, 0, 0.08);
        --header-bg: rgba(255, 255, 255, 0.4);
    }
}

html, body {
    margin: 0; padding: 0;
    height: 100dvh; width: 100vw;
    position: fixed; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
}

#map {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%; z-index: 1;
}

.nav-header {
    position: absolute; top: 0; left: 0; right: 0;
    padding-top: env(safe-area-inset-top);
    height: calc(54px + env(safe-area-inset-top));
    background: var(--header-bg);
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border-bottom: 0.5px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    z-index: 1001;
}

.nav-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }

/* Unified Button Styling */
.ui-btn {
    position: absolute;
    top: calc(75px + env(safe-area-inset-top));
    width: 48px; height: 48px;
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid var(--border);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    z-index: 1000;
    box-shadow: var(--shadow-depth);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-left { left: 16px; }
.top-right { right: 16px; }
.ui-btn:active { transform: scale(0.9); background: var(--accent); color: white; }

/* Status Card */
.status-card {
    position: absolute;
    bottom: calc(30px + env(safe-area-inset-bottom));
    left: 16px; right: 16px;
    max-width: 450px; margin: 0 auto;
    background: var(--card-bg);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    z-index: 1000;
    box-shadow: var(--shadow-depth);
}

.status-label { font-size: 11px; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 8px; }
.status-value { font-size: 2.2rem; font-weight: 900; line-height: 1; margin-bottom: 16px; color: var(--text-primary); }
.divider { height: 1px; background: var(--border); margin-bottom: 16px; }
.sync-time { font-family: monospace; font-weight: 600; font-size: 0.85rem; color: var(--accent); }

/* Modal Styling */
.modal-overlay {
    display: none; position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(10px);
    z-index: 2000; justify-content: center; align-items: center;
}

.modal-content {
    width: 90%;
    max-width: 480px;
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    /* High saturation makes the map colors "pop" through the fade */
    backdrop-filter: blur(30px) saturate(210%);
    -webkit-backdrop-filter: blur(30px) saturate(210%);
    border-radius: 28px;
    border: 1px solid var(--border);
    padding: 24px;
    color: var(--text-primary);
    box-shadow: var(--shadow-depth);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border); /* Visual separator for the list */
    margin-bottom: 5px;
}

.modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
#close-modal { background: none; border: none; color: var(--text-primary); font-size: 20px; cursor: pointer; }

.travel-item { padding: 12px 0; border-bottom: 0.5px solid var(--border); }
.travel-date { font-size: 11px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.travel-name { display: block; font-weight: 700; }
.travel-type { font-size: 13px; color: var(--text-secondary); }

.travel-list {
    flex: 1;
    max-height: 60vh;
    overflow-y: auto;
    /* Added 60px of padding so the last item doesn't get stuck in the fade */
    padding-bottom: 60px; 
    padding-right: 8px;
    margin-top: 10px;
    -webkit-overflow-scrolling: touch;
    
    /* Adjusted the mask to start later (90% instead of 85%) for a subtler effect */
    -webkit-mask-image: linear-gradient(to bottom, black 90%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 90%, transparent 100%);
}

/* Hide the scrollbar so it doesn't break the "clean" fade look */
.travel-list::-webkit-scrollbar {
    display: none;
}

.travel-list::-webkit-scrollbar {
    display: none;
}

.travel-list::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

/* Marker */
.pulse-marker { background: none !important; border: none !important; }
.inner-dot {
    width: 14px; height: 14px; background-color: var(--accent);
    border: 3px solid #ffffff; border-radius: 50%;
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.5);
    animation: pro-pulse 2.5s infinite ease-in-out;
}
@keyframes pro-pulse {
    0%, 100% { transform: scale(0.9); }
    50% { transform: scale(1.1); box-shadow: 0 0 30px var(--accent); }
}

.plane-icon-svg {
    filter: drop-shadow(0px 0px 4px #00d2ff);
    transition: transform 0.5s ease-in-out; /* Makes the plane "turn" smoothly if the heading updates */
}