/* ==========================================================================
   Componentes del Single Post
   ========================================================================== */

/* ==========================================================================
   Meta información del post
   ========================================================================== */
.aav-post-meta {
    border-bottom: 2px solid var(--aav-border);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.aav-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    color: var(--aav-gray);
    font-size: var(--aav-meta-size);
}

.aav-meta-row span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Iconos en meta */
.aav-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    flex-shrink: 0;
}

/* ==========================================================================
   Bloque de expertos
   ========================================================================== */
.aav-experts-toggle {
    margin-top: 0;
    font-size: var(--aav-meta-size);
    color: var(--aav-gray);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s ease;
}

.aav-experts-toggle:hover {
    color: var(--aav-text);
}

.aav-chevron-small {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    transition: transform 0.3s ease;
}

.aav-experts-toggle.active .aav-chevron-small {
    transform: rotate(180deg);
}

/* Lista de expertos */
.aav-experts-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 1rem;
}

.aav-experts-list.show {
    max-height: 1000px;
}

.aav-experts-card {
    background: var(--aav-bg-light);
    border-radius: 12px;
    padding: 1rem;
}

.aav-expert-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    transition: background 0.2s ease;
    border-radius: 8px;
}

.aav-expert-item:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Foto del experto */
.aav-expert-photo,
.aav-expert-photo-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    flex-shrink: 0;
}

.aav-expert-photo {
    object-fit: cover;
}

.aav-expert-photo-placeholder {
    background: var(--aav-gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--aav-gray);
}

/* Información del experto */
.aav-expert-info {
    flex: 1;
}

.aav-expert-name {
    font-weight: 600;
    color: var(--aav-heading);
    margin: 0 0 0.25rem 0;
}

.aav-expert-role {
    font-size: 0.9rem;
    color: var(--aav-gray);
    margin: 0;
}

