/* ==========================================
   ESTILOS PREMIUM - BIBLIOTECA
   Basado en ESTILOS_VISUALES_PREMIUM.md
   Extraído de biblioteca.html para mejor mantenibilidad
========================================== */

:root {
    /* Color Principal (Deep Blue) */
    --premium-primary: #0D009E;
    --premium-primary-dark: #07004F;

    /* Acento (Bright Blue) */
    --premium-accent: #4263eb;
    --premium-accent-light: rgba(66, 99, 235, 0.1);

    /* Gradientes */
    --premium-gradient-primary: linear-gradient(135deg, #0D009E 0%, #07004F 100%);
    --premium-gradient-bg: linear-gradient(180deg, #ffffff 0%, #f8faff 50%, #f0f4ff 100%);

    /* Glassmorphism */
    --premium-glass: rgba(255, 255, 255, 0.95);
    --premium-backdrop-blur: 20px;

    /* Textos */
    --premium-text: #1a1a2e;
    --premium-text-light: #6c7a94;
    --premium-text-disabled: #9ca3af;

    /* Bordes y Sombras */
    --premium-border: rgba(13, 0, 158, 0.1);
    --premium-shadow-depth: 0 20px 60px rgba(7, 0, 79, 0.25);
    --premium-shadow-subtle: 0 4px 12px rgba(13, 0, 158, 0.08);
    --premium-shadow-card: 0 8px 32px rgba(7, 0, 79, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--premium-gradient-bg);
    color: var(--premium-text);
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* ==========================================
   HEADER - PREMIUM GLASSMORPHISM
========================================== */
.header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 255, 0.95) 100%);
    backdrop-filter: blur(var(--premium-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--premium-backdrop-blur));
    border-bottom: 1px solid var(--premium-border);
    box-shadow: 0 2px 12px rgba(7, 0, 79, 0.06);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Auth UI Glassmorphism Integration */
#bibliotecaHeaderAuth .auth-ui-container {
    display: flex;
    align-items: center;
}

#bibliotecaHeaderAuth .auth-ui-user-button {
    background: rgba(13, 0, 158, 0.05) !important;
    border: 1px solid var(--premium-border) !important;
    border-radius: 12px !important;
    padding: 0.5rem 0.875rem !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    cursor: pointer !important;
    color: var(--premium-primary) !important;
    font-weight: 600 !important;
}

#bibliotecaHeaderAuth .auth-ui-user-button:hover {
    background: rgba(13, 0, 158, 0.1) !important;
    border-color: var(--premium-accent) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 0, 158, 0.1);
}

#bibliotecaHeaderAuth .auth-ui-user-avatar {
    width: 32px !important;
    height: 32px !important;
    background: var(--premium-gradient-primary) !important;
    color: white !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(13, 0, 158, 0.2) !important;
}

#bibliotecaHeaderAuth .auth-ui-dropdown {
    background: white !important;
    border-radius: 16px !important;
    box-shadow: var(--premium-shadow-depth) !important;
    border: 1px solid var(--premium-border) !important;
    padding: 0.5rem !important;
    margin-top: 0.5rem !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    min-width: 220px !important;
}

#bibliotecaHeaderAuth .auth-ui-dropdown-item {
    border-radius: 10px !important;
    padding: 0.75rem 1rem !important;
    font-weight: 500 !important;
    color: var(--premium-text) !important;
    transition: all 0.2s !important;
    text-align: left;
    width: 100%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#bibliotecaHeaderAuth .auth-ui-dropdown-item svg {
    width: 18px;
    height: 18px;
}

#bibliotecaHeaderAuth .auth-ui-dropdown-item:hover {
    background: rgba(13, 0, 158, 0.05) !important;
    color: var(--premium-primary) !important;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: transform 0.2s;
}

.header-logo:hover {
    transform: translateY(-2px);
}

.header-logo img {
    height: 40px;
    width: auto;
}

.header-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--premium-gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================================
   MAIN CONTAINER
========================================== */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ==========================================
   HERO SECTION
========================================== */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 1rem;
}

.hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--premium-gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--premium-text-light);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--premium-gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 16px rgba(13, 0, 158, 0.2);
    text-decoration: none;
}

.hero-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(13, 0, 158, 0.3);
}

.hero-cta svg {
    width: 20px;
    height: 20px;
}

