/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
}

#map {
    height: 100vh;
    width: 100vw;
    position: absolute;
    top: 0;
    left: 0;
}

/* Google Maps custom control button styling */
.custom-map-control-button {
    background-color: #fff;
    border: 0;
    border-radius: 2px;
    box-shadow: 0 1px 4px -1px rgba(0, 0, 0, 0.3);
    margin: 10px;
    padding: 0 0.5em;
    font: 400 18px Roboto, Arial, sans-serif;
    overflow: hidden;
    height: 40px;
    cursor: pointer;
}

.custom-map-control-button:hover {
    background-color: #f8f8f8;
}

.custom-map-control-button:active {
    background-color: #e8e8e8;
}

/* Bus stop marker animations */
.bus-stop-marker {
    opacity: 0;
    transform: scale(0);
    /* Hardware acceleration for iOS Safari */
    -webkit-transform: translateZ(0) scale(0);
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.bus-stop-marker.spring-in {
    animation: marker-spring 0.5s ease-out forwards;
}

.bus-stop-marker.fade-out {
    animation: marker-fade-out 0.3s ease-in-out forwards;
}

/* Spring animation keyframes */
@keyframes marker-spring {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes marker-fade-out {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.8);
        opacity: 0;
    }
}

/* Blue dot for user location */
.blue-dot {
    width: 20px;
    height: 20px;
    background-color: #4285F4;
    border: 3px solid white;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px rgba(66, 133, 244, 0.5);
}

/* Direction wedge on blue dot */
.direction-wedge {
    position: absolute;
    z-index: -1;
    width: 70px;
    height: 70px;
    bottom: 50%;
    left: 50%;
    transform-origin: 50% 100%;
    margin-left: -35px;
    margin-bottom: -2px;
    pointer-events: none;
    background: linear-gradient(to top, rgba(66, 133, 244, 0.7), rgba(66, 133, 244, 0.05));
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}

/* User location weather badge */
.user-weather-badge {
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 50%;
    padding: 5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    min-width: 34px;
    min-height: 34px;
    border: 2px solid rgba(66, 133, 244, 0.3);
}

/* Visible state with subtle pulse */
.user-weather-badge[style*="opacity: 1"] {
    animation: weather-badge-pulse 2s ease-in-out infinite;
}

@keyframes weather-badge-pulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }
}

.user-weather-badge svg {
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* Debug: Make badge visible for testing */
.user-weather-badge.debug-visible {
    opacity: 1 !important;
    background: #ffeb3b !important;
    animation: debug-spin 2s linear infinite;
}

@keyframes debug-spin {
    from { transform: translateX(-50%) rotate(0deg); }
    to { transform: translateX(-50%) rotate(360deg); }
}

/* Bottom sheet container */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60vh;
    min-height: 450px;
    background-color: #FFFFFF;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.bottom-sheet.active {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .bottom-sheet {
        width: 375px;
        max-width: 40vw;
        height: 100vh;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
        left: 0;
        right: auto;
        transform: translateX(-100%);
    }
    
    .bottom-sheet.active {
        transform: translateX(0);
    }
}

/* Handle bar */
.handle-bar {
    width: 40px;
    height: 5px;
    background-color: #D9D9D9;
    border-radius: 2.5px;
    margin: 12px auto 0;
}

.bottom-sheet-handle {
    width: 40px;
    height: 5px;
    background-color: #D9D9D9;
    border-radius: 2.5px;
    margin: 12px auto 0;
    cursor: grab;
}

@media (min-width: 768px) {
    .handle-bar {
        display: none;
    }
    
    .bottom-sheet-handle {
        display: none;
    }
}

/* Bottom sheet content */
.bottom-sheet-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 28px 24px 0;
}

.bottom-sheet-header {
    padding: 28px 24px 0;
    position: relative;
}

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

.header-left {
    flex: 1;
}

.bus-stop-name {
    font-size: 20px;
    font-weight: 700;
    color: #000000;
    line-height: 24px;
    margin: 0;
    letter-spacing: 0;
}

#busStopTitle {
    font-size: 20px;
    font-weight: 700;
    color: #000000;
    line-height: 24px;
    margin: 0;
    letter-spacing: 0;
}

#busStopTitle .road-name {
    font-size: 14px;
    font-weight: 400;
    color: #808080;
    line-height: 17px;
    margin: 5px 0 0;
    letter-spacing: 0;
    display: block;
}

.road-name {
    font-size: 14px;
    font-weight: 400;
    color: #808080;
    line-height: 17px;
    margin: 5px 0 0;
    letter-spacing: 0;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.refresh-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    align-self: flex-end;
}

.refresh-icon svg {
    transform: rotate(0deg);
}

.last-updated {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 8px;
    line-height: 10px;
    color: #808080;
    gap: 2px;
}

.update-label {
    font-weight: 400;
}

.update-time {
    font-weight: 400;
    font-size: 10px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.close-btn:hover {
    color: #000;
}

/* Divider */
.divider {
    width: 100%;
    height: 1px;
    background-color: #E6E6E6;
    margin-top: 16px;
}

/* Bottom sheet body */
.bottom-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Service row */
.service-row {
    display: flex;
    padding: 10px 0;
    padding-left: 24px;
    margin: 0;
    border-bottom: 1px solid transparent;
    overflow: hidden;
    position: relative;
}

.service-row::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.8) 50%, rgba(255, 255, 255, 1));
    pointer-events: none;
    z-index: 1;
}

