/**
 * TAZDUCA Responsive Design & Accessibility
 * Sistema completo de responsividad y accesibilidad web
 */

/* ========================================
   RESET Y BASE RESPONSIVE
======================================== */

/* Box sizing para todos los elementos */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Reset de margins/paddings */
* {
    margin: 0;
    padding: 0;
}

/* Configuración base responsive */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Configuración del viewport base */
body {
    min-height: 100vh;
    line-height: 1.6;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    word-wrap: break-word;
    hyphens: auto;
}

/* ========================================
   SISTEMA DE GRID RESPONSIVE
======================================== */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--space-4);
}

.container-sm {
    max-width: 640px;
}

.container-md {
    max-width: 768px;
}

.container-lg {
    max-width: 1024px;
}

.container-xl {
    max-width: 1280px;
}

/* Sistema de filas y columnas */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 calc(-1 * var(--space-3));
}

.col {
    flex: 1;
    padding: 0 var(--space-3);
    min-width: 0; /* Previene overflow en flex items */
}

/* Columnas específicas */
.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* ========================================
   BREAKPOINTS RESPONSIVE
======================================== */

/* Mobile First Approach */
/* Base: 0px - 639px (Mobile) */

/* Small tablets: 640px+ */
@media (min-width: 640px) {
    .container {
        padding: 0 var(--space-6);
    }
    
    html {
        font-size: 17px;
    }
    
    /* Columnas responsive SM */
    .sm\:col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .sm\:col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .sm\:col-3 { flex: 0 0 25%; max-width: 25%; }
    .sm\:col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .sm\:col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .sm\:col-6 { flex: 0 0 50%; max-width: 50%; }
    .sm\:col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .sm\:col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .sm\:col-9 { flex: 0 0 75%; max-width: 75%; }
    .sm\:col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .sm\:col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .sm\:col-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Utilidades responsive SM */
    .sm\:text-left { text-align: left; }
    .sm\:text-center { text-align: center; }
    .sm\:text-right { text-align: right; }
    .sm\:hidden { display: none; }
    .sm\:block { display: block; }
    .sm\:flex { display: flex; }
    .sm\:grid { display: grid; }
    .sm\:inline-block { display: inline-block; }
}

/* Medium tablets/laptops: 768px+ */
@media (min-width: 768px) {
    .container {
        padding: 0 var(--space-8);
    }
    
    html {
        font-size: 18px;
    }
    
    /* Columnas responsive MD */
    .md\:col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .md\:col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .md\:col-3 { flex: 0 0 25%; max-width: 25%; }
    .md\:col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .md\:col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .md\:col-6 { flex: 0 0 50%; max-width: 50%; }
    .md\:col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .md\:col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .md\:col-9 { flex: 0 0 75%; max-width: 75%; }
    .md\:col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .md\:col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .md\:col-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Utilidades responsive MD */
    .md\:text-left { text-align: left; }
    .md\:text-center { text-align: center; }
    .md\:text-right { text-align: right; }
    .md\:hidden { display: none; }
    .md\:block { display: block; }
    .md\:flex { display: flex; }
    .md\:grid { display: grid; }
    .md\:inline-block { display: inline-block; }
    
    /* Flexbox responsive MD */
    .md\:flex-row { flex-direction: row; }
    .md\:flex-col { flex-direction: column; }
    .md\:justify-start { justify-content: flex-start; }
    .md\:justify-center { justify-content: center; }
    .md\:justify-end { justify-content: flex-end; }
    .md\:justify-between { justify-content: space-between; }
    .md\:items-start { align-items: flex-start; }
    .md\:items-center { align-items: center; }
    .md\:items-end { align-items: flex-end; }
}

/* Large laptops/desktops: 1024px+ */
@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-12);
    }
    
    /* Columnas responsive LG */
    .lg\:col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .lg\:col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .lg\:col-3 { flex: 0 0 25%; max-width: 25%; }
    .lg\:col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .lg\:col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .lg\:col-6 { flex: 0 0 50%; max-width: 50%; }
    .lg\:col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .lg\:col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .lg\:col-9 { flex: 0 0 75%; max-width: 75%; }
    .lg\:col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .lg\:col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .lg\:col-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Utilidades responsive LG */
    .lg\:text-left { text-align: left; }
    .lg\:text-center { text-align: center; }
    .lg\:text-right { text-align: right; }
    .lg\:hidden { display: none; }
    .lg\:block { display: block; }
    .lg\:flex { display: flex; }
    .lg\:grid { display: grid; }
    .lg\:inline-block { display: inline-block; }
    
    /* Grid responsive LG */
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Extra large screens: 1280px+ */
@media (min-width: 1280px) {
    .container {
        padding: 0 var(--space-16);
    }
    
    /* Columnas responsive XL */
    .xl\:col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .xl\:col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .xl\:col-3 { flex: 0 0 25%; max-width: 25%; }
    .xl\:col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .xl\:col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .xl\:col-6 { flex: 0 0 50%; max-width: 50%; }
    .xl\:col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .xl\:col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .xl\:col-9 { flex: 0 0 75%; max-width: 75%; }
    .xl\:col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .xl\:col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .xl\:col-12 { flex: 0 0 100%; max-width: 100%; }
    
    .xl\:hidden { display: none; }
    .xl\:block { display: block; }
    .xl\:flex { display: flex; }
    .xl\:grid { display: grid; }
}

