body { margin: 0; padding: 0; font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; position: relative; height: 100vh; background-color: #f3f4f6; }

/* --- MAPA OCUPA TODA A TELA --- */
#map { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }

/* --- BARRA LATERAL FLUTUANTE --- */
.sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 400px;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 1000;
    border-radius: 12px;
    overflow: visible;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* --- HEADER FIXO (LOGO + INPUTS + BOTÃO) --- */
.sidebar-header {
    /*background: white;*/
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    z-index: 2;
    overflow: visible;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    color: #1e3a8a;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    width: 100%;
    text-align: center;
}

/* Inputs */
.search-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
    padding-right: 45px;
    overflow: visible;
}

.search-inputs { display: flex; flex-direction: column; gap: 10px; }

.swap-button {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #dfe3ec;
    background: #fff;
    color: #a0aec0;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(15,23,42,0.08);
}

.swap-button:hover { background: #eef2ff; color: #2563EB; border-color: #c3d0ff; }

.input-wrapper { position: relative; margin-bottom: 10px; }

.input-wrapper:last-child { margin-bottom: 0; }

input {
    width: 100%;
    padding: 12px 80px 12px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    color: #334155;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input:focus { border-color: #2563EB; outline: none; }

/* Botão Mira dentro do Input */
.btn-target {
    position: absolute;
    right: 5px;
    top: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 7px;
    border-radius: 4px;
}

.btn-target:hover { background: #eff6ff; color: #2563EB; }

.btn-target.active { color: #dc2626; background: #fef2f2; animation: pulse 1.5s infinite; }

.btn-search {
    width: 100%;
    padding: 14px;
    background: #2563EB;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    margin-top: 15px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    transition: all 0.3s;
}

.btn-search:hover { background: #1d4ed8; }

/* --- CONTEÚDO SCROLLÁVEL (CARDS) --- */
.sidebar-content {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 20px 20px 20px;
}

#status { text-align: center; color: #64748b; font-size: 13px; margin-top: 15px; }

#results-container { margin-top: 15px; }

/* --- LISTA DE ROTAS (LAYOUT DO PRINT) --- */
.route-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.route-card:hover { border-color: #cbd3da; }

.route-card.active { border: 2px solid #2563EB; background: #eff6ff; }

.route-time { font-size: 18px; font-weight: 800; color: #212529; margin-bottom: 4px; }

.route-meta { font-size: 13px; color: #6c757d; margin-bottom: 10px; }

/* Badges (Etiquetas) */
.legs-visual { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.badge {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-BUS { background: #dc2626; color: white; }

.badge-WALK { background: #9ca3af; color: white; }

.arrow { color: #adb5bd; font-size: 10px; }

.selecting-location { cursor: crosshair !important; }

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 3000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none;
}

.autocomplete-dropdown.show { display: block; }

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #334155;
}

.autocomplete-item:hover { background: #f1f5f9; }

.autocomplete-item:last-child { border-bottom: none; }

.autocomplete-item .street-name {
    font-weight: 600;
    color: #1e293b;
}

.autocomplete-item .locality {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.btn-clear {
    position: absolute;
    right: 34px;
    top: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: #cbd5e1;
    padding: 7px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, color 0.2s, background 0.2s;
}
.input-wrapper.has-value .btn-clear {
    opacity: 1;
    pointer-events: auto;
}
.btn-clear:hover { background: #f1f5f9; color: #475569; }

/* --- MARCADOR DINÂMICO --- */
.dynamic-marker { pointer-events: auto; }
.marker-pin {
    position: relative;
    width: 42px;
    height: 56px;
    border-radius: 20px 20px 8px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(15,23,42,0.35);
    cursor: grab;
    user-select: none;
}
.marker-pin:active { cursor: grabbing; }
.marker-pin.start { background: linear-gradient(180deg, #22c55e, #15803d); }
.marker-pin.end { background: linear-gradient(180deg, #ef4444, #b91c1c); }
.marker-label { font-size: 15px; text-shadow: 0 1px 2px rgba(15,23,42,0.35); }
.marker-tail {
    position: absolute;
    bottom: -11px;
    width: 16px;
    height: 16px;
    background: inherit;
    transform: rotate(45deg);
    border-radius: 3px;
    box-shadow: 0 6px 12px rgba(15,23,42,0.3);
}
.marker-close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: none;
    background: #fff;
    color: #0f172a;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(15,23,42,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.marker-close:hover { background: #fee2e2; color: #b91c1c; }