.service-row:not(:last-child) {
    margin-bottom: 0;
}

/* Service number */
.service-number {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 76px;
    padding-top: 20px;
}

.service-number .number {
    font-size: 24px;
    font-weight: 700;
    color: #000000;
    line-height: 29px;
    letter-spacing: 0;
}

.service-number .operator {
    font-size: 10px;
    font-weight: 500;
    color: #999999;
    line-height: 12px;
    margin-top: 4px;
    letter-spacing: 0;
}

/* Arrival cards container */
.arrival-cards {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    flex: 1;
    padding-top: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-right: 68px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.arrival-cards::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Arrival card */
.arrival-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 8px 12px;
    background-color: #F5F5F7;
    border: 1px solid #E5E5EB;
    border-radius: 8px;
    min-width: 100px;
    height: 49px;
    gap: 8px;
}

/* Arrival time group */
.arrival-time-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.arrival-text {
    font-size: 13px;
    font-weight: 700;
    color: #333340;
    line-height: 17px;
    letter-spacing: 0;
}

/* Status tags */
.status-tag {
    font-size: 7.25px;
    font-weight: 700;
    line-height: 9px;
    text-align: left;
    letter-spacing: 0;
    margin-top: 0;
}

.status-standing {
    color: #FFA600;
}

.status-crowded {
    color: #E54040;
}

/* Bus icon placeholder */
.bus-icon-placeholder {
    width: 22px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bus-icon-placeholder svg {
    width: 100%;
    height: 100%;
}

/* Bus icon status colors */
.bus-icon-placeholder.status-ok {
    color: #1AB24D;
}

.bus-icon-placeholder.status-standing {
    color: #FFA600;
}

.bus-icon-placeholder.status-crowded {
    color: #E54040;
}

.bus-icon-placeholder.status-default {
    color: white;
}

/* Scrollbar styling */
.bottom-sheet::-webkit-scrollbar {
    width: 0px;
}

.bottom-sheet::-webkit-scrollbar-track {
    background: transparent;
}

.bottom-sheet::-webkit-scrollbar-thumb {
    background: #D9D9D9;
    border-radius: 10px;
}

/* Mobile specific */
@media (max-width: 767px) {
    .bottom-sheet {
        border-radius: 20px 20px 0 0;
    }
}

/* Desktop: center content with max-width */
@media (min-width: 768px) {
    body {
        background-color: #f0f0f0;
        align-items: stretch;
    }
}

/* Retract button for desktop */
.retract-button {
    display: none;
}

@media (min-width: 768px) {
    .retract-button {
        display: flex;
        position: fixed;
        left: min(375px, 40vw);
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 80px;
        background-color: #FFFFFF;
        border-radius: 0 12px 12px 0;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 1000;
        transition: left 0.3s ease;
        border: none;
    }
    
    .retract-button:hover {
        background-color: #F5F5F7;
    }
    
    .retract-button:active {
        background-color: #E5E5EB;
    }
    
    .retract-button.retracted {
        left: 0;
    }
    
    .retract-button svg {
        transition: transform 0.3s ease;
    }
    
    .retract-button.retracted svg {
        transform: rotate(180deg);
    }
}

/* Ensure Inter font is loaded */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

/* Animation for refresh icon */
.refresh-icon:active {
    transform: scale(0.95);
}

.refresh-icon.rotating svg {
    animation: rotate 0.6s ease-in-out;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(-360deg);
    }
}
/* ============================================================================
   WEATHER SYSTEM STYLES
   ============================================================================ */

/* Weather marker container */
.weather-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
}

.weather-marker svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    margin-bottom: 4px;
}

.weather-label {
    background: rgba(255, 255, 255, 0.95);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

/* Weather overlay container */
.weather-overlay {
    pointer-events: none;
    overflow: hidden;
    border-radius: 4px;
}

/* Rain canvas */
.rain-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Cloud animation */
.cloud-animation {
    background: linear-gradient(
        180deg,
        rgba(176, 196, 222, 0.2) 0%,
        rgba(176, 196, 222, 0.05) 100%
    );
    animation: cloud-drift 10s ease-in-out infinite;
}

@keyframes cloud-drift {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.5;
    }
}

/* Fade transitions for markers */
.weather-marker.fade-enter {
    animation: weather-fade-in 0.5s ease-out forwards;
}

.weather-marker.fade-exit {
    animation: weather-fade-out 0.3s ease-in forwards;
}

@keyframes weather-fade-in {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes weather-fade-out {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.5) translateY(-10px);
    }
}

/* Responsive adjustments for weather elements */
@media (max-width: 768px) {
    .weather-marker svg {
        width: 32px;
        height: 32px;
    }
    
    .weather-label {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* Animation for thunderstorm lightning */
@keyframes lightning-flash {
    0%, 100% {
        opacity: 0;
    }
    10%, 30%, 50% {
        opacity: 1;
    }
    20%, 40%, 60% {
        opacity: 0;
    }
}

.weather-overlay.thunderstorm {
    animation: lightning-flash 4s ease-in-out infinite;
}