/* ========================================
   COMPONENTES RESPONSIVE ESPECÍFICOS
======================================== */

/* Header/Navigation responsive */
.header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-primary);
    transition: all var(--transition-base);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
}

.nav-brand {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-menu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-top: none;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
}

.nav-item {
    padding: var(--space-3) var(--space-4);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: var(--font-medium);
    transition: color var(--transition-base);
}

.nav-link:hover,
.nav-link:focus {
    color: var(--primary-blue);
    outline: none;
}

.nav-toggle {
    display: block;
    background: none;
    border: none;
    font-size: var(--text-xl);
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.nav-toggle:hover,
.nav-toggle:focus {
    background: var(--bg-secondary);
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* Navigation responsive breakpoints */
@media (min-width: 768px) {
    .nav-menu {
        display: flex;
        flex-direction: row;
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        gap: var(--space-6);
    }
    
    .nav-menu.open {
        display: flex;
        flex-direction: row;
    }
    
    .nav-item {
        padding: 0;
    }
    
    .nav-toggle {
        display: none;
    }
}

/* Cards responsive */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    margin: var(--space-8) 0;
}

@media (min-width: 640px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: var(--space-8);
    }
}

/* Hero section responsive */
.hero {
    padding: var(--space-16) 0;
    text-align: center;
}

.hero h1 {
    font-size: var(--text-3xl);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-6);
}

.hero p {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-8);
}

@media (min-width: 768px) {
    .hero {
        padding: var(--space-24) 0;
    }
    
    .hero h1 {
        font-size: var(--text-5xl);
    }
    
    .hero p {
        font-size: var(--text-xl);
    }
}

@media (min-width: 1024px) {
    .hero h1 {
        font-size: var(--text-6xl);
    }
}

/* Formularios responsive */
.form {
    max-width: 100%;
}

