/* ==========================================================================
   Estilos para Vista de Índice del Código - Optimización Móvil
   ========================================================================== */

/* Contenedor principal responsivo */
@media (max-width: 768px) {
    .grid.lg\\:grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .lg\\:col-span-2 {
        grid-column: span 1 !important;
    }
}

/* Acordeón para libros en móvil */
.books-accordion {
    display: block;
}

@media (min-width: 768px) {
    .books-accordion {
        display: none;
    }
}

.books-list {
    display: none;
}

@media (min-width: 768px) {
    .books-list {
        display: block;
    }

    .books-accordion {
        display: none;
    }
}

/* Accordion individual */
.accordion-item {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    background: white;
}

.accordion-header {
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    border: none;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.accordion-header:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.accordion-header.active {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-bottom: 1px solid #e2e8f0;
}

.accordion-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
}

.accordion-stats {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.accordion-icon {
    transform: rotate(0deg);
    transition: transform 0.2s ease;
    color: #64748b;
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
}

.accordion-content.active {
    max-height: 2000px; /* Ajustable según el contenido */
}

.accordion-body {
    padding: 1rem;
    border-top: 1px solid #f1f5f9;
}

/* Botones de artículos mejorados */
.article-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.article-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 32px;
    min-width: 44px; /* Área táctil mínima */
    justify-content: center;
}

.article-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    color: white;
    text-decoration: none;
}

.article-pill-more {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.article-pill-more:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    box-shadow: 0 4px 8px rgba(100, 116, 139, 0.3);
}

/* Mejoras en la búsqueda rápida */
.quick-search-container {
    position: relative;
}

.quick-search-input {
    padding-left: 2.5rem !important;
    min-height: 48px !important; /* Área táctil adecuada */
    font-size: 1rem !important;
    border-radius: 0.75rem !important;
}

.quick-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    z-index: 10;
}

/* Estadísticas mejoradas para móvil */
@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .stat-card {
        padding: 1rem !important;
    }

    .stat-icon {
        width: 2rem !important;
        height: 2rem !important;
    }

    .stat-number {
        font-size: 1.25rem !important;
    }

    .stat-label {
        font-size: 0.75rem !important;
    }
}

/* Accesos rápidos optimizados */
.quick-access-card {
    padding: 0.75rem !important;
}

.quick-access-icon {
    width: 2.5rem !important;
    height: 2.5rem !important;
}

.quick-access-title {
    font-size: 0.875rem !important;
    line-height: 1.2 !important;
}

.quick-access-desc {
    font-size: 0.75rem !important;
    margin-top: 0.25rem !important;
}

/* Header responsivo */
@media (max-width: 640px) {
    .hero-section {
        padding: 2rem 1rem !important;
    }

    .hero-title {
        font-size: 1.875rem !important; /* 30px */
        line-height: 1.2 !important;
    }

    .hero-description {
        font-size: 0.875rem !important;
        margin-top: 1rem !important;
    }

    .hero-buttons {
        flex-direction: column !important;
        gap: 0.75rem !important;
        margin-top: 1.5rem !important;
    }

    .hero-button {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.75rem 1rem !important;
    }
}

/* Optimización para pantallas muy pequeñas */
@media (max-width: 375px) {
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .accordion-header {
        padding: 0.75rem !important;
    }

    .accordion-body {
        padding: 0.75rem !important;
    }

    .article-pill {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.6875rem !important;
    }
}

/* Smooth scrolling y animaciones */
.accordion-content {
    scroll-behavior: smooth;
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .accordion-content,
    .accordion-icon,
    .article-pill,
    .accordion-header {
        transition: none !important;
    }
}

/* Focus states para accesibilidad */
.accordion-header:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.article-pill:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .accordion-header {
        border: 2px solid #000;
    }

    .article-pill {
        border: 1px solid #000;
    }
}

/* Icons font awesome responsivos */
.fa-book, .fa-file-text, .fa-check-circle, .fa-link {
    font-size: 1rem;
}

@media (max-width: 640px) {
    .fa-book, .fa-file-text, .fa-check-circle, .fa-link {
        font-size: 0.875rem;
    }
}

/* Sidebar sticky en desktop */
@media (min-width: 1024px) {
    .sidebar-sticky {
        position: sticky;
        top: 2rem;
        align-self: start;
    }
}