/* ==========================================
   FILTERS SECTION
========================================== */
.filters-section {
    background: var(--premium-glass);
    backdrop-filter: blur(var(--premium-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--premium-backdrop-blur));
    border: 1px solid var(--premium-border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--premium-shadow-card);
}

.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filters-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--premium-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filters-title svg {
    width: 24px;
    height: 24px;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: rgba(13, 0, 158, 0.05);
    padding: 0.25rem;
    border-radius: 10px;
}

.view-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--premium-text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

.view-btn.active {
    background: white;
    color: var(--premium-primary);
    box-shadow: 0 2px 8px rgba(13, 0, 158, 0.1);
}

.view-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--premium-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-label svg {
    width: 16px;
    height: 16px;
    color: var(--premium-accent);
}

.filter-select,
.search-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--premium-border);
    border-radius: 10px;
    background: white;
    color: var(--premium-text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.filter-select:focus,
.search-input:focus {
    outline: none;
    border-color: var(--premium-accent);
    box-shadow: 0 0 0 3px var(--premium-accent-light);
}

.filter-select:disabled {
    background: rgba(0, 0, 0, 0.05);
    cursor: not-allowed;
    opacity: 0.6;
}

.search-group {
    grid-column: 1 / -1;
}

.search-input {
    width: 100%;
    padding-left: 2.5rem;
}

.search-group {
    position: relative;
}

.search-group svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--premium-text-light);
    pointer-events: none;
}

/* Selected Tags Container */
.selected-tags-container {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--premium-border);
}

.selected-tags-container.has-tags {
    display: block;
}

.selected-tags-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--premium-text-light);
    margin-bottom: 0.5rem;
}

.selected-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--premium-accent-light);
    border: 1px solid var(--premium-accent);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--premium-accent);
    font-weight: 500;
}

.tag-chip-remove {
    background: none;
    border: none;
    color: var(--premium-accent);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.tag-chip-remove:hover {
    background: var(--premium-accent);
    color: white;
}

/* ==========================================
   RESULTS SECTION
========================================== */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--premium-primary);
}

/* ==========================================
   LIBRARY GRID
========================================== */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.library-grid.list-view {
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
}

@media (max-width: 1024px) {
    .library-grid.list-view {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   DOCUMENT CARDS
========================================== */
.doc-card {
    background: white;
    border: 1px solid var(--premium-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.doc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--premium-gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
}

.doc-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--premium-shadow-card);
    border-color: var(--premium-accent);
}

.doc-card:hover::before {
    transform: scaleX(1);
}

.doc-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.doc-icon,
.doc-icon-container {
    width: 48px;
    height: auto;
    min-height: 64px;
    /* Aumentado para dar aire al badge */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid var(--premium-border);
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Padding para que el badge y logo no toquen los bordes */
.doc-icon:has(.uni-badge-icon),
.doc-icon-container:has(.uni-badge-icon) {
    padding: 6px 2px;
}

/* Si no es un logo y tiene un svg dentro, mantener el fondo celeste */
.doc-icon:has(svg),
.doc-icon-container:has(svg) {
    background: var(--premium-accent-light);
    border: none;
    box-shadow: none;
    height: 48px;
    /* Altura fija para iconos genéricos */
}

.doc-header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Centrar respecto al icono */
    min-width: 0;
}

.doc-author-meta {
    font-size: 0.85rem;
    color: var(--premium-text-light);
    font-weight: 400;
    margin: 0;
    line-height: 1.2;
}

.doc-icon svg {
    width: 24px;
    height: 24px;
    color: var(--premium-accent);
}

.doc-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--premium-text);
    line-height: 1.4;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.doc-subject {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--premium-accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.uni-logo-icon {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 4px;
    /* Un poco menos de padding para mejor visibilidad */
}

.uni-badge,
.uni-badge-icon {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: rgba(13, 0, 158, 0.08);
    /* Azul suave */
    color: var(--premium-primary);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    margin-right: 0.4rem;
    vertical-align: middle;
    border: 1px solid rgba(13, 0, 158, 0.15);
}

.uni-badge-icon {
    background: var(--premium-primary);
    color: white;
    margin: 0 0 3px 0;
    width: 100%;
    text-align: center;
    font-size: 0.55rem;
    padding: 1px 2px;
    border: none;
}

.mobile-only {
    display: none !important;
}

.desktop-only {
    display: inline-block !important;
}

.doc-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--premium-text-light);
}