.form-group {
    margin-bottom: var(--space-6);
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

@media (min-width: 768px) {
    .form {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .form-row {
        flex-direction: row;
    }
    
    .form-row .form-group {
        flex: 1;
        margin-bottom: var(--space-6);
    }
}

/* ========================================
   ACCESIBILIDAD COMPLETA
======================================== */

/* Focus management */
*:focus {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* Elementos interactivos */
button, 
[role="button"],
input[type="submit"],
input[type="button"],
input[type="reset"] {
    cursor: pointer;
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Estados disabled */
button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Links accesibles */
a {
    color: var(--primary-blue);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: all var(--transition-base);
}

a:hover,
a:focus {
    color: var(--primary-blue-dark);
    text-decoration-thickness: 2px;
}

a:visited {
    color: var(--accent-purple);
}

/* Skip links para navegación por teclado */
.skip-links {
    position: absolute;
    top: -40px;
    left: 6px;
    z-index: var(--z-modal);
}

.skip-link {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: static;
    width: auto;
    height: auto;
    padding: var(--space-2) var(--space-4);
    background: var(--primary-blue);
    color: var(--text-inverse);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: var(--font-medium);
}

/* Screen reader only content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.sr-only-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* Indicadores de estado para screen readers */
.status-indicator {
    position: relative;
}

.status-indicator::after {
    content: attr(aria-label);
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Form labels accesibles */
.form-label {
    display: block;
    font-weight: var(--font-medium);
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.form-label.required::after {
    content: ' *';
    color: var(--error);
    aria-label: 'required';
}

/* Error states accesibles */
.form-control.is-invalid {
    border-color: var(--error);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke='%23fff' d='m5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23fff' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-error {
    display: block;
    font-size: var(--text-sm);
    color: var(--error);
    margin-top: var(--space-1);
}

.form-error::before {
    content: '⚠ ';
    font-weight: var(--font-bold);
}

/* Estados de validación exitosa */
.form-control.is-valid {
    border-color: var(--success);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%2310b981' viewBox='0 0 12 12'%3e%3cpath d='m3.5 5.5 1.5 1.5 3.5-3.5-1-1L5 5 4.5 4.5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Tooltips accesibles */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--text-inverse);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    white-space: nowrap;
    z-index: var(--z-tooltip);
    transition: all var(--transition-base);
    pointer-events: none;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--gray-800);
}

.tooltip:hover .tooltip-content,
.tooltip:focus .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Modales accesibles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    margin: var(--space-4);
    transform: scale(0.9);
    transition: transform var(--transition-base);
}

.modal.open .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-primary);
}

.modal-title {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-xl);
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.modal-close:hover,
.modal-close:focus {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding: var(--space-6);
    border-top: 1px solid var(--border-primary);
}

/* ========================================
   OPTIMIZACIONES PARA DISPOSITIVOS TACTILES
======================================== */

/* Tamaños mínimos de toque (44px) */
button,
[role="button"],
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn {
    min-height: 44px;
    min-width: 44px;
}

/* Scroll suave en dispositivos móviles */
@media (hover: none) and (pointer: coarse) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Mejoras para input en móviles */
    input,
    textarea,
    select {
        font-size: 16px; /* Previene zoom en iOS */
        transform: translateZ(0); /* Fuerza aceleración de hardware */
    }
    
    /* Botones más grandes en móvil */
    .btn {
        min-height: 48px;
        padding: var(--space-4) var(--space-6);
    }
    
    /* Cards con mejor spacing en móvil */
    .card {
        margin-bottom: var(--space-6);
    }
}

/* ========================================
   PREFERENCIAS DEL USUARIO
======================================== */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-primary: #000000;
        --border-secondary: #000000;
        --text-secondary: #000000;
        --text-tertiary: #333333;
    }
    
    .btn,
    .form-control,
    .card {
        border-width: 2px;
    }
    
    a {
        text-decoration-thickness: 2px;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1f2937;
        --bg-secondary: #374151;
        --bg-tertiary: #4b5563;
        --surface: #374151;
        --surface-elevated: #4b5563;
        
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-tertiary: #9ca3af;
        --text-inverse: #1f2937;
        
        --border-primary: #4b5563;
        --border-secondary: #6b7280;
    }
}

/* ========================================
   UTILIDADES DE ACCESIBILIDAD
======================================== */

/* Indicador de foco visible mejorado */
.focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Texto con contraste alto */
.high-contrast {
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
}

/* Spacing para lectores de pantalla */
.screen-reader-spacing > * + * {
    margin-top: var(--space-4);
}

/* Lista de landmarks para navegación */
.landmarks {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.landmarks:focus {
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    padding: var(--space-4);
    background: var(--primary-blue);
    color: var(--text-inverse);
    z-index: var(--z-modal);
}

/* Estados de carga accesibles */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading[aria-label]::before {
    content: attr(aria-label);
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Error boundaries accesibles */
.error-boundary {
    padding: var(--space-8);
    text-align: center;
    background: var(--bg-secondary);
    border: 2px solid var(--error);
    border-radius: var(--radius-lg);
    margin: var(--space-8) 0;
}

.error-boundary h2 {
    color: var(--error);
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
}

.error-boundary p {
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}

/* ========================================
   PRINT STYLES
======================================== */

@media print {
    /* Reset para impresión */
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    /* Ocultar elementos no necesarios */
    nav,
    .nav,
    .modal,
    .tooltip,
    .no-print {
        display: none !important;
    }
    
    /* Mostrar solo en impresión */
    .print-only {
        display: block !important;
    }
    
    /* Optimizaciones de página */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    p, blockquote, ul, ol {
        page-break-inside: avoid;
    }
    
    /* Links en impresión */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 90%;
    }
    
    a[href^="#"]:after,
    a[href^="javascript:"]:after {
        content: "";
    }
    
    /* Imágenes en impresión */
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}

/* ========================================
   RESPONSIVE IMAGES
======================================== */

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

picture {
    display: block;
}

/* Lazy loading placeholder */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity var(--transition-base);
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Responsive embeds */
.embed-responsive {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
}

.embed-responsive::before {
    content: "";
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

.embed-responsive iframe,
.embed-responsive video,
.embed-responsive embed,
.embed-responsive object {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Aspect ratios */
.embed-responsive-21by9::before {
    padding-top: 42.857143%; /* 21:9 */
}

.embed-responsive-16by9::before {
    padding-top: 56.25%; /* 16:9 */
}

.embed-responsive-4by3::before {
    padding-top: 75%; /* 4:3 */
}

.embed-responsive-1by1::before {
    padding-top: 100%; /* 1:1 */
}