/* ===================================================================
   BIBLIOTECA CSS - PÁGINA COMPLETA
   =================================================================== */

/* ===================================================================
   HERO BIBLIOTECA
   =================================================================== */

.biblioteca-hero {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 50%, #90caf9 100%);
    padding: 140px 40px 80px 40px;
    text-align: center;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.biblioteca-hero-content {
    max-width: 700px;
    width: 100%;
}

.biblioteca-hero h1 {
    font-size: 3.2em;
    color: var(--primary-dark);
    margin-bottom: 20px;
    font-weight: 700;
}

.biblioteca-hero p {
    font-size: 1.3em;
    color: var(--text-light);
    margin-bottom: 40px;
}

/* Buscador de Biblioteca */
.search-biblioteca {
    width: 100%;
    margin-top: 35px;
    max-width: none; 
}

.search-container-biblioteca {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 60px;
    padding: 8px 8px 8px 25px;
    box-shadow: 0 10px 40px rgba(36, 103, 180, 0.15);
    transition: var(--transition);
}

.search-container-biblioteca:focus-within {
    box-shadow: 0 0 0 4px rgba(36, 103, 180, 0.1);
    transform: translateY(-2px);
}

.search-icon-biblioteca {
    color: var(--primary-color);
    font-size: 20px;
    margin-right: 15px;
}

.search-input-biblioteca {
    flex: 1;
    border: none;
    outline: none;
    padding: 15px 10px;
    font-size: 16px;
    color: var(--text-dark);
}

.search-input-biblioteca::placeholder {
    color: #aaa;
}

.search-btn-biblioteca {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 35px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-btn-biblioteca:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 20px rgba(36, 103, 180, 0.3);
}

/* ===================================================================
   LAYOUT PRINCIPAL BIBLIOTECA
   =================================================================== */

.biblioteca-main {
    background: var(--bg-light);
    padding: 60px 40px 100px 40px;
}

.biblioteca-container {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
}

/* ===================================================================
   SIDEBAR - FILTROS
   =================================================================== */

.biblioteca-sidebar {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.sidebar-header h3 {
    font-size: 1.3em;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-reset-filters {
    background: transparent;
    color: var(--primary-color);
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-reset-filters:hover {
    background: var(--bg-light);
}

/* Grupos de Filtros */
.filter-group {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.filter-group:last-of-type {
    border-bottom: none;
}

.filter-title {
    font-size: 1em;
    color: var(--text-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.filter-title i {
    color: var(--primary-color);
    font-size: 0.9em;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.filter-option:hover {
    background: var(--bg-light);
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.filter-option span {
    flex: 1;
    color: var(--text-dark);
    font-size: 0.95em;
}

.filter-count {
    color: var(--text-light);
    font-size: 0.85em;
}

/* CTA Premium Sidebar */
.sidebar-cta {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 25px 20px;
    border-radius: var(--border-radius);
    text-align: center;
    color: white;
    margin-top: 30px;
}

.sidebar-cta i {
    font-size: 2.5em;
    margin-bottom: 15px;
    opacity: 0.9;
}

.sidebar-cta h4 {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.sidebar-cta p {
    font-size: 0.9em;
    margin-bottom: 20px;
    opacity: 0.95;
}

.btn-premium {
    display: inline-block;
    background: white;
    color: var(--primary-color);
    padding: 10px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ===================================================================
   CONTENIDO PRINCIPAL
   =================================================================== */

.biblioteca-content {
    width: 100%;
}

/* Toolbar */
.biblioteca-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 25px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 20px;
}

.toolbar-left {
    flex: 1;
}

.resultados-count {
    color: var(--text-dark);
    font-size: 1em;
}

.resultados-count strong {
    color: var(--primary-color);
    font-size: 1.2em;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Dropdown Ordenar */
.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-dropdown label {
    color: var(--text-dark);
    font-size: 0.95em;
    font-weight: 500;
}

.sort-dropdown select {
    padding: 10px 35px 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    background: white;
    color: var(--text-dark);
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.sort-dropdown select:hover {
    border-color: var(--primary-color);
}

.sort-dropdown select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(36, 103, 180, 0.1);
}

/* Vista Toggle */
.view-toggle {
    display: flex;
    gap: 5px;
    background: var(--bg-light);
    padding: 4px;
    border-radius: 8px;
}

.btn-view {
    background: transparent;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
}

.btn-view:hover {
    color: var(--primary-color);
}

.btn-view.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* ===================================================================
   GRID DE RECURSOS
   =================================================================== */

.biblioteca-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

/* Card de Recurso */
.resource-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    border: 2px solid transparent;
}

.resource-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

/* Badge */
.resource-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    z-index: 10;
    color: white;
}

.resource-badge.free {
    background: #4caf50;
}

.resource-badge.premium {
    background: #ff9800;
}

.resource-badge.popular {
    background: #e91e63;
}

/* Imagen */
.resource-image {
    width: 100%;
    height: 280px;
    overflow: hidden;
    position: relative;
    background: var(--bg-light);
}

.resource-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.resource-card:hover .resource-image img {
    transform: scale(1.08);
}

/* Overlay */
.resource-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.resource-card:hover .resource-overlay {
    opacity: 1;
}

.btn-quick-view {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-quick-view:hover {
    transform: scale(1.05);
}

/* Contenido */
.resource-content {
    padding: 25px;
}

.resource-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.resource-level,
.resource-format {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.resource-level {
    background: #e3f2fd;
    color: var(--primary-color);
    font-weight: 600;
}

.resource-level.basico {
    background: #e8f5e9;
    color: #4caf50;
}

.resource-level.intermediario {
    background: #fff3e0;
    color: #ff9800;
}

.resource-level.avancado {
    background: #fce4ec;
    color: #e91e63;
}

.resource-format {
    background: var(--bg-light);
    color: var(--text-light);
}

.resource-title {
    font-size: 1.3em;
    color: var(--primary-dark);
    margin-bottom: 10px;
    font-weight: 600;
    line-height: 1.3;
    min-height: 60px;
}

.resource-author {
    color: var(--text-light);
    font-size: 0.9em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.resource-description {
    color: var(--text-light);
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 15px;
    min-height: 75px;
}

.resource-info {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.resource-pages,
.resource-downloads,
.resource-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-light);
    font-size: 0.9em;
}

.resource-rating {
    color: #ffc107;
}

.resource-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resource-price {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-color);
}

.btn-download {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(36, 103, 180, 0.3);
}

.btn-download.premium {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

.btn-download.premium:hover {
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

/* ===================================================================
   VISTA LISTA
   =================================================================== */

.biblioteca-grid.view-list {
    grid-template-columns: 1fr;
}

.biblioteca-grid.view-list .resource-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    height: auto;
}

.biblioteca-grid.view-list .resource-image {
    height: 100%;
    min-height: 250px;
}

.biblioteca-grid.view-list .resource-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.biblioteca-grid.view-list .resource-title {
    min-height: auto;
}

.biblioteca-grid.view-list .resource-description {
    min-height: auto;
}

/* ===================================================================
   PAGINACIÓN
   =================================================================== */

.biblioteca-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
}

.btn-pagination {
    background: white;
    border: 2px solid #ddd;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
}

.btn-pagination:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-pagination:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-page {
    background: white;
    border: 2px solid #ddd;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-dark);
}

.btn-page:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-page.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination-dots {
    color: var(--text-light);
    font-weight: 700;
}

/* ===================================================================
/* ===================================================================
   NAVBAR ACTIVE STATE
   Estilos centralizados en: /static/css/navbar.css
   =================================================================== */


/* ===================================================================
   RESPONSIVE - BIBLIOTECA
   =================================================================== */

@media (max-width: 1400px) {
    .biblioteca-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 1200px) {
    .biblioteca-container {
        grid-template-columns: 260px 1fr;
        gap: 30px;
    }

    .biblioteca-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 1024px) {
    .biblioteca-hero {
        padding: 120px 30px 60px 30px;
    }

    .biblioteca-hero h1 {
        font-size: 2.5em;
    }

    .biblioteca-main {
        padding: 50px 30px 80px 30px;
    }

    .biblioteca-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .biblioteca-sidebar {
        position: static;
        order: 2;
    }

    .biblioteca-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    /* Sidebar móvil */
    .biblioteca-sidebar {
        display: none;
    }

    .biblioteca-sidebar.active {
        display: block;
    }
}

@media (max-width: 768px) {
    .biblioteca-hero {
        padding: 100px 20px 50px 20px;
        min-height: 350px;
    }
    /*mas espacio a los botones de ver y descargar*/
     .resource-footer{
        gap: 12px;              /* separación entre precio y botones */
        flex-wrap: nowrap;
        align-items: center;
    }

    .btn-download{
        padding: 7px 12px;     /* botón un poco más pequeño */
        font-size: 0.85rem;
        min-width: 80px;
        text-align: center;
    }
  
    .biblioteca-hero h1 {
        font-size: 2em;
    }

    .biblioteca-hero p {
        font-size: 1.1em;
    }

    .search-btn-biblioteca {
        padding: 12px 25px;
    }

    .search-btn-biblioteca span {
        display: none;
    }

    .biblioteca-main {
        padding: 40px 20px 60px 20px;
    }

    .biblioteca-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-right {
        justify-content: space-between;
        width: 100%;
    }

    .sort-dropdown {
        flex: 1;
    }

    .sort-dropdown select {
        width: 100%;
    }

    .biblioteca-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .biblioteca-grid.view-list .resource-card {
        grid-template-columns: 1fr;
    }

    .biblioteca-grid.view-list .resource-image {
        min-height: 250px;
    }

    .biblioteca-pagination {
        flex-wrap: wrap;
        gap: 10px;
    }

    .btn-pagination {
        padding: 10px 20px;
    }

    .btn-page {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .biblioteca-hero h1 {
        font-size: 1.7em;
    }

    .search-container-biblioteca {
        padding: 6px 6px 6px 20px;
    }

    .search-input-biblioteca {
        padding: 12px 8px;
        font-size: 14px;
    }

    .search-btn-biblioteca {
        padding: 12px 20px;
    }

    .biblioteca-toolbar {
        padding: 15px 20px;
    }

    .resource-card {
        border-radius: 10px;
    }

    .resource-image {
        height: 220px;
    }

    .resource-content {
        padding: 20px;
    }

    .resource-title {
        font-size: 1.2em;
        min-height: auto;
    }

    .resource-description {
        min-height: auto;
    }

    .pagination-numbers .btn-page:not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
}