.doc-meta-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.doc-tags-wrapper {
    margin-bottom: 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.doc-card.expanded .doc-tags-wrapper {
    max-height: 200px;
}

.doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.doc-tag {
    padding: 0.25rem 0.75rem;
    background: var(--premium-accent-light);
    color: var(--premium-accent);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.doc-tag:hover {
    background: var(--premium-accent);
    color: white;
    border-color: var(--premium-accent);
}

.doc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.expand-btn {
    background: none;
    border: none;
    color: var(--premium-accent);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.expand-btn:hover {
    background: var(--premium-accent-light);
}

.expand-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s;
}

.doc-card.expanded .expand-btn svg {
    transform: rotate(180deg);
}

.doc-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Centrar icono y texto */
    gap: 0.5rem;
    font-size: 0.95rem;
    flex: 1;
}

.doc-btn svg {
    width: 18px;
    height: 18px;
}

.doc-btn.primary {
    background: var(--premium-gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(13, 0, 158, 0.2);
}

.doc-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 0, 158, 0.3);
}

.doc-btn.primary:disabled,
.doc-btn.primary.disabled,
.doc-btn.disabled {
    opacity: 1 !important;
    /* Force opacity for custom style */
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Estilo Premium Cooldown (Congelado) */
.doc-btn.cooldown-btn {
    background: rgba(100, 116, 139, 0.85) !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    /* Para que los números no salten */
}

.doc-btn.cooldown-btn svg {
    color: #ffffff !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.doc-btn.cooldown-btn:hover {
    background: rgba(100, 116, 139, 0.95) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================
   LIST VIEW SPECIFIC STYLES
========================================== */
.library-grid.list-view .doc-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.library-grid.list-view .doc-icon {
    width: 50px;
    height: auto;
    min-height: 60px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    background: #ffffff;
    border: 1px solid var(--premium-border);
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.library-grid.list-view .doc-icon svg {
    width: 22px;
    height: 22px;
}

.library-grid.list-view .doc-header {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0;
    min-width: 0;
    align-items: flex-start;
    text-align: left;
}

.library-grid.list-view .doc-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--premium-text);
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    text-align: left;
    width: 100%;
}

.library-grid.list-view .doc-author-meta {
    font-size: 0.8rem;
    color: var(--premium-text-light);
    font-weight: 400;
    margin: 0;
    line-height: 1.2;
}

.library-grid.list-view .doc-meta {
    display: none;
}

.library-grid.list-view .doc-header .doc-meta-item {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--premium-accent);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.15rem;
    text-align: left;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-grid.list-view .doc-meta-item {
    font-size: 0.875rem;
    color: var(--premium-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-grid.list-view .doc-meta-item svg {
    display: none;
}

.library-grid.list-view .doc-tags {
    display: none;
}

.library-grid.list-view .doc-tags-wrapper {
    display: none;
}

.library-grid.list-view .doc-footer {
    flex-shrink: 0;
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.library-grid.list-view .doc-btn {
    padding: 0.75rem;
    min-width: 44px;
    height: 44px;
    justify-content: center;
    border-radius: 10px;
}

.library-grid.list-view .doc-btn span {
    display: none;
}

.library-grid.list-view .doc-btn svg {
    margin: 0;
    width: 20px;
    height: 20px;
}

.library-grid.list-view .expand-btn {
    display: none;
}

/* Responsive adjustments for list view */
@media (max-width: 768px) {
    .library-grid.list-view .doc-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.75rem !important;
        padding: 0.75rem 1rem !important;
        min-height: 64px !important;
        height: auto !important;
        flex-wrap: nowrap !important;
    }

    .library-grid.list-view .doc-icon {
        width: 44px !important;
        min-height: 54px !important;
        padding: 4px 2px !important;
    }

    .library-grid.list-view .doc-icon .uni-badge-icon {
        font-size: 0.5rem !important;
        padding: 1px !important;
        border-radius: 3px !important;
    }

    /* Clases de utilidad responsiva restringidas */
    .library-grid.list-view .mobile-only {
        display: block !important;
    }

    .library-grid.list-view .desktop-only {
        display: none !important;
    }

    .library-grid.list-view .doc-icon svg {
        width: 20px !important;
        height: 20px !important;
    }

    .library-grid.list-view .doc-header-content {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.15rem !important;
        align-items: flex-start !important;
        justify-content: center !important;
        margin-bottom: 0 !important;
        min-width: 0 !important;
        text-align: left !important;
        align-self: center !important;
    }

    .library-grid.list-view .doc-author-meta {
        font-size: 0.65rem !important;
        color: var(--premium-text-light) !important;
        font-weight: 400 !important;
        opacity: 0.85 !important;
        margin: 0 !important;
        line-height: 1.2 !important;
    }

    .library-grid.list-view .doc-subject {
        font-size: 0.7rem !important;
        margin-bottom: 0 !important;
    }

    .library-grid.list-view .doc-title {
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        width: 100% !important;
        text-align: left !important;
        font-weight: 600 !important;
    }

    .library-grid.list-view .doc-author-meta {
        font-size: 0.65rem !important;
        color: var(--premium-text-light) !important;
        font-weight: 400 !important;
        opacity: 0.85 !important;
        margin: 0 !important;
        line-height: 1.2 !important;
    }

    .library-grid.list-view .doc-footer {
        flex-shrink: 0 !important;
        margin-left: auto !important;
        display: flex !important;
        gap: 0 !important;
        align-items: center !important;
        justify-content: flex-end !important;
        align-self: center !important;
        padding: 0 !important;
        border: none !important;
        margin-top: 0 !important;
    }

    .library-grid.list-view .doc-btn {
        min-width: 36px !important;
        max-width: 36px !important;
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        margin: 0 !important;
    }

    .library-grid.list-view .doc-btn span,
    .library-grid.list-view .doc-btn .countdown-target {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        opacity: 0 !important;
        position: absolute !important;
    }

    .library-grid.list-view .doc-btn svg {
        width: 18px !important;
        height: 18px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    .library-grid.list-view .expand-btn {
        display: none !important;
    }
}

/* ==========================================
   EMPTY STATE
========================================== */
.empty-state {
    display: none;
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state.active {
    display: block;
}

.empty-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    opacity: 0.3;
}

.empty-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--premium-text);
    margin-bottom: 0.5rem;
}

.empty-text {
    color: var(--premium-text-light);
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Estilos de modal antiguos eliminados para centralizar en el bloque Premium al final del archivo */

/* Bloque de modal genérico eliminado para evitar conflictos con el diseño Premium */

/* Bloque de estructura de modal eliminado */

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background: var(--premium-gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(13, 0, 158, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 0, 158, 0.3);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--premium-text);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* No Credits Modal Specific */
.no-credits-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    display: block;
}

.no-credits-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--premium-primary);
    text-align: center;
    margin-bottom: 1rem;
}

