/* ==========================================================================
   Media Queries - AAV Utilidades v3
   ========================================================================== */

/* Desktop medio */
@media (max-width: 1400px) {
    .aav-layout {
        max-width: 100%;
        padding: 0 2rem;
    }
}

/* Tablet landscape */
@media (max-width: 1024px) {
    /* Layout de una columna */
    .aav-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1.5rem;
        max-width: 100%;
    }
    
    /* Sidebar como bloque normal */
    .aav-sidebar {
        position: relative;
        top: auto;
        max-height: none;
        margin-bottom: 2rem;
        padding: 0;
    }
    
    /* TOC estilo card con bordes redondeados */
    .aav-toc {
        background: white;
        border: 1px solid var(--aav-border);
        border-radius: 12px;
        padding: 1.5rem;
        margin: 0 0 1.5rem 0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    /* Mostrar título normal del TOC */
    .aav-toc-title {
        display: block;
        font-size: 1.25rem;
        font-weight: 600;
        margin: 0 0 1rem 0;
        color: var(--aav-heading);
    }
    
    /* Ocultar toggle - TOC siempre visible */
    .aav-toc-toggle-wrapper {
        display: none;
    }
    
    /* Lista del TOC siempre visible */
    .aav-toc-list {
        display: block !important;
        opacity: 1 !important;
    }
    
    /* Enlaces del TOC estilo moderno */
    .aav-toc-list > li > a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--aav-border-light);
        color: var(--aav-primary);
        font-weight: 500;
    }
    
    /* Último item sin borde */
    .aav-toc-list > li:last-child > a {
        border-bottom: none;
    }
    
    /* Ocultar dash del TOC en móvil */
    .aav-toc-list > li > a::before {
        display: none !important;
    }
    
    /* Chevron siempre visible y del color primario */
    .aav-toc-list .aav-chevron {
        position: static;
        transform: rotate(0deg);
        stroke: var(--aav-primary);
        opacity: 0.6;
    }
    
    /* Subitems del TOC */
    .aav-toc-list > li > ol {
        margin: 0 0 0 1rem !important;
        border-left: 2px solid var(--aav-border-light);
        padding-left: 1rem;
    }
    
    .aav-toc-list > li > ol a {
        color: var(--aav-gray);
        font-weight: 400;
        padding: 0.5rem 0;
    }
    
    /* Ocultar bloque de donación en sidebar */
    .aav-sidebar-donation {
        display: none;
    }
    
    /* Ajustar contenido principal */
    .aav-content {
        padding: 2rem;
        width: 100%;
        max-width: 100%;
    }
    
    /* Meta información debe ser visible */
    .aav-post-meta {
        display: block !important;
        visibility: visible !important;
    }
    
    /* Bloque de expertos debe ser visible */
    .aav-experts-list {
        display: block !important;
        visibility: visible !important;
    }
}

