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

:root {
    --primary-color: #FF6600; /* Laranja vibrante da HM */
    --bg-page: #0a0a0a; /* Fundo principal quase preto */
    --bg-white: #161616; /* Cor dos cards e cabeçalhos (cinza muito escuro) */
    --text-dark: #ffffff; /* Textos principais em branco */
    --text-gray: #a0a0a0; /* Textos secundários em cinza claro */
    --border-color: #333333; /* Bordas escuras */
}

[data-theme="light"] {
    --primary-color: #FF6600;
    --bg-page: #f5f7fa;
    --bg-white: #ffffff;
    --text-dark: #1a1a1a;
    --text-gray: #666666;
    --border-color: #e0e0e0;
}

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

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

/* INDEX.HTML SPECIFIC STYLES */
.hero {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: url('https://images.unsplash.com/photo-1601584115197-04ecc0da31d7?auto=format&fit=crop&w=1920&q=80') no-repeat center center/cover;
    position: relative;
    padding: 20px;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}
.search-container {
    background: var(--bg-white);
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.search-container h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--text-dark);
}
.search-container p {
    color: var(--text-gray);
    margin-bottom: 25px;
    font-size: 0.95rem;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}
.form-control {
    width: 100%;
    padding: 14px;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.2s;
}
.form-control::placeholder {
    color: var(--text-gray);
}
.form-control:focus {
    border-color: var(--primary-color);
}
.btn-primary {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover {
    background: #E85D04;
}

/* HEADER GLOBAL */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    padding: 0 20px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.top-nav.absolute {
    position: absolute;
    top: 0; left: 0; right: 0;
    background: transparent;
    border-bottom: none;
}
.top-nav.absolute .logo { color: white; }

.logo { font-size: 1.4rem; font-weight: 700; color: var(--text-dark); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo span { color: var(--primary-color); }

.header-search {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-page);
    padding: 6px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}
.search-pill {
    display: flex;
    align-items: center;
    background: var(--bg-white);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.search-pill .city { 
    color: var(--text-dark); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 42%; 
    display: inline-block; 
    vertical-align: middle;
}
.search-pill .arrow { color: #ccc; font-size: 0.8rem; }
.btn-search-header {
    background: #E85D04;
    color: white;
    border: none;
    padding: 8px 25px;
    border-radius: 20px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.btn-search-header:hover { background: #DC4C00; }

/* ===== RESULTS LAYOUT ===== */
.results-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--bg-page);
}

/* NAV RAIL (NEW SIDEBAR) */
.nav-rail {
    width: 72px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px;
    flex-shrink: 0;
    z-index: 3;
}
.nav-item {
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    color: var(--text-gray);
    font-size: 1.2rem;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.nav-item:hover {
    background: var(--bg-page);
    color: var(--text-dark);
}
.nav-item.active {
    background: rgba(255, 102, 0, 0.1);
    color: var(--primary-color);
}
.nav-bottom {
    margin-top: auto;
    margin-bottom: 20px;
}

/* LEFT SIDEBAR (CONTENT) */
.sidebar {
    width: 400px;
    background: var(--bg-white);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 2;
    box-shadow: 2px 0 10px rgba(0,0,0,0.03);
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-dark);
}

.options-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* OPTION CARD */
.option-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.option-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

.option-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}
.option-icon {
    color: var(--primary-color);
    font-size: 1.4rem;
    width: 24px;
    text-align: center;
}
.option-text {
    flex: 1;
    min-width: 0;
}
.option-text h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.option-text p {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.option-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.option-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
}
.option-chevron {
    color: var(--primary-color);
    font-size: 0.9rem;
}

/* CUSTOM INVENTED TABS CONTENT (STOPS, DATES) */
.custom-tab-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.stop-card {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
}
.stop-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}
.stop-info {
    padding: 15px;
}
.stop-info h3 {
    font-size: 1rem;
    margin-bottom: 5px;
}
.stop-info p {
    font-size: 0.85rem;
    color: var(--text-gray);
}

.date-picker {
    background: var(--bg-page);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
}
.date-picker h3 { font-size: 1rem; margin-bottom: 15px; }
.date-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 15px;
    font-family: inherit;
}

