/**
 * CSS RESPONSIVE BASE
 * 
 * RUTA: /assets/css/responsive.css
 * 
 * Sistema de responsive design completo para:
 * - Grid adaptativo
 * - Tipografía escalable
 * - Componentes responsivos
 * - Breakpoints específicos del proyecto
 * 
 * @version 1.0.0
 * @author Proyecto Estética
 * @fecha 2025-08-12
 */

/* ============================================================================
   BREAKPOINTS DEL SISTEMA
   ============================================================================ */

/* 
   Breakpoints definidos:
   - xs: 0px - 479px     (móviles pequeños)
   - sm: 480px - 767px   (móviles grandes)
   - md: 768px - 1023px  (tablets)
   - lg: 1024px - 1199px (desktop pequeño)
   - xl: 1200px+         (desktop grande)
*/

/* ============================================================================
   MOBILE FIRST - ESTILOS BASE (XS: 0-479px)
   ============================================================================ */

/* Contenedores responsive */
.contenedor {
    width: 100%;
    padding: 0 var(--espacio-sm);
    margin: 0 auto;
}

.contenedor-fluido {
    width: 100%;
    padding: 0 var(--espacio-sm);
}

/* Grid sistema mobile-first */
.fila {
    display: flex;
    flex-wrap: wrap;
    margin: 0 calc(-1 * var(--espacio-xs));
}

.col {
    flex: 1;
    padding: 0 var(--espacio-xs);
    min-width: 0; /* Previene overflow */
}

/* Grid específico móvil */
.grid {
    display: grid;
    gap: var(--espacio-md);
    grid-template-columns: 1fr;
}

.grid-2,
.grid-3,
.grid-4 {
    grid-template-columns: 1fr;
}

/* Tipografía responsive móvil */
h1 { font-size: var(--texto-2xl); }
h2 { font-size: var(--texto-xl); }
h3 { font-size: var(--texto-lg); }
h4, h5, h6 { font-size: var(--texto-base); }

/* Espaciado reducido en móvil */
.tarjeta {
    margin-bottom: var(--espacio-md);
}

.tarjeta-body,
.tarjeta-header,
.tarjeta-footer {
    padding: var(--espacio-md);
}

/* Botones móvil */
.btn {
    padding: var(--espacio-sm) var(--espacio-md);
    font-size: var(--texto-sm);
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: var(--espacio-xs) var(--espacio-sm);
    font-size: var(--texto-xs);
}

.btn-lg {
    padding: var(--espacio-md) var(--espacio-lg);
    font-size: var(--texto-base);
}

/* Formularios móvil */
.form-input,
.form-select,
.form-textarea {
    font-size: 16px; /* Previene zoom en iOS */
    padding: var(--espacio-md);
}

/* Alertas móvil */
.alert {
    padding: var(--espacio-sm) var(--espacio-md);
    font-size: var(--texto-sm);
    margin-bottom: var(--espacio-md);
}

/* Navegación móvil */
.nav-list {
    flex-direction: column;
    gap: 0;
}

.nav-link {
    padding: var(--espacio-md);
    justify-content: flex-start;
    border-bottom: 1px solid var(--color-gris-200);
}

/* Tablas responsive - scroll horizontal */
.tabla-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabla-responsive table {
    min-width: 600px;
}

/* Utilidades móvil */
.ocultar-movil {
    display: none !important;
}

.mostrar-movil {
    display: block !important;
}

.texto-centro-movil {
    text-align: center;
}

/* ============================================================================
   MOBILE LARGE (SM: 480px - 767px)
   ============================================================================ */

