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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: pan-x pan-y;
    /* Melhorar scroll em mobile */
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
    position: relative;
}

.line-selector {
    margin-top: 0.5rem;
}

.map-container {
    height: calc(100vh - 80px);
    width: 100%;
    position: relative;
}

/* Ajustar quando banner está visível */
body:has(#banner-slider:not(.d-none)) .map-container {
    height: calc(100vh - 280px);
    /* Header + Banner */
}

@media (max-width: 768px) {
    body:has(#banner-slider:not(.d-none)) .map-container {
        height: calc(100vh - 220px);
        height: calc(100dvh - 220px);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.location-button-container {
    position: fixed;
    bottom: 100px;
    /* Acima dos controles de zoom */
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* Estilos para popup da rota */
.route-popup {
    min-width: 200px;
    text-align: left;
}

.route-popup strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #0066cc;
    font-size: 1rem;
}

.route-popup span {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: #666;
}

@media (max-width: 768px) {
    .location-button-container {
        bottom: 80px;
        right: 10px;
    }
}

.location-button-container button {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    touch-action: manipulation;
    /* Evitar double-tap zoom */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.touch-friendly {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
}

.location-button-container button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.location-error {
    background: #ff4444;
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    text-align: left;
    line-height: 1.5;
    animation: slideIn 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.bus-popup {
    min-width: 220px;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.bus-popup strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #0066cc;
    font-size: 1.1rem;
    font-weight: 700;
}

.bus-popup p {
    margin: 0.35rem 0;
    font-size: 0.9rem;
    color: #444;
    display: flex;
    align-items: center;
}

.bus-popup i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    margin-right: 8px;
}

/* Dark Mode Popup Overrides */
body.dark-mode .leaflet-popup-content-wrapper,
body.dark-mode .leaflet-popup-tip {
    background-color: #1e1e1e;
    color: #e0e0e0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

body.dark-mode .bus-popup strong {
    color: #64b5f6;
}

body.dark-mode .bus-popup p {
    color: #ccc;
}

body.dark-mode .leaflet-container a.leaflet-popup-close-button {
    color: #e0e0e0;
}

/* Popup Buttons */
.bus-popup .btn {
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 6px 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.bus-popup .btn-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    border: none;
}

.bus-popup .btn-success:hover {
    background: linear-gradient(135deg, #27ae60 0%, #219150 100%);
    transform: translateY(-1px);
}

.bus-popup .btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border: none;
}

.bus-popup .btn-primary:hover {
    background: linear-gradient(135deg, #2980b9 0%, #2471a3 100%);
    transform: translateY(-1px);
}

.countdown-container {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.countdown-label {
    font-size: 0.85rem;
    color: #666;
}

.countdown-timer {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0066cc;
    background: #e3f2fd;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 35px;
    text-align: center;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Custom bus icon */
.bus-icon-custom {
    background: transparent !important;
    border: none !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.leaflet-div-icon {
    background: transparent !important;
    border: none !important;
}

.leaflet-marker-icon {
    background: transparent !important;
}

.user-location-icon {
    background: transparent !important;
    border: none !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    header {
        padding: 0.75rem 0 !important;
    }

    .mobile-header-title {
        font-size: 0.95rem !important;
        line-height: 1.3;
    }

    .line-selector {
        margin-top: 0;
    }

    .line-selector .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.5rem !important;
    }

    .map-container {
        height: calc(100vh - 100px);
        height: calc(100dvh - 100px);
        /* Dynamic viewport height for mobile */
    }

    .location-button-container {
        bottom: 90px;
        /* Acima dos controles de zoom no mobile */
        right: 15px;
    }

    .location-button-container button {
        width: 56px;
        height: 56px;
        font-size: 1.2rem;
    }

    /* Ajustar controles de zoom do Leaflet */
    .leaflet-control-zoom {
        margin: 10px 10px 60px 10px !important;
        /* Espaço para o botão de localização */
    }

    .location-error {
        max-width: calc(100vw - 40px);
        font-size: 0.8rem;
        padding: 10px;
    }

    .bus-popup {
        min-width: 180px;
        max-width: 90vw;
    }

    .bus-popup strong {
        font-size: 1rem;
    }

    .bus-popup p {
        font-size: 0.85rem;
        margin: 0.2rem 0;
    }

    .countdown-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .countdown-timer {
        font-size: 1rem;
    }

    /* Melhorar toque em elementos interativos */
    .btn,
    button {
        min-height: 44px;
        /* Tamanho mínimo recomendado para touch */
        touch-action: manipulation;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
        /* Evita zoom automático no iOS */
    }

    /* Ajustar controles do Leaflet para mobile */
    .leaflet-control-zoom {
        margin: 10px !important;
    }

    .leaflet-control-zoom a {
        width: 35px !important;
        height: 35px !important;
        line-height: 35px !important;
        font-size: 20px !important;
    }

    .leaflet-popup-content-wrapper {
        border-radius: 8px;
    }

    .leaflet-popup-content {
        margin: 12px 16px;
    }
}

/* Telas muito pequenas */
@media (max-width: 480px) {
    .map-container {
        height: calc(100vh - 110px);
        height: calc(100dvh - 110px);
    }

    header {
        padding: 0.5rem 0 !important;
    }

    .mobile-header-title {
        font-size: 0.85rem !important;
    }

    .input-group {
        font-size: 0.9rem;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .map-container {
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
    }

    header {
        padding: 0.5rem 0 !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .location-button-container button:hover {
        transform: none;
        /* Remover hover em touch devices */
    }

    .location-button-container button:active {
        transform: scale(0.95);
        opacity: 0.8;
    }

    /* Melhorar área de toque */
    .btn-search {
        min-width: 50px;
    }
}

/* Input group responsivo */
.input-group-sm {
    font-size: 0.875rem;
}

@media (min-width: 768px) {
    .input-group-md {
        font-size: 1rem;
    }
}


/* History Chips */
.history-chip {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.history-chip:hover {
    background-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    color: white;
}

.history-chip i {
    font-size: 0.7rem;
    margin-right: 4px;
    opacity: 0.8;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .history-chip {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}

/* Dark Mode Variables */
:root {
    --bg-color: #f8f9fa;
    --text-color: #333;
    --card-bg: #fff;
    --map-filter: none;
    --header-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --input-bg: #fff;
    --input-text: #495057;
    --input-border: #ced4da;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --map-filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
    --header-bg: linear-gradient(135deg, #1a237e 0%, #311b92 100%);
    --input-bg: #2d2d2d;
    --input-text: #e0e0e0;
    --input-border: #444;
}

body.dark-mode {
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.dark-mode header {
    background: var(--header-bg);
}

body.dark-mode .card,
body.dark-mode .bus-popup,
body.dark-mode .route-popup {
    background-color: var(--card-bg);
    color: var(--text-color);
}

body.dark-mode .form-control {
    background-color: var(--input-bg);
    color: var(--input-text);
    border-color: var(--input-border);
}

body.dark-mode .form-control::placeholder {
    color: #888;
}

body.dark-mode .leaflet-layer,
body.dark-mode .leaflet-control-zoom-in,
body.dark-mode .leaflet-control-zoom-out,
body.dark-mode .leaflet-control-attribution {
    filter: var(--map-filter);
}

/* Fix for markers in dark mode (don't invert) */
body.dark-mode .leaflet-marker-icon,
body.dark-mode .leaflet-marker-shadow,
body.dark-mode .leaflet-popup-content-wrapper,
body.dark-mode .leaflet-popup-tip {
    filter: invert(100%) hue-rotate(180deg);
}

/* Theme Toggle Button */
.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* New Bus Stop Icon (Pin Style) */
.bus-stop-icon-custom {
    background: transparent !important;
    border: none !important;
}

.bus-stop-pin {
    width: 30px;
    height: 30px;
    background: #2196F3;
    /* Azul padrão */
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    position: relative;
    top: -10px;
    /* Ajuste visual */
}

.bus-stop-pin i {
    transform: rotate(45deg);
    /* Corrigir rotação do ícone */
    color: white;
    font-size: 14px;
}

.bus-stop-pin.shelter {
    background: #4CAF50;
    /* Verde para abrigo */
}

/* User Location Animation */
.user-location-custom {
    background: transparent !important;
    border: none !important;
}

.user-location-marker {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: white;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 2;
    position: relative;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(66, 133, 244, 0.4);
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
    z-index: 1;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }

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

/* Route Animation */
.route-line-walking {
    animation: dash 1s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -20;
    }
}

/* Bus Trail Animation */
.bus-trail {
    animation: fadeOut 2s linear forwards;
}

@keyframes fadeOut {
    0% {
        opacity: 0.6;
    }

    100% {
        opacity: 0;
    }
}

/* Modern Popup Styles */
.leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: 260px !important;
}

.bus-popup-modern {
    font-family: 'Segoe UI', sans-serif;
    background: #fff;
}

body.dark-mode .bus-popup-modern {
    background: #1e1e1e;
    color: #fff;
}

/* Header */
.popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.line-badge {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.order-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Body */
.popup-body {
    padding: 15px;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.icon-box {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.icon-box.pin {
    background: #e3f2fd;
    color: #1976D2;
}

.icon-box.speed {
    background: #e8f5e9;
    color: #388E3C;
}

body.dark-mode .icon-box.pin {
    background: rgba(25, 118, 210, 0.2);
    color: #64b5f6;
}

body.dark-mode .icon-box.speed {
    background: rgba(56, 142, 60, 0.2);
    color: #81c784;
}

.info-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
}

body.dark-mode .info-text {
    color: #e0e0e0;
}

/* Actions */
.popup-actions {
    display: flex;
    justify-content: space-between;
    padding: 0 15px 15px 15px;
    gap: 10px;
}

.action-btn {
    flex: 1;
    height: 45px;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-route {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}


.btn-share {
    background: linear-gradient(135deg, #25D366, #128C7E);
}

/* Footer */
.popup-footer {
    background: #f5f5f5;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #666;
    border-top: 1px solid #eee;
}

body.dark-mode .popup-footer {
    background: #252525;
    border-top: 1px solid #333;
    color: #aaa;
}

.countdown-mini {
    font-weight: bold;
    color: #764ba2;
}

body.dark-mode .countdown-mini {
    color: #b39ddb;
}

/* Text Truncate */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Favorite Button */
.btn-favorite {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-favorite:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.btn-favorite.active {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.btn-favorite i {
    font-size: 1rem;
}

/* ========== BANNERS NO MAPA ========== */
.map-banner-marker {
    background: transparent !important;
    border: none !important;
}

.map-banner-icon {
    position: relative;
    width: 120px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-banner-placa {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border: 3px solid #667eea;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.map-banner-placa:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.map-banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-banner-popup-wrapper {
    border-radius: 8px;
    padding: 0;
}

.map-banner-popup {
    padding: 10px;
    text-align: center;
}

.map-banner-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.map-banner-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
}

/* Animação de entrada do banner */
@keyframes bannerAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.map-banner-placa {
    animation: bannerAppear 0.5s ease-out;
}

/* Dark mode para banners no mapa */
body.dark-mode .map-banner-placa {
    background: #1e1e1e;
    border-color: #764ba2;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.4);
}

body.dark-mode .map-banner-image {
    filter: brightness(1.2) contrast(1.1) saturate(1.1);
    /* Aumenta brilho, contraste e saturação para melhor visibilidade no modo escuro */
}

body.dark-mode .map-banner-placa:hover .map-banner-image {
    filter: brightness(1.3) contrast(1.15) saturate(1.15);
}

body.dark-mode .map-banner-link {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ========== MARCADORES DE PONTOS FINAIS DOS ITINERÁRIOS ========== */
.route-end-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

.route-end-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.route-end-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-bottom: 5px;
    position: relative;
    z-index: 2;
}

.route-start .route-end-icon {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border: 3px solid white;
}

.route-end .route-end-icon {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    border: 3px solid white;
}

.route-end-label {
    background: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    max-width: 120px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 2px solid #667eea;
}

.route-start .route-end-label {
    border-color: #4CAF50;
}

.route-end .route-end-label {
    border-color: #f44336;
}

.route-end-popup {
    text-align: center;
    padding: 5px;
}

.route-end-popup strong {
    display: block;
    margin-bottom: 5px;
    color: #667eea;
    font-size: 1rem;
}

.route-end-popup span {
    display: block;
    margin: 3px 0;
    font-size: 0.85rem;
    color: #666;
}

.route-end-popup .address-info {
    display: block;
    margin-top: 8px;
    padding: 6px 10px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #333;
    border-left: 3px solid #667eea;
}

.route-end-popup .loading-address {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

/* Dark mode para marcadores de pontos finais */
body.dark-mode .route-end-label {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: #764ba2;
}

body.dark-mode .route-start .route-end-label {
    border-color: #4CAF50;
}

body.dark-mode .route-end .route-end-label {
    border-color: #f44336;
}

body.dark-mode .route-end-popup strong {
    color: #764ba2;
}

body.dark-mode .route-end-popup span {
    color: #ccc;
}

body.dark-mode .route-end-popup .address-info {
    background: #2d2d2d;
    color: #e0e0e0;
    border-left-color: #764ba2;
}

body.dark-mode .route-end-popup .loading-address {
    color: #888;
}

/* Animação de entrada */
@keyframes routeMarkerAppear {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.route-end-marker {
    animation: routeMarkerAppear 0.5s ease-out;
}

/* ========== POPUP DE PONTOS DE ÔNIBUS COM LINHAS ========== */
.bus-stop-popup {
    min-width: 250px;
    max-width: 300px;
}

.bus-stop-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.bus-stop-header strong {
    color: #667eea;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bus-stop-distance {
    margin: 8px 0;
    color: #666;
    font-size: 0.85rem;
}

.bus-stop-lines {
    margin: 12px 0;
    max-height: 200px;
    overflow-y: auto;
}

.lines-header {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lines-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.line-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid #667eea;
}

.line-item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.line-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 50px;
    text-align: center;
}

.line-destination {
    flex: 1;
    font-weight: 500;
    color: #333;
    font-size: 0.85rem;
}

.line-direction {
    font-size: 0.75rem;
    color: #666;
    background: #e0e0e0;
    padding: 2px 8px;
    border-radius: 10px;
}

.line-proximity {
    color: #2196F3;
    font-weight: 600;
    margin-left: 4px;
}

.loading-lines,
.no-lines,
.error-lines {
    text-align: center;
    padding: 15px;
    color: #666;
    font-size: 0.85rem;
}

.error-lines {
    color: #f44336;
}

/* Dark mode para popup de pontos de ônibus */
body.dark-mode .bus-stop-header {
    border-bottom-color: #444;
}

body.dark-mode .bus-stop-header strong {
    color: #764ba2;
}

body.dark-mode .bus-stop-distance {
    color: #aaa;
}

body.dark-mode .line-item {
    background: #2d2d2d;
    border-left-color: #764ba2;
}

body.dark-mode .line-item:hover {
    background: #3d3d3d;
    box-shadow: 0 2px 8px rgba(118, 75, 162, 0.3);
}

body.dark-mode .line-number {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

body.dark-mode .line-destination {
    color: #e0e0e0;
}

body.dark-mode .line-direction {
    color: #aaa;
    background: #444;
}

body.dark-mode .line-proximity {
    color: #64b5f6;
}

body.dark-mode .loading-lines,
body.dark-mode .no-lines {
    color: #aaa;
}

body.dark-mode .error-lines {
    color: #f44336;
}

/* ========== TEMPO DE CHEGADA DO PRÓXIMO ÔNIBUS ========== */
.arrival-time-section {
    margin: 12px 0;
    padding: 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f5f5f5 100%);
    border-radius: 10px;
    border-left: 4px solid #2196F3;
    text-align: center;
}

.arrival-time-header {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
}

.arrival-time-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2196F3;
    margin: 8px 0;
    line-height: 1;
}

.arrival-time-value.no-bus {
    font-size: 1rem;
    color: #999;
    font-weight: 500;
}

.arrival-time-details {
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
}

/* Dark mode para tempo de chegada */
body.dark-mode .arrival-time-section {
    background: linear-gradient(135deg, #2d2d2d 0%, #1e1e1e 100%);
    border-left-color: #64b5f6;
}

body.dark-mode .arrival-time-header {
    color: #aaa;
}

body.dark-mode .arrival-time-value {
    color: #64b5f6;
}

body.dark-mode .arrival-time-value.no-bus {
    color: #666;
}

body.dark-mode .arrival-time-details {
    color: #aaa;
}

/* ========== LISTA DE MÚLTIPLOS ÔNIBUS ========== */
.arrival-buses-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.arrival-bus-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    border-left: 3px solid #2196F3;
    transition: all 0.2s ease;
}

.arrival-bus-item.first {
    border-left-color: #4CAF50;
    background: linear-gradient(135deg, #e8f5e9 0%, #fff 100%);
}

.arrival-bus-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.arrival-bus-time {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2196F3;
    min-width: 60px;
    text-align: center;
}

.arrival-bus-item.first .arrival-bus-time {
    color: #4CAF50;
    font-size: 1.8rem;
}

.arrival-bus-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.arrival-bus-details {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.arrival-bus-line {
    font-weight: 600;
    color: #333;
}

.arrival-bus-order {
    color: #666;
    font-size: 0.85rem;
}

.arrival-bus-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: #666;
}

.arrival-bus-distance {
    display: flex;
    align-items: center;
    gap: 4px;
}

.arrival-bus-speed {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #2196F3;
    font-weight: 600;
}

/* Dark mode para lista de ônibus */
body.dark-mode .arrival-bus-item {
    background: #2d2d2d;
    border-left-color: #64b5f6;
}

body.dark-mode .arrival-bus-item.first {
    border-left-color: #81c784;
    background: linear-gradient(135deg, #1b5e20 0%, #2d2d2d 100%);
}

body.dark-mode .arrival-bus-item:hover {
    box-shadow: 0 2px 8px rgba(100, 181, 246, 0.3);
}

body.dark-mode .arrival-bus-time {
    color: #64b5f6;
}

body.dark-mode .arrival-bus-item.first .arrival-bus-time {
    color: #81c784;
}

body.dark-mode .arrival-bus-line {
    color: #e0e0e0;
}

body.dark-mode .arrival-bus-order {
    color: #aaa;
}

body.dark-mode .arrival-bus-meta {
    color: #aaa;
}

body.dark-mode .arrival-bus-speed {
    color: #64b5f6;
}

/* ========== MARCADOR DO PONTO MAIS PRÓXIMO DA ROTA ========== */
.closest-route-point-marker {
    background: transparent;
    border: none;
}

.closest-route-point-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: closestPointAppear 0.5s ease-out;
}

.closest-route-point-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
    border: 3px solid #fff;
}

.closest-route-point-icon i {
    transform: rotate(45deg);
    color: #fff;
    font-size: 18px;
}

.closest-route-point-label {
    margin-top: 4px;
    background: rgba(255, 152, 0, 0.95);
    color: #fff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
}

.closest-route-point-popup {
    min-width: 250px;
    max-width: 300px;
}

.closest-route-point-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ff9800;
}

.closest-route-point-header strong {
    color: #ff9800;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.closest-route-point-info {
    margin: 12px 0;
    padding: 12px;
    background: #fff3e0;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
}

.closest-route-point-info p {
    margin: 8px 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

.closest-route-point-info p:first-child {
    color: #e65100;
    font-weight: 600;
}

.closest-route-point-info i {
    margin-right: 6px;
    color: #ff9800;
}

/* Dark mode para marcador do ponto mais próximo */
body.dark-mode .closest-route-point-icon {
    background: linear-gradient(135deg, #ff9800 0%, #e65100 100%);
    border-color: #1e1e1e;
}

body.dark-mode .closest-route-point-label {
    background: rgba(255, 152, 0, 0.9);
    border-color: #1e1e1e;
}

body.dark-mode .closest-route-point-header {
    border-bottom-color: #ff9800;
}

body.dark-mode .closest-route-point-header strong {
    color: #ffb74d;
}

body.dark-mode .closest-route-point-info {
    background: #2d2d2d;
    border-left-color: #ff9800;
}

body.dark-mode .closest-route-point-info p {
    color: #ccc;
}

body.dark-mode .closest-route-point-info p:first-child {
    color: #ffb74d;
}

body.dark-mode .closest-route-point-info i {
    color: #ffb74d;
}

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