.no-credits-message {
    text-align: center;
    color: var(--premium-text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.credit-display {
    text-align: center;
    padding: 1rem;
    background: var(--premium-accent-light);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.credit-label {
    font-size: 0.9rem;
    color: var(--premium-text-light);
    margin-bottom: 0.5rem;
}

.credit-amount {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--premium-accent);
}

.price-options {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.price-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--premium-border);
    border-radius: 10px;
    transition: all 0.2s;
}

.price-option:hover {
    background: var(--premium-accent-light);
    border-color: var(--premium-accent);
}

.price-option.highlight {
    background: var(--premium-accent-light);
    border-color: var(--premium-accent);
    position: relative;
}

.option-credits {
    font-weight: 600;
    color: var(--premium-text);
}

.option-price {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--premium-accent);
}

.option-badge {
    position: absolute;
    top: -8px;
    right: 1rem;
    background: var(--premium-accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Contribution Modal Specific */
.contribution-modal-text {
    color: var(--premium-text-light);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.contribution-options {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.contribution-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border: 2px solid var(--premium-border);
    border-radius: 12px;
    background: white;
    color: var(--premium-text);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.contribution-btn:hover {
    border-color: var(--premium-accent);
    background: var(--premium-accent-light);
    transform: translateY(-2px);
}

.contribution-btn svg {
    width: 20px;
    height: 20px;
}

.btn-email:hover {
    border-color: #4263eb;
    background: rgba(66, 99, 235, 0.1);
}

.btn-whatsapp:hover {
    border-color: #25D366;
    background: rgba(37, 211, 102, 0.1);
}

.btn-telegram:hover {
    border-color: #0088cc;
    background: rgba(0, 136, 204, 0.1);
}

.contribution-modal-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--premium-text-light);
    font-style: italic;
}

/* History Table */
.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: var(--premium-accent-light);
    color: var(--premium-accent);
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--premium-border);
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table .empty-row,
.history-table .loading-row {
    text-align: center;
    color: var(--premium-text-light);
    font-style: italic;
}

.credit-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--premium-accent-light);
    color: var(--premium-accent);
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ==========================================
   FOOTER
