/*
 * Tema: Horarios Autobús - Estilos Públicos
 * Archivo: style.css
 */

/* ---------------------------------- */
/* 1. Reset Básico y Variables */
/* ---------------------------------- */
:root {
    --primary-color: #8FC33A;
    /* Azul corporativo WP */
    --secondary-color: #f7931e;
    /* Naranja de acento */
    --background-light: #ffffff;
    --background-gray: #f9f9f9;
    --border-color: #e0e0e0;
    --text-dark: #333333;
    --text-muted: #666666;
    --success-color: #8FC33A;
    /* Color Verde para el botón de búsqueda/compra */
}

.horarios-autobus-form-wrapper,
.horarios-autobus-results-wrapper,
.horarios-tabs-container {
    max-width: 1000px;
    margin: 0 auto 30px;
    padding: 20px;
    background: var(--background-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 0;
}

/* ---------------------------------- */
/* 2. Estilos del Formulario de Búsqueda (CORREGIDO) */
/* ---------------------------------- */
/* Estilos basados en el snippet PHP */

.formulario {
    /* Regla para igualar el ancho con próximas salidas */
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    /* Ajustar altura para igualar con próximas salidas */
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: 450px;
    margin-top: 30px;
}

.formulario form {
    /* La estructura del formulario base del PHP */
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Reducido de 15px a 10px */
}

.formulario .input-group {
    /* Contenedor de cada campo: Origen, Destino, Fecha */
    display: flex;
    flex-direction: column;
}

.formulario label {
    font-weight: 600;
    margin-bottom: 3px;
    /* Reducido de 5px a 3px */
    display: block;
    color: var(--text-dark);
}

.formulario .label-icon {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
    /* Reducido de 5px a 3px */
}

.formulario .label-icon .icon {
    width: 20px;
    height: 20px;
}

.formulario select,
.formulario input[type="date"] {
    padding: 8px;
    /* Reducido de 10px a 8px */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
    background-color: var(--background-light);
}

/* Botón de Búsqueda: CORREGIDO A VERDE */
.formulario #buscarBtn {
    background-color: #8FC33A;
    /* Usamos el color verde */
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
    width: 100%;
    margin-top: 5px;
    /* Reducido de 10px a 5px */
}

.formulario #buscarBtn:hover {
    background-color: #45a049;
    /* Tono más oscuro del verde */
}

/* ---------------------------------- */
/* 3. Estilos de las Tarjetas de Resultados (Resultado del Buscador) */
/* ---------------------------------- */
/* .resultados-busqueda{
	width: 1000px;
}
.resultado {
    background-color: white;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.resultado-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: baseline;
}

.resultado-detalles {
    display: flex;
    align-items: start;
	flex-direction: column;
	width: 400px;
}

.icono-tipo {
    max-width: 200px;
    border-radius: 5px;
	margin-bottom: 5px;
}

.icono-tipo img {
    width: 100%;
}

.logo-bus
{
    max-height: 50px;
}

.descripcion {
    display: flex;
    flex-direction: column;
}

.ciudad {
    font-size: 18px;
    color: #002856;
    font-weight: bold;
}

.tipo {
    font-size: 14px;
    color: #aaa;
}

.salida {
    background-color: #285fe71f;
    color: #8fc33a;
    font-size: 14px;
    display: flex;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: 300;
    align-items: center;
}



.resultado-horario {
    display: flex;
    justify-content: space-evenly;
    width: 100%;
    text-align: center;
    margin: auto;
}

.resultado-origen, .resultado-destino {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.resultado-origen .ciudad, .resultado-destino .ciudad {
    font-weight: 300; 
}

.resultado-hora {
    font-size: 24px;
    color: #002856;
    font-weight: bold;
    margin: auto;
}

.resultado-icono {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 20px;
}

.resultado-icono img {
    width: 125px;
    height: auto;
}

.resultado-paradas {
    color: #8fc33a;
    cursor: pointer;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start; 
    width: 100%;
}

.resultado-paradas .arrow-down {
    border: solid #8fc33a;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    margin-left: 5px;
    transform: rotate(45deg);
}

.resultado-comprar {
    background-color: #8fc33a;
    border: none;
    color: white;
    padding: 12px;
    cursor: pointer;
    border-radius: 6px; 
    width: 100%;
    text-align: center;
    font-size: 18px; 
	text-decoration: none;
}
.no-results {
    padding: 20px;
    text-align: center;
    background-color: var(--background-gray);
    border-radius: 4px;
    color: var(--text-muted);
}

.dias-container {
    display: flex;
flex-wrap: wrap;
gap: 6px;
} */
/* ================================================= */
/* DISEÑO MEJORADO - RESULTADOS DE BÚSQUEDA */
/* ================================================= */

