/* Estilos base y utilidades personalizadas */
:root {
    --glass-bg: rgba(18, 20, 28, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 215, 0, 0.5);
    --neon-glow: 0 0 25px rgba(255, 215, 0, 0.2);
    --nav-offset: 80px;
}

body {
    background-color: #050609;
    color: #E2E8F0;
    overflow-x: hidden;
}

section[id],
#posters,
#main {
    scroll-margin-top: var(--nav-offset);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #050609;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #FFD700;
}

/* Glassmorphism Classes */
.glass-panel {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 0 20px rgba(255, 215, 0, 0.1);
    transform: translateY(-2px);
}

.glass-header {
    background: rgba(5, 6, 9, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

/* Text Gradients */
.text-gradient {
    background: linear-gradient(135deg, #FFD700 0%, #FDB931 50%, #FFFFE0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
}

/* Navegación premium */
#navbar .nav-link {
    position: relative;
    padding-bottom: 4px;
}

#navbar .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.25), #FFD700, rgba(255, 215, 0, 0.25));
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

#navbar .nav-link:hover::after,
#navbar .nav-link.is-active::after,
#navbar .nav-link[aria-current="page"]::after {
    transform: scaleX(1);
    opacity: 1;
}

#navbar .nav-link.is-active,
#navbar .nav-link[aria-current="page"] {
    color: #FFD700;
}

#mobile-menu .nav-link {
    padding-bottom: 0;
}

#mobile-menu .nav-link::after {
    display: none;
}

#mobile-menu .nav-link.is-active,
#mobile-menu .nav-link[aria-current="page"] {
    color: #FFD700;
}

/* Privacidad */
.privacy-summary {
    list-style: none;
}

.privacy-summary::-webkit-details-marker {
    display: none;
}

#privacy-details[open] .privacy-summary i {
    transform: rotate(180deg);
}

/* Animaciones al hacer scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Carrusel Modal */
.carousel-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.carousel-modal.show {
    display: flex;
    opacity: 1;
}

.carousel-img {
    max-width: 90%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease, opacity 0.3s ease;
    background: rgba(0, 0, 0, 0.3);
}

.carousel-modal.show .carousel-img {
    transform: scale(1);
}

.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 1rem;
    cursor: pointer;
    font-size: 2rem;
    border-radius: 50%;
    transition: all 0.2s;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-nav-btn:hover {
    background: #FFD700;
    color: black;
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #FFD700;
}

/* Contador de posición */
.carousel-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10;
}

.carousel-counter span {
    color: #FFD700;
    font-weight: 700;
}

/* Transición suave de imágenes */
.carousel-img {
    transition: opacity 0.3s ease;
}


/* Ajustes de coherencia visual para publicaciones */
#publicaciones .filter-button,
#publicaciones .button,
#publicaciones .button--secondary,
#publicaciones .form__input,
#publicaciones #results-count,
#publicaciones .keywords-details summary,
#publicaciones .chart-details summary {
    font-family: 'Inter', sans-serif;
}

/* ==========================
   SEARCH INPUT PREMIUM STYLES
   ========================== */

#publicaciones .form__input[type="search"] {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 215, 0, 0.15);
    border-radius: 12px;
    padding: 0.85rem 1.25rem 0.85rem 3rem;
    color: #E2E8F0;
    font-size: 0.9375rem;
    font-weight: 400;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23FFD700" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg>');
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 18px;
}

#publicaciones .form__input[type="search"]::placeholder {
    color: rgba(226, 232, 240, 0.4);
    font-weight: 400;
}

#publicaciones .form__input[type="search"]:hover {
    border-color: rgba(255, 215, 0, 0.3);
    background: rgba(255, 255, 255, 0.06);
}

#publicaciones .form__input[type="search"]:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 4px 12px rgba(255, 215, 0, 0.15);
}

#publicaciones .form__input[type="search"]:focus {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23FFD700" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg>');
}

/* ========================================
   FILTER TOGGLE BUTTONS
   ======================================== */

.filter-toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1.15rem;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 215, 0, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    whitespace: nowrap;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    color: #E2E8F0;
    font-family: 'Inter', sans-serif;
}

.filter-toggle-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transition: left 0.5s ease;
}

.filter-toggle-button:hover::before {
    left: 100%;
}

.filter-toggle-button:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 215, 0, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
        0 0 20px rgba(255, 215, 0, 0.1);
}

.filter-toggle-button.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 25px rgba(255, 215, 0, 0.15);
}