========================================== */
footer {
    margin-top: auto;
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--premium-gradient-primary);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    width: 100%;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
}

footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

footer .heart {
    color: #ef4444;
    display: inline-block;
    animation: heartBeat 1.5s ease-in-out infinite;
}

.footer-logo {
    margin-bottom: 1.5rem;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.footer-logo:hover {
    opacity: 1;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    opacity: 0.8;
    transition: all 0.2s;
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
}

.footer-link:hover {
    opacity: 1;
    transform: translateY(-2px);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #4263eb;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.footer-link:hover::after {
    width: 100%;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
}

.social-btn:hover {
    background: white;
    color: var(--premium-primary);
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

@keyframes heartBeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ==========================================
   RESPONSIVE
========================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .library-grid {
        grid-template-columns: 1fr;
    }

    .filters-header,
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .view-toggle {
        width: 100%;
        justify-content: center;
    }

    /* Estilos responsivos de modal antiguos eliminados */
}

/* ==========================================
   FOOTER - PREMIUM BLUE REDESIGN
   ========================================== */
footer {
    margin-top: auto;
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--premium-gradient-primary);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    width: 100%;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
}

footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

footer .heart {
    color: #ef4444;
    display: inline-block;
    animation: heartBeat 1.5s ease-in-out infinite;
}

.footer-logo {
    margin-bottom: 1.5rem;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.footer-logo:hover {
    opacity: 1;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    opacity: 0.8;
    transition: all 0.2s;
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
}

.footer-link:hover {
    opacity: 1;
    transform: translateY(-2px);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #4263eb;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.footer-link:hover::after {
    width: 100%;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
}

.social-btn:hover {
    background: white;
    color: var(--premium-primary);
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

@keyframes heartBeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ==========================================
   CONTRIBUTION MODAL - PREMIUM
   ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 0, 79, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    /* Espaciado de seguridad */
    overflow-y: auto;
    /* Permitir scroll si el contenido es alto */
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.contribution-modal-card {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--premium-shadow-depth);
    border: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: calc(100vh - 60px);
    padding: 0 !important;
    /* FORZAR: No padding para que el header toque los bordes */
}

.modal-overlay.active .contribution-modal-card {
    transform: translateY(0) scale(1);
}

.contribution-modal-header {
    background: var(--premium-gradient-primary);
    padding: 1.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    border: none;
    /* Asegurar que no hay bordes aquí */
}

.contribution-modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    z-index: 1;
}

.contribution-icon {
    width: 36px;
    height: 36px;
    color: #ffffff;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.3));
    flex-shrink: 0;
}

.contribution-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1;
    /* Centrado vertical más preciso */
}

.contribution-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    /* Más circular */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    position: relative;
    z-index: 1;
    padding: 0;
    margin: 0;
    /* Limpiar margen */
}

.contribution-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg) scale(1.1);
    color: white;
}

.contribution-modal-body {
    padding: 2.25rem 2rem;
    overflow-y: auto;
    /* Permitir scroll solo en el cuerpo si es necesario */
}

.contribution-modal-text {
    font-size: 1rem;
    color: var(--premium-text-light);
    line-height: 1.6;
    margin-bottom: 2.25rem;
    text-align: center;
}

.contribution-options {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.contribution-btn {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-email {
    background: var(--premium-gradient-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(13, 0, 158, 0.25);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.25);
}

.btn-telegram {
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(42, 171, 238, 0.25);
}

.btn-facebook {
    background: linear-gradient(135deg, #1877F2 0%, #0C4D9A 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(24, 119, 242, 0.25);
}

.btn-instagram {
    background: linear-gradient(135deg, #833AB4 0%, #FD1D1D 50%, #FCB045 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(214, 41, 118, 0.25);
}

.contribution-btn:hover {
    transform: translateY(-4px);
}

.contribution-modal-footer {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--premium-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-style: italic;
    opacity: 0.8;
}

@media (max-width: 480px) {
    .contribution-modal-header {
        padding: 1.25rem;
    }

    .contribution-modal-title {
        font-size: 1.1rem;
    }

    .contribution-modal-body {
        padding: 1.5rem;
    }

    .contribution-modal-text {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .contribution-btn {
        padding: 0.875rem 1rem;
        font-size: 0.85rem;
        border-radius: 12px;
    }
}