html, body {
    background: black;
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
}

#mapid {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-color: #000;
}

#search-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10;
}

#search-box {
    position: relative;
    width: 42px;
    transition: width 0.3s ease;
}

.search-input-container {
    background: rgba(87, 87, 87, 0.4);
    backdrop-filter: blur(8px);
    border-radius: 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    height: 42px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

#search-toggle {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#search-toggle:hover {
    color: rgba(255, 255, 255, 0.8);
}

#favorite-toggle {
    position: absolute;
    top: 82px;
    left: 24px;
    width: 42px;
    height: 42px;
    border: none;
    background: rgba(87, 87, 87, 0.4);
    backdrop-filter: blur(8px);
    border-radius: 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 10;
}

#favorite-toggle:hover {
    color: rgba(255, 255, 255, 0.8);
}

#favorite-toggle.active {
    color: #FFD700;
}

/* Move location toggle to top right */
#location-toggle {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 42px;
    height: 42px;
    border: none;
    background: rgba(87, 87, 87, 0.4);
    backdrop-filter: blur(8px);
    border-radius: 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 10;
}

#location-toggle:hover {
    color: rgba(255, 255, 255, 0.8);
}

#location-toggle.active {
    color: #4285F4;
}

.location-error {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-family: "Open Sans", sans-serif;
    font-size: 14px;
    z-index: 1000;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

@media (max-width: 600px) {
    #favorite-toggle {
        top: 74px;
        left: 16px;
    }
    
    #location-toggle {
        top: 16px;
        left: 16px;
    }
}

#search-input {
    width: 0;
    height: 42px;
    background: transparent;
    border: none;
    color: white;
    padding: 0;
    font-family: "Open Sans", sans-serif;
    font-size: 15px;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

#search-box.expanded {
    width: 300px;
}

#search-box.expanded #search-input {
    width: calc(100% - 58px);
    padding: 0 0 0 16px;
    opacity: 1;
    pointer-events: auto;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

#search-input:focus {
    outline: none;
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(87, 87, 87, 0.95);
    margin-top: 8px;
    border-radius: 20px;
}

.search-result {
    padding: 10px 20px;
    color: white;
    cursor: pointer;
    font-family: "Open Sans", sans-serif;
    transition: background 0.2s;
}

.search-result:hover, .search-result.highlighted {
    background: rgba(255, 255, 255, 0.1);
}

/* Add a more distinct style for the highlighted item */
.search-result.highlighted {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 600px) {
    #search-container {
        top: 16px;
        right: 16px;
        width: calc(100% - 100px);
        max-width: 70%;
    }

    #search-box {
        position: absolute;
        right: 0;
        width: 42px;
        transition: all 0.3s ease;
    }

    .search-input-container {
        position: relative;
        width: 100%;
        background: rgba(87, 87, 87, 0.4);
        backdrop-filter: blur(8px);
        border-radius: 40px;
    }

    #search-toggle {
        position: absolute;
        right: 0;
        background: transparent;
        z-index: 2;
    }

    #search-input {
        position: absolute;
        right: 42px;
        width: 0;
        opacity: 0;
        transition: all 0.3s ease;
        background: transparent;
        padding-left: 16px;
    }

    #search-box.expanded {
        width: 100%;
    }

    #search-box.expanded #search-input {
        width: calc(100% - 106px);
        padding: 0 42px 0 64px;
        opacity: 1;
    }

    #search-results {
        position: absolute;
        top: 100%;
        right: 0;
        width: 100%;
        max-height: 200px;
        margin-top: 4px;
        z-index: 1000;
    }
}

/* MapLibre GL JS zoom controls */
.maplibregl-ctrl-top-left {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
}