.resultados-busqueda {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.resultado {
    background: #ffffff;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.resultado:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.resultado-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

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

.compania-logo {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid #f0f0f0;
    padding: 5px;
    background: white;
}

.compania-details h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: #2d3748;
    font-weight: 600;
}

.compania-details .tipo-servicio {
    color: #718096;
    font-size: 13px;
    margin: 0;
}

.frecuencias-section {
    text-align: right;
}

.frecuencias-label {
    font-size: 12px;
    color: #718096;
    margin-bottom: 8px;
    font-weight: 500;
}

.dias-container {
    display: flex;
    gap: 6px;
}

.dia {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border: 1.5px solid #e2e8f0;
}

.dia.activo {
    background: #8FC33A;
    color: white;
    border-color: #8FC33A;
}

.dia.inactivo {
    background: #f7fafc;
    color: #a0aec0;
}

/* Horario principal */
.horario-principal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 10px;
}

.trayecto-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.ciudad-nombre {
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 8px;
    font-weight: 500;
}

.hora-principal {
    font-size: 24px;
    color: #2d3748;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.separador-trayecto {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 20px;
}

.linea-separador {
    width: 80px;
    height: 2px;
    background: #e2e8f0;
    margin: 8px 0;
}

.icono-viaje {
    width: 20px;
    height: 20px;
    color: #8FC33A;
}

.duracion-viaje {
    font-size: 12px;
    color: #718096;
    margin-top: 4px;
}