.filter-toggle-button__count {
    font-size: 0.75rem;
    color: #FFD700;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    background: rgba(255, 215, 0, 0.12);
    border-radius: 6px;
    min-width: 1.5rem;
    text-align: center;
    box-shadow: inset 0 1px 2px rgba(255, 215, 0, 0.2);
}

.filter-toggle-button__icon {
    font-size: 0.7rem;
    color: #FFD700;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-toggle-button.active .filter-toggle-button__icon {
    transform: rotate(180deg);
}

/* ===================================
   CHIPS AREAS (EXPANDABLE)
   =================================== */

.chips-area {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease,
        margin-top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chips-area.expanded {
    max-height: 800px;
    opacity: 1;
    margin-top: 1rem;
}

.chips-area__content {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 215, 0, 0.1);
    border-radius: 12px;
}

.chips-area__title {
    color: #FFD700;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

.chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* ===================================
   SELECTABLE CHIPS
   =================================== */

.chip-selectable {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #E2E8F0;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chipFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.chip-selectable:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chip-selectable.selected {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.1));
    border-color: rgba(255, 215, 0, 0.5);
    color: #FFD700;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.chip-selectable.selected:hover {
    border-color: rgba(255, 215, 0, 0.7);
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.3);
}

/* ===================================
   ACTIVE FILTERS CONTAINER
   =================================== */

.active-filters-container {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease,
        margin-top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.active-filters-container.has-chips {
    max-height: 500px;
    opacity: 1;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 215, 0, 0.1);
}

.active-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.1));
    border: 1.5px solid rgba(255, 215, 0, 0.4);
    border-radius: 8px;
    color: #FFD700;
    font-size: 0.8125rem;
    font-weight: 600;
    animation: chipFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.active-filter-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    color: #FFD700;
    font-size: 10px;
    padding: 0;
}

.active-filter-chip__remove:hover {
    background: rgba(255, 215, 0, 0.35);
    transform: scale(1.1);
}

@keyframes chipFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chips-grid {
        gap: 0.5rem;
    }

    .chip-selectable {
        font-size: 0.8125rem;
        padding: 0.5rem 0.85rem;
    }
}

/* =======================================
   INFINITE SCROLL - SKELETON LOADER
   ======================================= */

.skeleton-loader {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 20px;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skeleton-loader:not(.hidden) {
    opacity: 1;
}

.skeleton-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    min-height: 300px;
}

.skeleton-badge,
.skeleton-title,
.skeleton-text,
.skeleton-keywords {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 25%,
            rgba(255, 215, 0, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 2s infinite;
    border-radius: 6px;
}

.skeleton-badge {
    width: 60px;
    height: 24px;
    margin-bottom: 1rem;
}

.skeleton-title {
    width: 100%;
    height: 24px;
    margin-bottom: 1rem;
}

.skeleton-text {
    width: 100%;
    height: 16px;
    margin-bottom: 0.75rem;
}

.skeleton-text.short {
    width: 70%;
}

.skeleton-keywords {
    width: 80%;
    height: 22px;
    margin-top: 1rem;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* =======================================
   END OF RESULTS INDICATOR
   ======================================= */

.end-of-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
    color: #94A3B8;
    font-size: 0.95rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.end-of-results:not(.hidden) {
    opacity: 1;
}

.end-of-results i {
    font-size: 2rem;
    color: #FFD700;
    opacity: 0.6;
}

/* =======================================
   FADE-IN ANIMATION FOR NEW CARDS
   ======================================= */

.publication-item.fade-in-new {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure cards that are not fading in have full opacity */
.publication-item:not(.fade-in-new) {
    opacity: 1;
}

/* ========================================
   Load More Button (On-Demand)
   ======================================== */
.load-more-button {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 1rem;
    margin-top: 2rem;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;

    /* Glassmorphism */
    background: rgba(255, 215, 0, 0.08);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 9999px;

    /* Typography */
    color: #FFD700;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: none;

    /* Cursor */
    cursor: pointer;

    /* Transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadow */
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 0 20px rgba(255, 215, 0, 0.15);
}

.load-more-btn i {
    font-size: 1.125rem;
    transition: transform 0.3s ease;
}

.load-more-btn:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.15),
        0 4px 6px -2px rgba(0, 0, 0, 0.08),
        0 0 30px rgba(255, 215, 0, 0.3);
}

.load-more-btn:hover i {
    transform: translateY(4px);
    animation: bounce-arrow 0.6s ease-in-out infinite;
}

.load-more-btn:active {
    transform: translateY(0);
}

@keyframes bounce-arrow {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(6px);
    }
}