/* 
 * RESPONSIVE GLOBAL STYLES - Cooperativa 15 de Diciembre
 * Mantiene fidelidad a los diseños originales en todos los dispositivos
 */

/* Base responsive - Meta viewport debe estar en cada HTML */
* {
    box-sizing: border-box;
}

/* Menú hamburguesa para dispositivos móviles */
.menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1000;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-6px, 6px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-6px, -6px);
}

/* Overlay para menú de navegación principal */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Contenedores principales responsive */
@media screen and (max-width: 1200px) {
    .container, .main-content, .contenido-principal {
        max-width: 100%;
        padding: 0 15px;
    }
}

/* Tablet - Mantiene estructura pero ajusta espacios */
@media screen and (max-width: 768px) {
    /* Mostrar menú hamburguesa */
    .menu-toggle {
        display: flex;
    }
    
    /* Navegación responsive */
    .navbar, .nav-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
    }
    
    .nav-logo {
        flex: 1;
    }
    
    #menu-navegacion, .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: white;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        padding: 80px 20px 20px;
        transition: right 0.3s ease;
        z-index: 999;
        flex-direction: column;
        gap: 15px;
    }
    
    #menu-navegacion.active, .nav-menu.active {
        right: 0;
    }
    
    .enlace-menu {
        padding: 12px 0;
        font-size: 1rem;
        border-bottom: 1px solid #eee;
        text-align: left;
        width: 100%;
    }
    
    /* Headers y títulos responsive */
    .hero-title, .page-title, .section-title {
        font-size: 2rem !important;
        line-height: 1.2;
        text-align: center;
        margin-bottom: 15px;
    }
    
    .hero-subtitle, .page-subtitle {
        font-size: 1rem !important;
        margin-bottom: 20px;
    }
    
    /* Grids responsive - mantiene el diseño original */
    .hero-content, .info-grid, .section-content, .stats-row, .servicios-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
        text-align: center;
    }
    
    .info-stats, .paradas-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    /* Tarjetas y cards responsive */
    .stat-card, .servicio-card, .parada-card, .taxi-card {
        margin: 0 auto 20px auto;
        max-width: 100%;
        padding: 20px;
    }
    
    /* Formularios responsive */
    .form-sections, .form-group {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .form-control, input, select, textarea {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 12px;
    }
    
    /* Botones responsive */
    .btn, .btn-primary, .btn-success, .btn-secondary, .edit-btn, .back-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        margin: 5px 0;
        min-height: 44px; /* Touch target */
    }
    
    /* Contenedor de botones del header responsive */
    .header-buttons {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    /* Tablas responsive con scroll horizontal */
    .payments-table, .cuotas-table, table {
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }
    
    .table-header, .cuota-row {
        min-width: 600px;
        grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr 1.2fr;
        font-size: 0.85rem;
        padding: 8px;
    }
    
    /* Sidebar responsive */
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 250px;
        z-index: 1000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Main content ajuste para sidebar móvil */
    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }
    
    /* Footer responsive */
    #contenido-footer {
        grid-template-columns: 1fr !important;
        gap: 20px;
        text-align: center;
    }
    
    .redes-sociales {
        justify-content: center;
    }
}

/* Móvil pequeño - Optimización máxima manteniendo diseño */
@media screen and (max-width: 480px) {
    /* Padding mínimo para aprovechar espacio */
    .container, .main-content, .hero-content {
        padding: 0 10px;
    }
    
    /* Títulos aún más pequeños pero legibles */
    .hero-title, .page-title, .section-title {
        font-size: 1.5rem !important;
        margin-bottom: 10px;
    }
    
    .hero-subtitle, .page-subtitle {
        font-size: 0.9rem !important;
    }
    
    /* Stats en columna única */
    .info-stats, .stats-container, .stats-row {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    
    /* Formularios stack completo */
    .form-actions, .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn, .btn-primary, .btn-success {
        width: 100%;
        margin: 5px 0;
    }
    
    /* Tablas más compactas */
    .table-header, .cuota-row {
        font-size: 0.75rem;
        padding: 6px 4px;
        min-width: 500px;
    }
    
    th, td {
        padding: 6px 4px;
        font-size: 0.75rem;
    }
    
    /* Modales responsive */
    .modal-content {
        width: 95% !important;
        margin: 5% auto;
        padding: 15px;
        border-radius: 10px;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* Logo y navegación compacta */
    .nav-logo img, #logo-cooperativa {
        max-width: 40px;
        height: auto;
    }
    
    .logo-text h1, #titulo-principal {
        font-size: 1.1rem !important;
    }
    
    .subtitulo {
        font-size: 0.8rem !important;
    }
    
    /* Hero image responsive */
    .hero-image, .taxi-card {
        max-width: 250px;
        margin: 0 auto;
        padding: 15px;
    }
    
    /* Features responsive */
    .feature, .ventaja-item {
        padding: 8px 12px;
        max-width: 280px;
        margin: 0 auto 10px auto;
    }
}

/* Landscape móvil - optimización horizontal */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero-section, #hero-section {
        padding: 30px 0;
    }
    
    .hero-title {
        font-size: 1.8rem !important;
        margin-bottom: 10px;
    }
    
    .hero-features {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        margin-bottom: 15px;
    }
    
    .feature {
        min-width: 150px;
        margin-bottom: 5px;
    }
}

/* Touch improvements para todos los dispositivos */
@media (hover: none) and (pointer: coarse) {
    /* Targets táctiles más grandes */
    .btn, .enlace-menu, .red-social, button, .close {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 15px;
    }
    
    /* Enlaces más espaciados */
    .enlace-footer, .lista-footer li {
        padding: 8px 0;
    }
    
    /* Hover states para touch */
    .btn:active, .enlace-menu:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
}

/* Wrapper para scroll horizontal en tablas */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
}

.table-responsive table {
    min-width: 600px;
}

/* Fix para inputs en iOS */
input, select, textarea {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 5px;
}

/* Loading states responsive */
.loading-overlay {
    padding: 20px;
    text-align: center;
}

.spinner {
    width: 30px;
    height: 30px;
}

/* Print styles - mantiene formato para impresión */
@media print {
    .sidebar, .navbar, .btn, .modal {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
    
    table {
        font-size: 12px !important;
    }
    
    th, td {
        padding: 4px !important;
    }
}

/* Estilos específicos para index.html - Sobrescribir configuraciones conflictivas */
.pagina-index .nav-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

@media screen and (max-width: 768px) {
    .pagina-index .nav-container {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 15px !important;
        gap: 0 !important;
    }
    
    .pagina-index .nav-logo {
        flex: 1 !important;
    }
    
    .pagina-index #menu-navegacion {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 80% !important;
        max-width: 300px !important;
        height: 100vh !important;
        background: white !important;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1) !important;
        padding: 80px 20px 20px !important;
        transition: right 0.3s ease !important;
        z-index: 999 !important;
        flex-direction: column !important;
        gap: 15px !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
    }
    
    .pagina-index #menu-navegacion.active {
        right: 0 !important;
    }
    
    .pagina-index .enlace-menu {
        padding: 12px 0 !important;
        font-size: 1rem !important;
        border-bottom: 1px solid #eee !important;
        text-align: left !important;
        width: 100% !important;
    }
}