@media (min-width: 480px) {
    
    /* Contenedores */
    .contenedor,
    .contenedor-fluido {
        padding: 0 var(--espacio-md);
    }
    
    /* Grid mejorado */
    .fila {
        margin: 0 calc(-1 * var(--espacio-sm));
    }
    
    .col {
        padding: 0 var(--espacio-sm);
    }
    
    .grid {
        gap: var(--espacio-lg);
    }
    
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }
    
    /* Tipografía mejorada */
    h1 { font-size: var(--texto-3xl); }
    h2 { font-size: var(--texto-2xl); }
    h3 { font-size: var(--texto-xl); }
    
    /* Botones más selectivos */
    .btn:not(.btn-block) {
        width: auto;
    }
    
    .btn-group {
        display: flex;
        gap: var(--espacio-sm);
        flex-wrap: wrap;
    }
    
    /* Tarjetas mejoradas */
    .tarjeta-body,
    .tarjeta-header,
    .tarjeta-footer {
        padding: var(--espacio-lg);
    }
    
    /* Formularios mejorados */
    .form-fila {
        display: flex;
        gap: var(--espacio-md);
        flex-wrap: wrap;
    }
    
    .form-fila .form-grupo {
        flex: 1;
        min-width: 200px;
    }
    
    /* Utilidades sm */
    .ocultar-sm {
        display: none !important;
    }
    
    .mostrar-sm {
        display: block !important;
    }
}

/* ============================================================================
   TABLET (MD: 768px - 1023px)
   ============================================================================ */

@media (min-width: 768px) {
    
    /* Contenedores tablet */
    .contenedor {
        max-width: 750px;
        padding: 0 var(--espacio-md);
    }
    
    /* Grid tablet completo */
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Columnas específicas tablet */
    .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-md-9 { flex: 0 0 75%; max-width: 75%; }
    .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Tipografía tablet */
    h1 { font-size: var(--texto-4xl); }
    h2 { font-size: var(--texto-3xl); }
    h3 { font-size: var(--texto-2xl); }
    h4 { font-size: var(--texto-xl); }
    
    /* Navegación tablet */
    .nav-list {
        flex-direction: row;
        gap: var(--espacio-md);
    }
    
    .nav-link {
        border-bottom: none;
        padding: var(--espacio-sm) var(--espacio-md);
    }
    
    /* Sidebar layouts */
    .layout-sidebar {
        display: flex;
        gap: var(--espacio-xl);
    }
    
    .contenido-principal {
        flex: 1;
    }
    
    .sidebar {
        flex: 0 0 300px;
    }
    
    /* Cards grid tablet */
    .cards-grid-md {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--espacio-lg);
    }
    
    /* Formularios tablet */
    .form-horizontal {
        display: flex;
        align-items: center;
        gap: var(--espacio-lg);
    }
    
    .form-horizontal .form-label {
        flex: 0 0 150px;
        margin-bottom: 0;
    }
    
    .form-horizontal .form-input,
    .form-horizontal .form-select {
        flex: 1;
    }
    
    /* Utilidades tablet */
    .ocultar-tablet {
        display: none !important;
    }
    
    .mostrar-tablet {
        display: block !important;
    }
    
    .texto-izquierda-tablet {
        text-align: left;
    }
}

/* ============================================================================
   DESKTOP SMALL (LG: 1024px - 1199px)
   ============================================================================ */

@media (min-width: 1024px) {
    
    /* Contenedores desktop */
    .contenedor {
        max-width: 1000px;
        padding: 0 var(--espacio-lg);
    }
    
    /* Grid desktop completo */
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Columnas desktop */
    .col-lg-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-lg-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-lg-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
    .col-lg-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-lg-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Sidebar desktop */
    .sidebar {
        flex: 0 0 250px;
    }
    
    /* Cards grid desktop */
    .cards-grid-lg {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--espacio-xl);
    }
    
    /* Espaciado aumentado */
    .tarjeta-body,
    .tarjeta-header,
    .tarjeta-footer {
        padding: var(--espacio-xl);
    }
    
    /* Formularios desktop */
    .form-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--espacio-lg);
    }
    
    .form-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Hover effects desktop */
    .tarjeta:hover {
        transform: translateY(-2px);
        box-shadow: var(--sombra-lg);
    }
    
    .btn:hover {
        transform: translateY(-1px);
    }
    
    /* Utilidades desktop */
    .ocultar-desktop {
        display: none !important;
    }
    
    .mostrar-desktop {
        display: block !important;
    }
}