/* Botón de contacto */
.aav-expert-contact {
    background: transparent;
    color: var(--aav-primary);
    border: 2px solid var(--aav-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.aav-expert-contact:hover {
    background: var(--aav-primary);
    color: white;
}

/* ==========================================================================
   TOC (Table of Contents) - RESPONSIVE MEJORADO
   ========================================================================== */
.aav-toc {
    font-size: var(--aav-font-size);
    line-height: var(--aav-line-height);
    background: transparent;
    padding: 1.5rem 0 1.5rem 1.5rem;
    margin-top: 1.25rem;
}

/* Título del TOC desktop */
.aav-toc-title {
    font-size: var(--aav-h3-size);
    line-height: var(--aav-h3-height);
    font-weight: 700;
    margin: 0 0 1rem 0;
    color: var(--aav-heading);
}

/* Toggle oculto por defecto en desktop */
.aav-toc-toggle-wrapper {
    display: none;
}

/* Lista del TOC */
.aav-toc ol,
.aav-toc-list {
    list-style: none !important;
    list-style-type: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.aav-toc li {
    counter-increment: none !important;
    position: relative;
    margin-left: 0 !important;
    margin-bottom: 0 !important;
}

/* Enlaces del TOC desktop */
.aav-toc-list a {
    display: block;
    padding: 0.25rem 3rem 0.25rem 1.25rem;
    color: var(--aav-text);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 400;
    line-height: 1.4;
    cursor: pointer;
}

/* Dash para desktop */
.aav-toc-list > li > a::before,
.aav-toc-list ol li a::before {
    content: "–" !important;
    position: absolute;
    left: 0;
    color: var(--aav-gray);
}

/* Chevron SVG desktop */
.aav-chevron {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    stroke: var(--aav-gray);
    transition: transform 0.3s ease;
    pointer-events: none;
}

/* Estados desktop */
.aav-toc-list > li.has-children.expanded .aav-chevron {
    transform: translateY(-50%) rotate(180deg);
}

.aav-toc-list a:hover {
    text-decoration: underline;
    color: var(--aav-text);
}

.aav-toc-list a.active {
    font-weight: 700 !important;
    color: #000000 !important;
    opacity: 1 !important;
}

/* Subitems desktop */
.aav-toc-list > li > ol {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 0 1.5rem !important;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.aav-toc-list > li.expanded > ol {
    display: block;
    opacity: 1;
}

/* ==========================================================================
   TOC Responsive - Diseño móvil mejorado
   ========================================================================== */
@media (max-width: 1024px) {
    .aav-toc {
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 16px;
        padding: 1.5rem;
        margin: 0 0 2rem 0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    /* CRÍTICO: Resetear counters y forzar que no se apliquen */
    .aav-toc,
    .aav-toc ol,
    .aav-toc-list {
        counter-reset: none !important;
    }
    
    /* Mostrar título */
    .aav-toc-title {
        display: block !important;
        font-size: 1.1rem;
        font-weight: 600;
        margin: 0 0 0.75rem 0;
        color: #000;
    }
    
    /* Lista siempre visible en móvil */
    .aav-toc-list {
        display: block !important;
        opacity: 1 !important;
        list-style: none !important;
    }
    
    /* MÁXIMA ESPECIFICIDAD para quitar números - usando el ID del ol */
    #aav-toc-list > li::before,
    #aav-toc-list li::before,
    ol#aav-toc-list > li::before,
    ol#aav-toc-list li::before,
    .aav-toc ol#aav-toc-list > li::before,
    .aav-toc ol#aav-toc-list li::before {
        display: none !important;
        content: none !important;
        counter-increment: none !important;
    }
    
    /* También con clases para mayor cobertura */
    ol.aav-toc-list > li::before,
    ol.aav-toc-list li::before,
    .aav-toc ol.aav-toc-list > li::before,
    .aav-toc ol.aav-toc-list li::before,
    .aav-single-post .aav-post-content .aav-toc ol > li::before,
    .aav-single-post .aav-post-content .aav-toc-list > li::before,
    .aav-single-post .aav-content .aav-toc ol > li::before,
    .aav-single-post .aav-content .aav-toc-list > li::before,
    .aav-post-content .aav-toc ol > li::before,
    .aav-post-content .aav-toc-list > li::before,
    .aav-content .aav-toc ol > li::before,
    .aav-content .aav-toc-list > li::before,
    .aav-toc ol > li::before,
    .aav-toc-list > li::before,
    .aav-toc-list li::before {
        display: none !important;
        content: none !important;
        counter-increment: none !important;
    }
    
    /* Forzar NO números con alta especificidad */
    .aav-single-post .aav-toc-list li,
    .aav-toc-list li,
    .aav-toc ol li {
        counter-increment: none !important;
        list-style: none !important;
    }
    
    /* Enlaces estilo móvil - texto negro, sin borders */
    .aav-toc-list > li > a {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important; /* Cambiado de space-between a flex-start */
        padding: 0.5rem 0;
        color: #000 !important;
        font-weight: 400;
        font-size: 0.95rem;
        border: none !important;
        border-bottom: none !important;
        text-decoration: none;
        position: relative;
    }
    
    /* FORZAR el dash a aparecer */
    .aav-single-post .aav-toc-list > li > a::before,
    .aav-toc-list > li > a::before {
        content: "–" !important;
        display: inline-block !important;
        position: static !important;
        color: #000 !important;
        font-weight: normal !important;
        margin-right: 0.75rem !important;
        line-height: 1 !important;
        opacity: 1 !important;
        visibility: visible !important;
        flex-shrink: 0; /* Evitar que el dash se comprima */
    }
    
    /* Texto del enlace debe ocupar el espacio disponible */
    .aav-toc-list > li > a {
        flex: 1 1 auto;
    }
    
    /* Hover sutil */
    .aav-toc-list > li > a:hover {
        color: var(--aav-primary) !important;
        text-decoration: none;
    }
    
    /* Chevron móvil - SOLO para items con hijos */
    .aav-toc-list > li.has-children > a .aav-chevron {
        display: block !important;
        position: absolute !important;
        right: 0 !important;
        top: 0.5rem !important;
        transform: rotate(0deg); /* Apunta hacia abajo cuando cerrado */
        stroke: #666;
        opacity: 0.6;
        width: 20px;
        height: 20px;
        transition: transform 0.3s ease;
        margin-left: auto; /* Empujar el chevron a la derecha */
    }
    
    /* Ocultar chevron en items sin hijos */
    .aav-toc-list > li:not(.has-children) .aav-chevron {
        display: none !important;
    }
    
    /* OCULTAR subitems por defecto */
    .aav-toc-list > li > ol {
        display: none !important;
        opacity: 0 !important;
        list-style: none !important;
        counter-reset: none !important;
    }
    
    /* Mostrar subitems cuando expandido */
    .aav-toc-list > li.expanded > ol {
        display: block !important;
        opacity: 1 !important;
        margin: 0.25rem 0 0.25rem 1.5rem !important;
        padding: 0 !important;
        border: none !important;
    }
    
    /* Subitems sin números - quitar también el ::before */
    .aav-toc-list > li > ol li::before {
        display: none !important;
        content: none !important;
    }
    
    /* Dash en subitems dentro del enlace */
    .aav-toc-list > li > ol a::before {
        content: "–" !important;
        position: absolute !important;
        left: 0 !important;
        color: #666 !important;
    }
    
    .aav-toc-list > li > ol a {
        display: block;
        padding: 0.4rem 0;
        color: #666 !important;
        font-weight: 400;
        font-size: 0.9rem;
        border: none !important;
        text-decoration: none;
    }
    
    .aav-toc-list > li > ol a:hover {
        color: var(--aav-primary) !important;
    }
    
    /* Chevron expandido - apunta hacia arriba */
    .aav-toc-list > li.has-children.expanded .aav-chevron {
        transform: rotate(180deg) !important;
    }
}

/* ==========================================================================
   Referencias
   ========================================================================== */
.aav-references-block {
    margin: 3rem 0 2rem 0;
    padding-top: 2rem;
    border-top: 2px solid var(--aav-border);
}

/* Toggle de referencias */
.aav-references-toggle {
    background: none;
    border: none;
    padding: 0;
    font-size: var(--aav-h3-size);
    font-weight: 700;
    color: var(--aav-heading);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    text-align: left;
    margin-bottom: 1rem;
    position: relative; /* Añadido para debugging */
}

.aav-references-toggle:hover {
    color: var(--aav-primary);
}

/* Chevron SVG - forzar visibilidad */
.aav-references-toggle svg.aav-chevron {
    width: 24px !important;
    height: 24px !important;
    transition: transform 0.3s ease;
    display: inline-block !important;
    stroke: currentColor !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important; /* Cambiado de relative a static */
    flex-shrink: 0;
    margin-left: 0.5rem; /* Espacio entre texto y chevron */
    vertical-align: middle; /* Alineación vertical */
}

.aav-references-toggle[aria-expanded="true"] svg.aav-chevron {
    transform: rotate(180deg);
}

/* Contenido de referencias */
.aav-references-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.aav-references-content.show {
    max-height: 1000px;
}

/* Lista de referencias */
.aav-references-list {
    counter-reset: references;
    padding-left: 2rem;
    margin-top: 0rem !important;
    margin-bottom: 0;
}

/* Ocultar los números automáticos que añade layout.css */
.aav-references-list li::before {
    display: none !important;
}

/* Resetear el padding que layout.css añade para los números */
.aav-references-list li {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.aav-references-list li {
    counter-increment: references;
    margin-bottom: 0.75rem;
    color: var(--aav-gray);
    font-size: var(--aav-meta-size);
}

.aav-references-list li::before {
    content: counter(references) ". ";
    font-weight: 600;
    color: var(--aav-text);
}

.aav-references-list a {
    color: var(--aav-primary);
    text-decoration: none;
}

.aav-references-list a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Guías relacionadas
   ========================================================================== */
.aav-related-guides {
    margin: 3rem 0 2rem 0;
}

.aav-related-guides h3 {
    font-size: var(--aav-h3-size);
    line-height: var(--aav-h3-height);
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    color: var(--aav-heading);
}

/* Grid de guías */
.aav-guides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Card de guía */
.aav-guide-card {
    background: var(--aav-bg-light);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.aav-guide-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.aav-guide-card h4 {
    font-size: 1.1rem;
    margin: 0 0 0.75rem 0;
}

.aav-guide-card h4 a {
    color: var(--aav-heading);
    text-decoration: none;
}

.aav-guide-card h4 a:hover {
    color: var(--aav-primary);
}

.aav-guide-card p {
    margin: 0;
    color: var(--aav-gray);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ==========================================================================
   Bloque de donación
   ========================================================================== */
.aav-donation-block {
    background: white;
    border: 2px solid var(--aav-primary);
    color: var(--aav-text);
    padding: 3rem;
    border-radius: 16px;
    text-align: center;
    margin: 3rem 0 2rem 0;
    position: relative;
    overflow: hidden;
}

/* Patrón decorativo - ajustado para fondo blanco */
.aav-donation-block::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,119,0,0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    transform: rotate(45deg);
}

.aav-donation-block > * {
    position: relative;
    z-index: 1;
}

.aav-donation-block h3 {
    font-size: 1.75rem;
    margin: 0 0 1rem 0;
    color: var(--aav-heading);
}

.aav-donation-block p {
    font-size: 1.1rem;
    margin: 0 0 1.5rem 0;
    color: var(--aav-text);
    opacity: 0.85;
}

.aav-donation-button {
    display: inline-block;
    background: var(--aav-primary);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.aav-donation-button:hover {
    background: #e56a00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ==========================================================================
   Sidebar de donación (versión compacta)
   ========================================================================== */
.aav-sidebar-donation {
    background: var(--aav-bg-light);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: center;
}

.aav-sidebar-donation h4 {
    font-size: 1.1rem;
    margin: 0 0 0.75rem 0;
    color: var(--aav-heading);
}

.aav-sidebar-donation p {
    font-size: 0.9rem;
    color: var(--aav-gray);
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.aav-sidebar-donation .aav-donation-button {
    display: inline-block;
    background: var(--aav-primary);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.aav-sidebar-donation .aav-donation-button:hover {
    background: #e56a00;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Responsive para componentes
   ========================================================================== */
@media (max-width: 768px) {
    /* Meta más compacta */
    .aav-meta-row {
        gap: 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Expertos más compactos */
    .aav-expert-item {
        padding: 0.75rem;
    }
    
    .aav-expert-photo,
    .aav-expert-photo-placeholder {
        width: 45px;
        height: 45px;
    }
    
    /* Guías relacionadas - una columna */
    .aav-guides-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Donación más compacta */
    .aav-donation-block {
        padding: 2rem;
    }
    
    .aav-donation-block h3 {
        font-size: 1.35rem;
    }
    
    .aav-donation-block p {
        font-size: 1rem;
    }
}

/* ==========================================================================
   Estados de impresión
   ========================================================================== */
@media print {
    /* Expandir todo el contenido colapsable */
    .aav-experts-list,
    .aav-references-content {
        max-height: none !important;
        display: block !important;
    }
    
    /* Ocultar toggles */
    .aav-experts-toggle,
    .aav-references-toggle .aav-toggle-icon {
        display: none;
    }
    
    /* Ocultar bloques de donación */
    .aav-donation-block,
    .aav-sidebar-donation {
        display: none;
    }
}