/* Design System */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #10b981;
    --dark: #0f172a;
    --light: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--light);
    color: var(--dark);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Glass Navbar */
.glass-navbar {
    height: 70px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    box-shadow: var(--shadow-sm);
    z-index: 2000; /* Above Leaflet map (z-index 400-1000) */
    position: relative;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    cursor: pointer;
}

.brand-icon {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
}

/* Search Bar */
.nav-center {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
}

.clear-search {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s;
}

.clear-search:hover { color: #475569; }

#searchInput {
    width: 100%;
    height: 46px;
    border-radius: 23px;
    border: 2px solid transparent;
    background: #f1f5f9;
    padding: 0 45px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark);
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

#searchInput:focus {
    outline: none;
    border-color: #c7d2fe;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2001;
}

.search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.05em;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-list li {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.2s;
}

.dropdown-list li:hover { background: #f1f5f9; }

.route-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.route-name {
    font-weight: 500;
    color: #334155;
    font-size: 0.95rem;
}

/* Nav Actions */
.nav-actions {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.mobile-menu-btn { display: none; }

/* Main Map */
.map-wrapper {
    flex: 1;
    position: relative;
    width: 100%;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #e2e8f0;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-weight: 600;
    color: var(--primary);
    transition: opacity 0.5s;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e7ff;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Floating map controls */
.floating-controls {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.floating-btn {
    background: white;
    color: var(--dark);
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.floating-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content.glass-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.5);
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-header h2 { font-size: 1.25rem; }

.info-inputs p{
    font-size: 0.75rem;
    color: #94a3b8;
}

.info-inputs .success-message{
    color: var(--secondary);
}

.info-inputs .error-message{
    color: #ef4444;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}

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

.modal-body { padding: 24px; }

.user-info-section {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 40px;
    background: #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    color: #94a3b8;
}

.info-inputs {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-inputs label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
}

.info-inputs input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.info-inputs input:focus { border-color: var(--primary); }

.save-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: auto;
    transition: background 0.2s;
}

.save-btn:hover { background: var(--primary-hover); }

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.text-btn {
    background: transparent;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.text-btn.danger { color: #ef4444; }
.text-btn.danger:hover { text-decoration: underline; }

.history-list-container {
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    max-height: 200px;
    overflow-y: auto;
}

.history-list { list-style: none; }

.history-list li {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: #334155;
}
.history-list li:last-child { border-bottom: none; }

.history-route-action {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 6px;
}
.history-route-action:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.2);
}

/* Markers */
.terminus-marker {
    background: white;
    border: 3px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    font-weight: 900;
}

.info-item .terminal-info-container, .integration-container{
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

.fa-circle-info{
    cursor: pointer;
}

.integration-container .info-label, .integration-more-info i, .fa-ticket{
    color: var(--secondary);
}

.terminal-info-box {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 25px 30px;
}

.terminal-section-card {
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    padding: 14px;
}

.terminal-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.terminal-header .header-title {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.terminal-main-info{
    display: flex;
    flex-direction: column;
    gap: 12px;
    
}
.terminal-main-info hr{
    border: none;
    border-top: 1px solid #f1f5f9;
    padding: 5px 0;
}
.terminal-back-link {
    width: fit-content;
    text-decoration: none;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
}

.terminal-back-link:hover {
    color: #1e293b;
}

.terminal-title {
    margin: 0;
    color: #0f172a;
}

.terminal-detail-item .integration-name{
    display: flex;
    align-items: center;
}

#galery_container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.galery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.galery img {
    width: 100%;
    min-width: 240px;
    max-width: 360px;
    height: 190px;
    object-fit: cover;
    border-radius: 12px;
    flex: 0 0 auto;
}

.terminal-empty-state {
    width: 100%;
    text-align: center;
    color: #94a3b8;
    font-size: 0.88rem;
    line-height: 1.4;
    background: white;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 18px 12px;
}

.bus-here-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bus-line-item {
    align-items: center;
}

.bus-line-badge {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
}

.terminal-detail-item {
    margin-bottom: 0;
}

.terminal-integration-positive {
    color: #059669;
}

.terminal-integration-negative {
    color: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-center {
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--glass-bg);
        padding: 10px 20px;
        max-width: 100%;
        box-shadow: var(--shadow-sm);
        display: none; /* toggled by JS */
    }
    .nav-center.active { display: block; }
    .mobile-menu-btn { display: flex; }
    .floating-controls { bottom: 20px; right: 20px; }
    .terminal-info-box { padding: 18px 20px 24px; }
}

/* Botão de favoritar */
.favorite-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: white; 
    padding: 12px 20px; 
    border-radius: 20px; 
    border: 2px solid #fbbf24;
    cursor: pointer;
    display: flex;
    gap: 8px; 
    z-index: 1000;
}
.favorite-btn:hover {
    background: #fbbf24; 
    color: white; 
    transform: translateY(-2px);    
}
.favorite-btn.favorited{
    background: #fbbf24; 
    color: white;
}
/*toast de feedback */
.toast{
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: white;
    padding: 16px 24px;
    border-radius: 12px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    gap: 12px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 5000; 
}
.toast.show{
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-sucess{
    border-left: 4px solid #10b981;
}

.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 12px 20px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}
.favorites-list {
    list-style: none;
}

.favorites-list li {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.view-favorite-btn {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
}

/* AI Chat Assistant Sidebar */
.ai-nav-btn {
    color: #059669;
}
.ai-nav-btn:hover {
    color: white !important;
    background: #059669 !important;
}

.chat-assistant-container {
    position: fixed;
    top: 70px; /* starts below the 70px navbar */
    left: 0;
    width: 350px;
    height: calc(100vh - 70px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 1500; /* between map and navbar */
    transform: translateX(-100%);
    opacity: 1;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s linear;
    border: var(--light) solid 2.5px;
}

.chat-assistant-container.active {
    transform: translateX(0);
    visibility: visible;
}

.chat-header {
    background: #059669;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #4ade80;
    border: 2px solid #059669;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

.chat-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.chat-status {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-close-btn:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    background: #efe7de;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-repeat: repeat;
    background-size: 400px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    animation: messageReveal 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes messageReveal {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message p {
    margin-bottom: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: rgba(0,0,0,0.4);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.user-message .message-time::after {
    content: "\f33d";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #34b7f1;
    font-size: 0.8rem;
}

.ai-message {
    background: white;
    align-self: flex-start;
    border-top-left-radius: 0;
    color: #111b21;
    border: 1px solid rgba(0,0,0,0.05);
}

.user-message {
    background: #dcf8c6;
    align-self: flex-end;
    border-top-right-radius: 0;
    color: #111b21;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 6px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.chat-input-area {
    padding: 12px;
    background: #f0f2f5;
    display: flex;
    gap: 10px;
    border-top: 1px solid #ddd;
}

.chat-input-area input {
    flex: 1;
    border: none;
    border-radius: 20px;
    padding: 12px 16px;
    background: white;
    font-size: 0.95rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    outline: none;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #059669;
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: #047857;
}

/* BOTÃO FAVORITOS NA NAVBAR */
.fav-nav-btn {
    color: #fbbf24;
}
.fav-nav-btn:hover {
    background: #fef3c7 !important;
    color: #d97706 !important;
}

/*MARCADOR DE LOCALIZAÇÃO DO USUÁRIO*/
.user-location-marker {
    background: none !important;
    border: none !important;
}

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

.user-pulse {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid #3b82f6;
    border-radius: 50%;
    animation: userMarkerPulse 2s infinite;
}

@keyframes userMarkerPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* MARCADORES DE PARADAS/TERMINAIS PRÓXIMOS */
.nearby-stop-marker {
    background: none !important;
    border: none !important;
}

.stop-marker-content {
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.stop-marker-content:hover {
    transform: scale(1.15);
}

.stop-marker-content i {
    color: #10b981;
    font-size: 16px;
}

/*MARCADORES DE PARADAS DA ROTA SELECIONADA*/
.route-stop-marker {
    background: none !important;
    border: none !important;
}

.route-stop-dot {
    width: 28px;
    height: 28px;
    background: white;
    border: 2.5px solid currentColor;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* PAINEL LATERAL DE INFORMAÇÕES*/
.route-panel {
    position: fixed;
    right: -400px;
    top: 70px;
    width: 360px;
    height: calc(100vh - 80px);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px 0 0 20px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    transition: right 0.3s ease;
    z-index: 1200;
    overflow-y: auto;
}

.route-panel.active {
    right: 0;
}

.close-panel-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.close-panel-btn:hover {
    background: rgba(0, 0, 0, 0.15);
    color: #1e293b;
    transform: scale(1.1);
}

/* Cabeçalho do painel com cor da rota */
.panel-route-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-top: 8px;
    padding-right: 40px;
}

.panel-route-color-bar {
    width: 6px;
    height: 48px;
    border-radius: 4px;
    flex-shrink: 0;
}

.panel-route-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.panel-route-id {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* Seção de paradas no painel */
.panel-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 10px;
    margin-top: 16px;
}

.panel-stops-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.panel-stop-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 10px;
    font-size: 0.88rem;
    color: #334155;
    border: 1px solid #f1f5f9;
}

.panel-stop-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    color: white;
}

/* Grade de metadados da rota (tarifa, duração, tipo, etc.) */
.panel-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 4px;
}

.panel-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    padding: 10px 12px;
}

.panel-meta-icon {
    font-size: 1.1rem;
}

.panel-meta-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.panel-meta-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
}

.panel-nearby-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f0fdf4;
    border-radius: 10px;
    font-size: 0.88rem;
    color: #166534;
    border: 1px solid #bbf7d0;
    margin-bottom: 6px;
}

.panel-nearby-item i {
    color: #10b981;
    font-size: 1rem;
}

/* Responsive: painel ocupa tela inteira em mobile */
@media (max-width: 768px) {
    .route-panel {
        width: 100%;
        border-radius: 20px 20px 0 0;
        top: auto;
        bottom: -100vh;
        right: 0;
        height: 70vh;
        transition: bottom 0.3s ease;
    }
    .route-panel.active {
        bottom: 0;
        right: 0;
    }
}

/* LEGENDA IDA / VOLTA */
.route-direction-legend {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 12px;
}

.direction-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.direction-bar {
    display: inline-block;
    width: 32px;
    height: 5px;
    border-radius: 3px;
}

/*SIDEBAR UNIFICADA*/
.info-sidebar {
    position: fixed;
    right: -420px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2500;
    overflow-y: auto;
}

.info-sidebar.active {
    right: 0;
}

.sidebar-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1rem;
    z-index: 10;
    transition: all 0.3s ease;
}

.sidebar-close-btn:hover {
    background: rgba(0, 0, 0, 0.15);
    color: #1e293b;
    transform: scale(1.1);
}

.sidebar-header {
    padding: 30px 25px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.sidebar-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 15px;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
    line-height: 1.3;
    padding-right: 40px;
}

.sidebar-body {
    padding: 20px 25px 30px;
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin: 18px 0 8px;
}

/* Itens de informação */
.info-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    transition: background 0.2s;
}

.info-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.info-item i {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.info-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 2px;
}

.info-value {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

/* Botão de ação (Como chegar) */
.sidebar-action-btn {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.sidebar-action-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

/* Botão favoritar na sidebar */
.sidebar-fav-btn {
    width: 100%;
    margin-top: 12px;
    padding: 13px;
    background: white;
    color: #f59e0b;
    border: 2px solid #fbbf24;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.sidebar-fav-btn:hover,
.sidebar-fav-btn.favorited {
    background: #fbbf24;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

/* Popup de integração */
.integration-info-container,
.integration-info-popup {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 4200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: integrationFadeIn 0.2s ease-out;
}

.integration-info,
.integration-info-content {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 20px;
    animation: integrationCardIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.integration-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.integration-header p,
.integration-info-text {
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

.integration-header a {
    width: fit-content;
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}

.integration-header a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.back-btn,
.integration-info-close {
    margin-top: 16px;
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--primary);
    color: white;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover,
.integration-info-close:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

@keyframes integrationFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes integrationCardIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* TOGGLE DE ANIMAÇÃO */
.animation-control {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px;
    margin: 14px 0 0;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
}


/* Responsive sidebar */
@media (max-width: 768px) {
    .info-sidebar {
        width: 100%;
        right: auto;
        bottom: -100vh;
        top: auto;
        left: 0;
        height: 80vh;
        border-radius: 20px 20px 0 0;
        transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    }
    .info-sidebar.active {
        bottom: 0;
        right: auto;
    }
}

/* ========== BOTTOM NAVIGATION BAR ========== */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.6);
    z-index: 2000;
}

.bottom-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1.35rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bottom-nav-btn:hover {
    transform: translateY(-3px);
}

.bottom-nav-btn:active {
    transform: translateY(0) scale(0.95);
}

/* Home button */
.home-nav-btn {
    color: #3b82f6;
}
.home-nav-btn:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

/* Linhas button */
.linhas-nav-btn {
    color: var(--primary);
}
.linhas-nav-btn:hover {
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* Favoritos button */
.fav-bottom-btn {
    color: #f59e0b;
}
.fav-bottom-btn:hover {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

/* Chatbot button */
.ai-bottom-btn {
    color: #059669;
}
.ai-bottom-btn:hover {
    background: rgba(5, 150, 105, 0.12);
    color: #047857;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

/* Responsive: Bottom nav on mobile */
@media (max-width: 768px) {
    .bottom-nav {
        bottom: 12px;
        gap: 12px;
        padding: 8px 16px;
    }
    .bottom-nav-btn {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

/* ==========================================
   Nearby Places Recommendations
   ========================================== */

.nearby-places-container {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 1200;
    pointer-events: none;
}

@media (min-width: 769px) {
    body.chat-open .nearby-places-container {
        left: 350px;
    }
}

/* Category Bar */
.nearby-category-bar {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    overflow-x: auto;
    pointer-events: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nearby-category-bar::-webkit-scrollbar {
    display: none;
}

.nearby-category-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #334155;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nearby-category-btn:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.nearby-category-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.nearby-category-btn.active i {
    color: white;
}

.nearby-category-btn i {
    font-size: 0.85rem;
    color: #64748b;
    transition: color 0.3s;
}

.nearby-category-btn:hover i {
    color: var(--primary);
}

/* Expandable Panel */
.nearby-panel {
    max-height: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    margin: 0 16px;
    border-radius: 0 0 20px 20px;
    box-shadow: none;
    pointer-events: auto;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease,
                margin-top 0.3s ease;
}

.nearby-panel.open {
    max-height: 420px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.06);
    margin-top: -4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Custom scrollbar for panel */
.nearby-panel::-webkit-scrollbar { width: 5px; }
.nearby-panel::-webkit-scrollbar-track { background: transparent; }
.nearby-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Panel Header */
.nearby-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 10px;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    z-index: 2;
}

.nearby-panel-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nearby-panel-header h3 i {
    color: var(--primary);
    font-size: 0.95rem;
}

.nearby-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Place List */
.nearby-list {
    padding: 4px 12px 16px;
}

/* Place Card */
.nearby-place-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    animation: slideUp 0.3s ease forwards;
    opacity: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nearby-place-card:hover {
    background: #f1f5f9;
    transform: translateX(4px);
}

.nearby-place-card:active {
    transform: scale(0.98);
}

/* Place Icon */
.nearby-place-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.nearby-place-icon.restaurants {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
}

.nearby-place-icon.attractions {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
}

.nearby-place-icon.cafes {
    background: linear-gradient(135deg, #fce7f3, #fbcfe8);
    color: #db2777;
}

.nearby-place-icon.supermarkets {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
}

/* Place Info */
.nearby-place-info {
    flex: 1;
    min-width: 0;
}

.nearby-place-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.nearby-place-type {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 500;
}

/* Distance Badge */
.nearby-place-distance {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    background: #eef2ff;
    padding: 6px 12px;
    border-radius: 20px;
    flex-shrink: 0;
}

.nearby-place-distance i {
    font-size: 0.7rem;
}

/* Loading State */
.nearby-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 30px 20px;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

.nearby-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #e0e7ff;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Empty State */
.nearby-empty {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
}

.nearby-empty i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #cbd5e1;
}

.nearby-empty p {
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}

.nearby-empty span {
    font-size: 0.82rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nearby-category-bar {
        padding: 10px 14px;
        gap: 8px;
    }

    .nearby-category-btn {
        padding: 8px 16px;
        font-size: 0.82rem;
    }

    .nearby-panel.open {
        max-height: 320px;
        margin: 0 10px;
    }

    .nearby-place-card {
        padding: 12px;
        gap: 10px;
    }

    .nearby-place-icon {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }

    .nearby-place-name {
        font-size: 0.85rem;
    }

    .nearby-place-distance {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
}