.maplibregl-ctrl-group {
    background: none;
    border: none;
    box-shadow: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.maplibregl-ctrl-group button {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    margin: 0;
    padding: 0;
    text-align: center;
    cursor: pointer;
    color: white;
    position: relative;
    display: block;
}

/* Remove the border between buttons */
.maplibregl-ctrl-group button + button {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0;
}

/* Style for the zoom control icons */
.maplibregl-ctrl-icon {
    opacity: 0;
}

/* Custom plus sign for zoom in */
.maplibregl-ctrl-zoom-in::after {
    content: "+";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: bold;
    color: white;
}

/* Custom minus sign for zoom out */
.maplibregl-ctrl-zoom-out::after {
    content: "−";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: bold;
    color: white;
}

/* Hover effect */
.maplibregl-ctrl-group button:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Round only the top corners of the top button */
.maplibregl-ctrl-group button:first-child {
    border-radius: 4px 4px 0 0;
}

/* Round only the bottom corners of the bottom button */
.maplibregl-ctrl-group button:last-child {
    border-radius: 0 0 4px 4px;
}

/* For groups with only one button, round all corners */
.maplibregl-ctrl-group button:only-child {
    border-radius: 4px;
}

/* Custom styling for attribution control only */
.custom-attribution-button {
    width: 30px !important;
    height: 30px !important;
    background: rgba(87, 87, 87, 0.4) !important;
    backdrop-filter: blur(8px) !important;
    border-radius: 40px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;
    color: rgba(255, 255, 255, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    margin: 0 !important;
    padding: 0 !important;
}

.custom-attribution-button:hover {
    color: rgba(255, 255, 255, 0.8) !important;
    background-color: rgba(87, 87, 87, 0.6) !important;
}

.maplibregl-ctrl-attrib-button {
    background-image: none !important;
}

.maplibregl-ctrl-attrib {
    background-color: rgba(0, 0, 0, 0.5) !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
    font-family: "Open Sans", sans-serif !important;
    font-size: 11px !important;
    color: white !important;
}

.maplibregl-ctrl-attrib a {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none !important;
}

.maplibregl-ctrl-attrib a:hover {
    color: white !important;
    text-decoration: underline !important;
}

.maplibregl-ctrl-bottom-right {
    bottom: 10px !important;
    right: 10px !important;
}

/* Make sure the attribution is collapsed by default */
.maplibregl-ctrl-attrib.maplibregl-ctrl-attrib-collapsed {
    display: none !important;
}

@media (max-width: 600px) {
    .maplibregl-ctrl-bottom-right {
        bottom: 80px !important; /* Position below the timeline */
        right: 10px !important;
        z-index: 5 !important;
    }
}

#timeline-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(87, 87, 87, 0.4);
    padding: 6px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    min-width: 500px;
    max-width: calc(100% - 32px);
}

#play-pause {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 4px;
    padding: 0;
    font-size: 20px;
}

#play-pause:hover {
    transform: scale(1.2);
}

#timeline {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 12px;
}

#timeline-track {
    flex-grow: 1;
    height: 6px;
    background: #F0F0F0;
    border-radius: 3px;
    position: relative;
}

#timeline-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: #007AFF;
    border-radius: 3px;
    opacity: 0.8;
}

.time-label {
    font-family: "Open Sans", sans-serif;
    font-size: 15px;
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

/* Style for the radar layers */
.radar-layer {
    pointer-events: none;
}

@media (max-width: 600px) {
    #timeline-container {
        min-width: unset;
        width: 85%;
        max-width: 350px;
        padding: 4px 8px;
        left: 50%;
        transform: translateX(-50%);
    }

    .time-label {
        font-size: 13px;
    }

    #timeline {
        padding-right: 8px;
    }
}

/* Hide zoom controls completely */
.maplibregl-ctrl-group:has(.maplibregl-ctrl-zoom-in, .maplibregl-ctrl-zoom-out) {
    display: none;
}

/* Alternative selectors for browsers that don't support :has() */
.maplibregl-ctrl-zoom-in, 
.maplibregl-ctrl-zoom-out {
    display: none;
}

/* Hide the container if it only contains zoom controls */
.maplibregl-ctrl-group:empty {
    display: none;
}

/* User location marker styling */
.user-location-marker {
    width: 16px;
    height: 16px;
    background-color: rgba(0, 120, 255, 0.6);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(0, 120, 255, 0.4);
    animation: pulse 2s infinite;
    pointer-events: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 120, 255, 0.6);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 120, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 120, 255, 0);
    }
}

/* Timeline end pause effect */
@keyframes timelineEndPulse {
    0% { box-shadow: 0 0 0 0 rgba(29, 161, 242, 0.4); }
    70% { box-shadow: 0 0 0 5px rgba(29, 161, 242, 0); }
    100% { box-shadow: 0 0 0 0 rgba(29, 161, 242, 0); }
}

.timeline-end-pause {
    animation: timelineEndPulse 1s ease-in-out infinite;
}

/* Make the last frame's progress more noticeable */
.timeline-end-pause #timeline-progress {
    opacity: 0.85;
    transition: opacity 0.5s ease;
}