/* Información adicional */
.info-adicional {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.precio-section {
    text-align: left;
}

.precio-label {
    font-size: 12px;
    color: #718096;
    margin-bottom: 4px;
}

.precio {
    font-size: 18px;
    color: #2d3748;
    font-weight: 700;
}

.botones-accion {
    display: flex;
    gap: 10px;
}

.btn-secundario {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #4a5568;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secundario:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.btn-primario {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    background: #8FC33A;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primario:hover {
    background: #7db032;
    transform: translateY(-1px);
}

/* Estados especiales */
.resultado-directo {
    border-left: 4px solid #8FC33A;
}

.resultado-con-escalas {
    border-left: 4px solid #ed8936;
}

.etiqueta-especial {
    display: inline-block;
    padding: 2px 8px;
    background: #fed7d7;
    color: #c53030;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}


.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    background-color: #8FC33A;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        sans-serif;
}

.btn-back:hover {
    background-color: green;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-back:active {
    transform: translateY(0);
    box-shadow: none;
}


/* Responsive */
@media (max-width: 768px) {
    .resultado {
        padding: 16px;
    }

    .resultado-header {
        flex-direction: column;
        gap: 15px;
    }

    .frecuencias-section {
        text-align: left;
        width: 100%;
    }

    .horario-principal {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .separador-trayecto {
        flex-direction: row;
        margin: 10px 0;
    }

    .linea-separador {
        width: 2px;
        height: 40px;
        margin: 0 8px;
    }

    .info-adicional {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .precio-section {
        text-align: center;
    }

    .botones-accion {
        justify-content: center;
    }

    .hora-principal {
        font-size: 20px;
    }
}



/* Botón Comprar API (Se mantiene verde, usando success-color) */
.btnComprar {
    text-align: center;
}

.resultado-comprar {
    background-color: var(--success-color);
    color: white !important;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    transition: background-color 0.3s;
    max-width: 400px;
    display: inline-block !important;
}

.resultado-comprar:hover {
    background-color: #45a049;
}


/* ================================================= */
/* 4. DISPOSICIÓN EN DOS COLUMNAS (IDA Y VUELTA) */
/* ================================================= */

.two-column-results {
    display: flex;
    gap: 20px;
    margin-top: 30px;
    width: 100%;
}

.results-column {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.results-column .column-title {
    text-align: center;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
}

.results-column .results-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}


/* ---------------------------------- */
/* 5. Estilos de Pestañas (Próximas Salidas) */
/* ---------------------------------- */
.info-tabla h3 {
    color: var(--primary-color);
    margin-top: 0;
}

.tabs-nuevos {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 15px;
    flex-shrink: 0;
    /* No permitir que las pestañas se compriman */
}

.tablink-nuevos {
    background: lightgray;
    border: none;
    padding: 8px 12px;
    /* Reducido para ahorrar espacio */
    cursor: pointer;
    font-size: 0.9em;
    /* Reducido ligeramente */
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    flex: 1;
    /* Distribuir equitativamente el espacio */
}

.tablink-nuevos.active {
    color: white;
    border-bottom: 3px solid var(--primary-color);
}

.tabcontent-nuevos {
    display: none;
}

.tabcontent-nuevos.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.tabla-nueva {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.tabla-nueva th,
.tabla-nueva td {
    padding: 8px;
    /* Reducido de 10px a 8px */
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.tabla-nueva th {
    background-color: var(--background-gray);
    color: var(--text-dark);
}

.tabla-nueva td:first-child {
    font-weight: 600;
}

.icono-train {
    height: 16px;
    width: auto;
    margin-right: 5px;
    vertical-align: middle;
}


/* ================================================= */
/* [6.] AJUSTES DE ANCHO Y SCROLL */
/* ================================================= */

/* 1. Unificar el ancho y centrado del Formulario y Próximas Salidas (Mismo largo) */
/* NOTA: El .formulario ya está ajustado arriba. */
.info-tabla {
    max-width: 600px;
    /* AJUSTA ESTE VALOR PARA COINCIDIR CON EL ANCHO DE TU FORMULARIO */
    margin-left: auto;
    margin-right: auto;
    /* Ajustar altura para igualar con el formulario */
    height: 450px;
    /* Altura fija para igualar con el formulario */
    display: flex;
    flex-direction: column;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 2. Aplicar Scroll y Altura Máxima al contenido de las pestañas (la tabla) */
.tabcontent-nuevos {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.tabcontent-nuevos .tab-content-inner {
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* 3. Asegurar que la tabla ocupe todo el espacio disponible dentro del scroll */
.info-tabla .tabla-nueva {
    width: 100%;
    border-collapse: collapse;
}


/* ================================================= */
/* 7. RESPONSIVE (Solución a solapamiento en móvil - MEJORADO) */
/* ================================================= */

@media (max-width: 768px) {

    /* A. Apila las columnas de resultados */
    .two-column-results {
        flex-direction: column;
        gap: 15px;
    }

    /* B. ESTRUCTURA DE LA TARJETA EN MÓVIL */
    .resultado-info {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }

    .resultado-detalles {
        /* Ocupa el ancho completo */
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 10px;
        padding-right: 0;

        /* Asegura que la compañía y los días estén en una línea horizontal */
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    .resultado-detalles .encabezado {
        display: none;
    }

    .dias-container {
        margin-top: 0;
    }

    .resultado-horario {
        /* El horario se muestra debajo de los detalles de la compañía */
        width: 100%;
        padding-top: 10px;
        /* Forzamos que los elementos no se compriman */
        justify-content: space-around;
    }

    /* C. TAMAÑO DE FUENTE Y ELEMENTOS EN MÓVIL */
    .resultado-hora {
        font-size: 1.4em;
        /* Reducir el tamaño de la hora */
    }

    .ciudad {
        font-size: 0.85em;
    }

    .resultado-icono img {
        height: 30px;
        /* Icono más pequeño */
    }

    .resultado-origen,
    .resultado-destino {
        /* Asegura que no haya compresión forzada */
        min-width: 30%;
    }
}