* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

header h1 i {
    margin-right: 10px;
}

header p {
    opacity: 0.9;
    font-size: 1.1rem;
}

/* Main Layout */
.main-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    min-height: calc(100vh - 140px);
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.route-list h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.route-item {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.route-item:hover {
    border-color: #3498db;
    transform: translateX(5px);
}

.route-item.active {
    border-color: #3498db;
    background-color: #e3f2fd;
}

.route-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.route-desc {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Route Info */
.route-info {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.route-info h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
}

.label {
    font-weight: 600;
    color: #495057;
}

.paradas-list {
    margin-top: 20px;
}

.paradas-list h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.paradas-list ul {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.paradas-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
    color: #555;
    font-size: 0.9rem;
}

.paradas-list li:last-child {
    border-bottom: none;
}

.principal-marker div {
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.8) !important;
    border: 3px solid white !important;
}

.intermediate-marker div {
    opacity: 0.9;
}
/* Map Container */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    height: 700px;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

/* Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 10px;
}

/* Símbolo de línea para rutas (mejor que un cuadro) */
.line-swatch {
    width: 12px;
    height: 0;
    border-top: 4px solid;
    border-radius: 2px;
    margin-right: 10px;
    flex-shrink: 0;
}

.line-ida {
    border-top-color: #e74c3c;
    border-top-style: solid;
}

.line-vuelta {
    border-top-color: #3498db;
    border-top-style: solid;
}


.legend-item i {
    margin-right: 10px;
    font-size: 16px;
}

/* Círculos de paradas con emoji (como en el mapa) */
.legend-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1;
}

.bus-dot-principal {
    background-color: #f39c12; /* Naranja */
}

.bus-dot-intermedia {
    background-color: #3498db; /* Azul */
}