/* ============================================================================
   DESKTOP LARGE (XL: 1200px+)
   ============================================================================ */

@media (min-width: 1200px) {
    
    /* Contenedores grandes */
    .contenedor {
        max-width: 1200px;
        padding: 0 var(--espacio-xl);
    }
    
    /* Grid máximo */
    .grid-auto {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    /* Columnas XL */
    .col-xl-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-xl-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-xl-3 { flex: 0 0 25%; max-width: 25%; }
    .col-xl-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-xl-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-xl-6 { flex: 0 0 50%; max-width: 50%; }
    .col-xl-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-xl-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-xl-9 { flex: 0 0 75%; max-width: 75%; }
    .col-xl-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-xl-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-xl-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Sidebar extendido */
    .sidebar-extendido {
        flex: 0 0 350px;
    }
    
    /* Cards grid extra large */
    .cards-grid-xl {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: var(--espacio-2xl);
    }
    
    /* Espaciado máximo */
    .seccion {
        padding: var(--espacio-3xl) 0;
    }
    
    /* Tipografía grande */
    .hero-title {
        font-size: var(--texto-5xl);
        line-height: 1.1;
    }
    
    /* Utilidades XL */
    .ocultar-xl {
        display: none !important;
    }
    
    .mostrar-xl {
        display: block !important;
    }
}

/* ============================================================================
   UTILIDADES RESPONSIVE ESPECÍFICAS
   ============================================================================ */

/* Espaciado responsive */
@media (max-width: 767px) {
    .mt-md-0 { margin-top: 0 !important; }
    .mb-md-0 { margin-bottom: 0 !important; }
    .p-md-0 { padding: 0 !important; }
    
    .espaciado-movil {
        margin: var(--espacio-sm) 0;
        padding: var(--espacio-sm);
    }
}

/* Texto responsive */
@media (max-width: 767px) {
    .texto-pequeno-movil {
        font-size: var(--texto-xs);
    }
    
    .ocultar-texto-movil .texto-responsive {
        display: none;
    }
}

/* Imágenes responsive */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
}

@media (min-width: 768px) {
    .img-cover {
        height: 300px;
    }
}

@media (min-width: 1024px) {
    .img-cover {
        height: 400px;
    }
}

/* Video responsive */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.video-responsive iframe,
.video-responsive video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ============================================================================
   ORIENTACIÓN Y CARACTERÍSTICAS ESPECÍFICAS
   ============================================================================ */

/* Orientación landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        position: static;
    }
    
    .hero-section {
        min-height: auto;
        padding: var(--espacio-lg) 0;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .logo-hd {
        background-image: url('../images/logo@2x.png');
        background-size: contain;
    }
}

/* Modo oscuro automático */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background-color: var(--color-oscuro);
        color: var(--color-gris-200);
    }
}

/* Reducir movimiento */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .tarjeta {
        border: 2px solid var(--color-gris-400);
    }
}

/* ============================================================================
   PRINT RESPONSIVE
   ============================================================================ */

@media print {
    
    /* Reset para impresión */
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    /* Ocultar elementos no imprimibles */
    .no-print,
    .navbar,
    .footer,
    .btn,
    .alert,
    .dropdown {
        display: none !important;
    }
    
    /* Ajustar para impresión */
    .contenedor {
        max-width: none;
        padding: 0;
    }
    
    .tarjeta {
        border: 1px solid #ddd;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    h1, h2, h3, h4, h5, h6 {
        break-after: avoid;
        color: black;
    }
    
    /* Enlaces en impresión */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
    
    a[href^="#"]:after,
    a[href^="javascript:"]:after {
        content: "";
    }
}