/* Tablet portrait y móvil grande */
@media (max-width: 768px) {
    /* Layout más compacto */
    .aav-layout {
        padding: 0 1rem;
    }
    
    .aav-content {
        padding: 1.5rem;
        border-radius: 6px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Prevenir desbordamiento horizontal */
    body.aav-single-post {
        overflow-x: hidden;
    }
    
    /* Título más pequeño */
    .aav-post-title {
        font-size: 1.75rem;
        line-height: 2.25rem;
    }
    
    /* Meta información mejorada para móvil */
    .aav-post-meta {
        border-bottom: 1px solid var(--aav-border);
        padding-bottom: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .aav-meta-row {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        align-items: flex-start;
        font-size: 0.85rem;
    }
    
    .aav-meta-row span {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
    }
    
    /* Toggle de expertos más visible */
    .aav-experts-toggle {
        font-weight: 600;
        color: var(--aav-primary);
    }
    
    /* Lista de expertos responsive */
    .aav-experts-list {
        margin-top: 0.75rem;
    }
    
    .aav-experts-list.show {
        display: block !important;
    }
    
    .aav-experts-card {
        background: var(--aav-bg-light);
        border-radius: 8px;
        padding: 0.75rem;
    }
    
    .aav-expert-item {
        padding: 0.75rem;
    }
    
    .aav-expert-photo,
    .aav-expert-photo-placeholder {
        width: 45px;
        height: 45px;
    }
    
    /* TOC en móvil - card style mejorado */
    .aav-toc {
        background: white;
        border: 1px solid var(--aav-border);
        border-radius: 12px;
        padding: 1.25rem;
        margin: 0 0 1.5rem 0;
    }
    
    .aav-toc-title {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    /* Enlaces del TOC más compactos */
    .aav-toc-list > li > a {
        padding: 0.6rem 0;
        font-size: 0.95rem;
    }
    
    /* Headings más pequeños */
    .aav-post-content h2,
    .aav-single-post .aav-content h2 {
        font-size: 1.35rem;
        line-height: 1.75rem;
        margin-top: 2rem;
    }
    
    .aav-post-content h3,
    .aav-single-post .aav-content h3 {
        font-size: 1.15rem;
        line-height: 1.5rem;
        margin-top: 1.5rem;
    }
    
    /* Imagen destacada más pequeña */
    .aav-featured-image-placeholder {
        height: 250px;
    }
    
    /* Bloques del footer más compactos */
    .aav-donation-block {
        padding: 2rem;
        margin: 2rem 0 1.5rem 0;
    }
    
    .aav-references-block {
        margin: 1.5rem 0;
        padding-top: 1.5rem;
    }
    
    .aav-related-guides {
        margin: 2rem 0 1.5rem 0;
    }
    
    .aav-guides-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Modales más pequeños */
    .aav-modal,
    .aav-contact-modal {
        width: 95%;
        margin: 1rem;
    }
    
    .aav-modal-header,
    .aav-contact-modal-header {
        padding: 1.25rem;
    }
    
    .aav-modal-body,
    .aav-contact-modal-body {
        padding: 1.25rem;
    }
    
    /* HERRAMIENTAS - Mismo estilo que TOC */
    .aav-tools-menu {
        background: white;
        border: 1px solid var(--aav-border);
        border-radius: 12px;
        padding: 1.5rem;
        margin: 0 0 1.5rem 0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    .aav-tools-menu h3 {
        font-size: 1.25rem;
        font-weight: 600;
        margin: 0 0 1rem 0;
        color: var(--aav-heading);
    }
    
    /* Mantener lista vertical para herramientas */
    .aav-tools-menu ul {
        display: block !important;
    }
    
    .aav-tools-menu li {
        margin-bottom: 0;
    }
    
    .aav-tools-menu a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--aav-border-light);
        color: var(--aav-primary);
        font-weight: 500;
        background: none !important;
        border-radius: 0 !important;
        margin-left: 0 !important;
    }
    
    .aav-tools-menu li:last-child a {
        border-bottom: none;
    }
    
    /* Ocultar dash en herramientas móvil */
    .aav-tools-menu a::before {
        display: none !important;
    }
    
    /* Añadir chevron a herramientas */
    .aav-tools-menu a::after {
        content: '';
        display: inline-block;
        width: 24px;
        height: 24px;
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23ff7700" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
        transform: rotate(-90deg);
        opacity: 0.6;
    }
}

/* Móvil pequeño */
@media (max-width: 480px) {
    /* Base font size más pequeño */
    html {
        font-size: 16px !important;
    }
    
    /* Layout sin padding lateral en móvil muy pequeño */
    .aav-layout {
        padding: 0 0.5rem;
    }
    
    /* Contenido con menos padding */
    .aav-content {
        padding: 1.25rem;
        box-shadow: none;
        border: 1px solid var(--aav-border);
    }
    
    /* Título aún más pequeño */
    .aav-post-title {
        font-size: 1.5rem;
        line-height: 2rem;
        margin-bottom: 0.75rem;
    }
    
    /* Meta más compacta */
    .aav-post-meta {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }
    
    .aav-meta-row {
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Iconos más pequeños */
    .aav-icon {
        width: 16px;
        height: 16px;
    }
    
    /* TOC más compacto */
    .aav-toc {
        padding: 1rem;
        margin-bottom: 1.25rem;
    }
    
    .aav-toc-title {
        font-size: 1rem;
    }
    
    .aav-toc-list > li > a {
        padding: 0.5rem 0;
        font-size: 0.9rem;
    }
    
    /* Herramientas más compactas */
    .aav-tools-menu {
        padding: 1rem;
    }
    
    .aav-tools-menu h3 {
        font-size: 1rem;
    }
    
    .aav-tools-menu a {
        padding: 0.5rem 0;
        font-size: 0.9rem;
    }
    
    /* Imagen destacada */
    .aav-featured-image {
        margin-bottom: 1.5rem;
    }
    
    .aav-featured-image-placeholder {
        height: 180px;
        font-size: 0.8rem;
    }
    
    /* Párrafos y listas */
    .aav-post-content p {
        margin-bottom: 1rem;
    }
    
    .aav-post-content ul,
    .aav-post-content ol {
        margin-bottom: 1rem;
        padding-left: 1.25rem;
    }
    
    /* Shortcodes más compactos */
    .aav-destacado,
    .aav-info-box {
        padding: 1rem;
        margin: 1.5rem 0;
    }
    
    .aav-destacado-footer {
        padding: 1.5rem;
        margin: 2rem 0 1rem 0;
    }
    
    .aav-steps-list {
        padding-left: 2.5rem !important;
    }
    
    .aav-steps-list li::before {
        left: -2.5rem;
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.7rem;
    }
    
    /* Bloques del footer */
    .aav-donation-block {
        padding: 1.5rem;
    }
    
    .aav-donation-block h3 {
        font-size: 1.15rem;
        margin-bottom: 0.75rem;
    }
    
    .aav-donation-block p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .aav-donation-button {
        padding: 0.6rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .aav-references-toggle {
        font-size: 1.1rem;
    }
    
    .aav-related-guides h3 {
        font-size: 1.15rem;
        margin-bottom: 1rem;
    }
    
    .aav-guide-card {
        padding: 1rem;
    }
    
    .aav-guide-card h4 {
        font-size: 1rem;
    }
    
    .aav-guide-card p {
        font-size: 0.85rem;
    }
}

/* Ajustes específicos para iPhone SE y similares */
@media (max-width: 375px) {
    .aav-content {
        padding: 1rem;
    }
    
    .aav-post-title {
        font-size: 1.35rem;
        line-height: 1.75rem;
    }
    
    .aav-toc,
    .aav-tools-menu {
        padding: 0.875rem;
    }
}

/* Print - ya definido en base.css pero añadimos más */
@media print {
    /* Mostrar todo el contenido expandido */
    .aav-toc-list,
    .aav-references-content,
    .aav-experts-list {
        display: block !important;
        max-height: none !important;
    }
    
    /* Ocultar elementos interactivos */
    .aav-toc-toggle,
    .aav-experts-toggle,
    .aav-references-toggle .aav-toggle-icon,
    .aav-chevron,
    .aav-chevron-small {
        display: none !important;
    }
    
    /* Layout de impresión */
    .aav-layout {
        display: block;
        padding: 0;
    }
    
    .aav-sidebar {
        page-break-after: always;
    }
}

/* Modo oscuro del sistema */
@media (prefers-color-scheme: dark) {
    /* Opcional: añadir soporte para modo oscuro en el futuro */
}

/* Alta resolución */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimizaciones para pantallas retina si es necesario */
}