/* MAP CONTAINER */
.map-container {
    flex: 1;
    position: relative;
    background: var(--bg-page);
    padding: 20px 30px 30px 20px; /* Padding to make map smaller and detached from edges */
}
#map {
    width: 100%;
    height: 100%;
    border-radius: 24px; /* Muito arredondada */
    box-shadow: 0 15px 40px rgba(0,0,0,0.12), 0 5px 15px rgba(0,0,0,0.05); /* Efeito flutuante profundo */
    overflow: hidden;
    border: 4px solid var(--bg-white); /* Borda branca grossa para dar aspecto premium */
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    body { overflow-y: auto; height: 100vh; }
    .results-wrapper { flex-direction: column; overflow: visible; }
    
    .nav-rail { 
        order: 1; 
        width: 100%; height: auto; 
        flex-direction: row; border-right: none; 
        border-bottom: 1px solid var(--border-color); 
        padding: 10px; justify-content: space-around; 
    }
    .nav-item { margin-bottom: 0; width: 45px; height: 45px; }
    .nav-bottom { margin: 0; display: none; }
    
    .map-container { 
        order: 2; 
        height: 260px; 
        padding: 15px 15px 5px 15px; 
        background: var(--bg-white); 
        flex: none;
    }
    #map {
        border-radius: 16px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.08);
        border: 2px solid var(--border-color);
    }
    
    .sidebar { 
        order: 3; 
        width: 100%; height: auto; 
        border-right: none; border-bottom: none; 
        box-shadow: none;
    }
    .sidebar-header {
        border-bottom: none;
        padding-bottom: 5px;
    }
    .sidebar-header h2 {
        font-size: 1.3rem;
    }
    .options-list {
        overflow: visible;
        padding-top: 10px;
    }
    
    .header-search { 
        display: flex; 
        flex: 1; 
        margin-left: 15px; 
        background: var(--bg-page);
        padding: 5px;
        border-radius: 30px;
        min-width: 0;
    }
    .search-pill { 
        flex: 1; 
        justify-content: center; 
        padding: 8px; 
        font-size: 0.85rem; 
        box-shadow: none;
        background: transparent;
        min-width: 0;
    }
    .btn-search-header { display: none; }
    
    .logo-text { display: none; }
    .logo i { font-size: 1.5rem; }
    .desktop-only-spacer { display: none !important; }
}

/* TIMELINE AND DETAILS VIEW */
.back-btn-custom {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-dark);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: background 0.2s;
}
.back-btn-custom:hover { background: var(--bg-page); }

.details-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.details-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.timeline {
    position: relative;
    padding-left: 20px;
    margin-top: 20px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 10px;
    bottom: 30px;
    width: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}
.timeline-item {
    position: relative;
    margin-bottom: 30px;
}
.timeline-icon {
    position: absolute;
    left: -20px;
    top: 0;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 3px solid var(--bg-white);
    z-index: 2;
}
.timeline-icon.end {
    background: #FF0055; /* Like rome2rio pink for destination */
}
.timeline-icon.transit {
    background: var(--bg-white);
    border-color: var(--primary-color);
}
.timeline-content {
    padding-left: 15px;
}
.timeline-content h4 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 3px;
}
.timeline-content p {
    font-size: 0.85rem;
    color: var(--text-gray);
}
.timeline-duration {
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-left: 15px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-select-route {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(255, 102, 0, 0.3);
    transition: transform 0.1s;
}
.btn-select-route:active { transform: scale(0.98); }

/* CUSTOM AUTOCOMPLETE DROPDOWN */
.custom-autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
}
.custom-autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s;
}
.custom-autocomplete-item:last-child {
    border-bottom: none;
}
.custom-autocomplete-item:hover {
    background: var(--bg-page);
    color: var(--primary-color);
}

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: var(--bg-white);
    width: 90%;
    max-width: 550px;
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: modalFadeIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Custom Modal Header */
.custom-modal-header {
    background: linear-gradient(135deg, var(--primary-color), #FF8C00);
    padding: 20px 25px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
}
.custom-modal-header h2 {
    color: white;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.custom-modal-header .close-modal {
    color: rgba(255,255,255,0.8);
    font-size: 2rem;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}
.custom-modal-header .close-modal:hover {
    color: white;
    transform: scale(1.1);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
}

/* Modal Ticket */
.modal-ticket {
    background: var(--bg-page);
    border: 1px dashed var(--primary-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
}
.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    font-size: 1.05rem;
}
.ticket-header span i { color: var(--primary-color); margin-right: 6px; }
.ticket-price { color: var(--primary-color); font-size: 1.2rem; }
.ticket-route {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-white);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}
.ticket-city {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
}
.ticket-arrow {
    color: #ccc;
    font-size: 0.8rem;
}

/* Modal Form Enhancements */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}
.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}
@media (max-width: 600px) {
    .form-row { flex-direction: column; gap: 15px; margin-bottom: 0; }
    .form-row .form-group { margin-bottom: 15px; }
}

.icon-input {
    position: relative;
    margin-bottom: 15px;
}
.icon-input i {
    position: absolute;
    top: 15px;
    left: 15px;
    color: var(--text-gray);
    font-size: 1.1rem;
    transition: color 0.2s;
}
.icon-input .form-control {
    padding-left: 45px;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}
.icon-input .form-control:focus {
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15);
}
.icon-input .form-control:focus + i,
.icon-input .form-control:focus ~ i {
    color: var(--primary-color);
}
.icon-input textarea.form-control {
    padding-top: 15px;
}
.btn-confirm {
    box-shadow: 0 5px 15px rgba(255, 102, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 16px;
    font-size: 1.15rem;
}
.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 102, 0, 0.4);
}
.btn-confirm:active {
    transform: translateY(0);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.2s, background 0.2s;
}
.theme-toggle-btn:hover {
    transform: scale(1.1);
}
