/*
 * @license
 * Copyright 2025 Google LLC. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

/* Makes the page and map fill the full browser window */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

/* Google map container */
gmp-map {
    height: 100%;
    width: 100%;
}

/* Left-side title/control box */
#controls {
    background-color: white;
    margin: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}

#controls-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#controls h3 {
    font-size: 1.5rem;
    margin: 0;
}

#user-nav {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.user-nav-link {
    font-size: 0.78rem;
    font-weight: 600;
    color: #0039A6;
    text-decoration: none;
    white-space: nowrap;
}

.user-nav-link:hover { text-decoration: underline; }

.user-nav-logout {
    color: #888;
    font-weight: 400;
}

.user-nav-register {
    background: #0039A6;
    color: white !important;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
}

.user-nav-register:hover { background: #002d85; text-decoration: none !important; }

.fav-btn {
    margin-top: 10px;
    display: block;
    width: 100%;
    border: 1.5px solid #ddd;
    background: white;
    border-radius: 8px;
    padding: 6px 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.fav-btn:hover {
    border-color: #f0a500;
    color: #f0a500;
    background: #fffbf0;
}

.fav-btn-active {
    border-color: #f0a500;
    background: #fffbf0;
    color: #d48800;
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

#alerts-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

#alerts-open {
    margin: 12px;
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    font-weight: 600;
    cursor: pointer;
}

#alerts-dashboard {
    width: 360px;
    max-height: 80vh;
    overflow-y: auto;
    background-color: white;
    margin: 12px;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
}
.alert-dropdown-button {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.alert-dropdown-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.alert-dropdown-content.collapsed {
    display: none;
}

.alert-card-arrow {
    font-size: 1rem;
    margin-left: 8px;
}
#filter-toggle {
    margin-top: 8px;
    width: 100%;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#filter-toggle::after {
    content: '▶';
    font-size: 0.7rem;
    transition: transform 0.15s;
}

#filter-toggle.filter-toggle-open::after {
    transform: rotate(90deg);
}

#filter-panel {
    display: none;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
    max-width: 210px;
}

#filter-panel.filter-panel-open {
    display: flex;
}

.filter-btn {
    border: none;
    background: transparent;
    padding: 2px;
    cursor: pointer;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    gap: 2px;
}

.filter-btn-rail {
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.filter-icon {
    width: 26px;
    height: 26px;
    display: block;
}

.filter-btn-off {
    opacity: 0.3;
}

.live-train-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    color: white;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.user-location-dot {
    width: 18px;
    height: 18px;
    position: relative;
    border-radius: 50%;
    background: #147efb;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.user-location-dot::before {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: rgba(20, 126, 251, 0.2);
    animation: user-location-pulse 2s ease-out infinite;
}

@keyframes user-location-pulse {
    0% {
        transform: scale(0.45);
        opacity: 0.85;
    }

    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

#alerts-dashboard h3 {
    margin: 0;
    font-size: 1.2rem;
}

#alerts-status {
    margin: 6px 0 12px;
    font-size: 0.9rem;
    color: #555;
}

.alert-card {
    background-color: #f7f7f7;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #f2c200;
}

.alert-type {
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.alert-card h4 {
    font-size: 0.95rem;
    margin: 6px 0;
    line-height: 1.25;
}

.alert-description {
    font-size: 0.85rem;
    line-height: 1.35;
    margin: 8px 0;
}

.alert-meta {
    font-size: 0.75rem;
    color: #555;
    margin: 0;
}

.route-icon {
    width: 28px;
    height: 28px;
    margin-right: 4px;
    margin-bottom: 4px;
}


@media (max-width: 900px) {
    #controls {
        margin: 8px;
        padding: 8px 12px;
        max-width: calc(100vw - 16px);
    }

    #controls h3 {
        font-size: 1rem;
    }

    #alerts-dashboard {
        position: fixed;
        left: 10;
        right: 0;
        bottom: 0;

        width: 100%;
        max-height: 65vh;
        margin: 0;
        padding: 18px 14px 14px;

        background: white;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.28);

        overflow-y: auto;
        z-index: 99999;

        transform: translateY(100%);
        transition: transform 0.28s ease;
    }

    #alerts-dashboard.open {
        transform: translateY(0);
    }

    #alerts-open {
        position: fixed;
        left: 50%;
        bottom: 22px;
        transform: translateX(-50%);

        margin: 0;
        border: none;
        border-radius: 999px;
        padding: 10px 18px;
        background: white;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);

        font-weight: 700;
        cursor: pointer;
        z-index: 100000;
    }

    .alerts-header {
        position: relative;
        padding-top: 14px;
    }

    .alerts-header::before {
        content: "";
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);

        width: 42px;
        height: 5px;
        border-radius: 999px;
        background: #cfcfcf;
    }

    #alerts-dashboard h3 {
        font-size: 1.1rem;
    }

    .alert-card {
        padding: 12px;
    }

    .alert-dropdown-button {
        min-height: 44px;
    }

    .route-icon {
        width: 24px;
        height: 24px;
    }
}