/* LEYENDA MINIMALISTA PARA MÓVILES */
@media (max-width: 768px) {
    .map-legend {
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border-radius: 20px;
        padding: 8px 12px;
        max-width: 160px;
        bottom: 19px;
        left: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .legend-item {
        margin-bottom: 4px;
        display: flex;
        align-items: center;
        font-size: 11px;
        line-height: 1.2;
    }
    
    .legend-item:last-child {
        margin-bottom: 0;
    }
    
    .color-box {
        width: 12px;
        height: 12px;
        margin-right: 6px;
        border-radius: 2px;
        flex-shrink: 0;
    }

    /* Líneas más delgadas y cortas en móvil */    
    .legend-item i {
        font-size: 11px;
        margin-right: 6px;
        width: 12px;
        text-align: center;
    }
    
    /* Agrupar elementos similares */
    .legend-group {
        margin-bottom: 8px;
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    
    .legend-group:last-child {
        margin-bottom: 0;
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .legend-group-title {
        font-size: 10px;
        font-weight: bold;
        color: #7f8c8d;
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Círculos de paradas con emoji */
    .legend-dot {
        width: 16px;
        height: 16px;
        font-size: 10px;
        margin-right: 6px;
    }

}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
}

/* ===== FOOTER MEJORADO ===== */
footer {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #ecf0f1;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 4px solid #3498db;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.footer-info {
    text-align: center;
    max-width: 800px;
}

.copyright {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.company-link {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    padding: 2px 4px;
    border-radius: 3px;
}

.company-link:hover {
    color: #2980b9;
    background: rgba(52, 152, 219, 0.1);
    text-decoration: underline;
}

.company-link::after {
    content: '↗';
    font-size: 0.8em;
    margin-left: 3px;
    opacity: 0.7;
}

.footer-description {
    font-size: 0.9rem;
    color: #bdc3c7;
    margin-top: 0.5rem;
    line-height: 1.5;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.footer-link {
    color: #95a5a6;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 4px;
}

.footer-link:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

.footer-link i {
    font-size: 1rem;
}

/* Modal para información del proyecto */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #3498db;
}

.modal-header h3 {
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: #3498db;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #7f8c8d;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: #f5f5f5;
    color: #e74c3c;
}

.modal-body p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.tech-stack {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    border-left: 4px solid #3498db;
}

.tech-stack h4 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.tech-stack ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tech-stack li {
    padding: 0.3rem 0;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tech-stack li i {
    color: #3498db;
    width: 20px;
}

.modal-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

/* Responsive para footer */
@media (max-width: 768px) {
    .footer-content {
        gap: 1rem;
    }
    
    .footer-links {
        gap: 1rem;
        flex-direction: column;
        align-items: center;
    }
    
    .footer-link {
        padding: 8px 15px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 20px;
    }
    
    .copyright {
        font-size: 0.9rem;
    }
    
    .footer-description {
        font-size: 0.85rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: static;
    }
    
    #map {
        height: 500px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
}

/* Scrollbar personalizado */
.paradas-list ul::-webkit-scrollbar {
    width: 6px;
}

.paradas-list ul::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.paradas-list ul::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.paradas-list ul::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Estilos para marcadores personalizados */
.start-marker, .end-marker, .mid-marker, .user-location, .capture-marker {
    background: transparent !important;
    border: none !important;
}

.leaflet-popup-content {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-width: 200px;
}

.leaflet-popup-content h4 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.leaflet-popup-content p {
    margin: 5px 0;
    color: #555;
}

.leaflet-popup-content strong {
    color: #2c3e50;
}

.route-popup, .marker-popup {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Controles personalizados */
.capture-button, .geo-button, .cancel-capture {
    margin-bottom: 10px;
}

.capture-instructions {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Mejoras responsive */
@media (max-width: 768px) {
    .leaflet-control {
        transform: scale(0.9);
    }
    
    .capture-instructions div {
        max-width: 200px;
    }
}

/* Mejoras visuales para el mapa */
.leaflet-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.leaflet-control-layers {
    border: 2px solid rgba(0,0,0,0.1) !important;
    border-radius: 8px !important;
}

/* Botón flotante para móviles */
.floating-map-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: none; /* Oculto por defecto, solo se muestra en móviles */
    animation: floatUp 0.3s ease-out;
}

.floating-map-button button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    min-width: 180px;
    justify-content: center;
}

.floating-map-button button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #2980b9, #3498db);
}

.floating-map-button button:active {
    transform: translateY(0);
}

.floating-map-button button i {
    font-size: 16px;
}

/* Animación para aparecer */
@keyframes floatUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mostrar botón solo en móviles */
@media (max-width: 768px) {
    .floating-map-button {
        display: block;
    }
    
    /* Asegurar que el mapa tenga suficiente espacio */
    #map {
        scroll-margin-top: 20px;
    }
}

/* Para pantallas muy pequeñas */
@media (max-width: 480px) {
    .floating-map-button button {
        padding: 12px 16px;
        font-size: 13px;
        min-width: 160px;
    }
    
    .floating-map-button {
        bottom: 15px;
        right: 15px;
    }
}

/* Cuando el botón esté oculto */
.floating-map-button.hidden {
    display: none !important;
}

/* ================================
   Botón flotante de ayuda
   ================================ */
.floating-help-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: block;
    animation: floatUp 0.3s ease-out;
}

.floating-help-button button {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.25);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

.floating-help-button button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.35);
    background: linear-gradient(135deg, #34495e, #2c3e50);
}

.floating-help-button button:active {
    transform: translateY(0);
}

.floating-help-button button i {
    font-size: 16px;
}

/* En móvil, subi el botón de ayuda para no chocar con "Ver ruta en mapa" acuerdate wey*/
@media (max-width: 768px) {
    .floating-help-button {
       /* bottom: 90px;*/
    }
}

/* ================================
   Estilos del modal de ayuda
   ================================ */
.help-steps {
    margin: 0 0 1.2rem 1.2rem;
    padding: 0;
}

.help-steps li {
    margin-bottom: 8px;
    color: #555;
    line-height: 1.5;
    font-size: 14px;
}

.help-modal .guide-key {
    margin-top: 12px;
    display: grid;
    gap: 8px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.help-modal .legend-item {
    margin-bottom: 0;
}

.help-modal .line-swatch {
    width: 26px;
    border-top-width: 4px;
    margin-right: 10px;
}

.help-modal .legend-dot {
    width: 20px;
    height: 20px;
    font-size: 12px;
    margin-right: 10px;
}

.help-note {
    margin-top: 12px;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}
