/* CSS para Galería Moderna - TodoJuegos */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;700&display=swap');

/* --- Layout General --- */
.tj-gallery-page {
    background-color: #0f172a;
    /* Slate 900 */
    color: #f8fafc;
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    padding-bottom: 60px;
}

.tj-gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Cabecera Hero --- */
/* --- Cabecera Hero (Rediseño) --- */
.tj-gallery-hero {
    text-align: center;
    padding: 60px 20px;
    background: #0f172a;
    /* Slate 900 base */
    margin-bottom: 40px;
    border-radius: 0 0 24px 24px;
    /* Solo abajo para integrarse con header si fuera full width */
    position: relative;
    overflow: hidden;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px -10px rgba(0, 0, 0, 0.5);
}

.tj-gallery-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.5;
    pointer-events: none;
}

.tj-gallery-hero h1 {
    font-family: 'Outfit', sans-serif;
    /* Orbitron alternative match */
    font-size: 3rem;
    font-weight: 700;
    margin: 0 0 16px 0;
    letter-spacing: -0.02em;
    position: relative;
    color: #fff;
    text-transform: uppercase;
}

.tj-gallery-hero h1 span.highlight {
    color: #38bdf8;
    /* Accent Portal Colors match */
}

.tj-gallery-hero p {
    font-size: 1.15rem;
    color: #94a3b8;
    /* text-muted */
    max-width: 650px;
    margin: 0 auto 30px auto;
    position: relative;
    line-height: 1.6;
}

/* --- Search Bar Container --- */
.tj-search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

/* Glow effect behind search */
.tj-search-glow {
    position: absolute;
    inset: -4px;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    border-radius: 12px;
    filter: blur(8px);
    opacity: 0.25;
    transition: opacity 0.5s ease;
}

.tj-search-container:focus-within .tj-search-glow {
    opacity: 0.6;
}

.tj-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #1e293b;
    /* Surface */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.tj-search-icon {
    padding-left: 16px;
    color: #94a3b8;
    display: flex;
    align-items: center;
}

.tj-search-input {
    flex: 1;
    background: transparent !important;
    border: none;
    padding: 16px;
    font-size: 1.1rem;
    color: #fff !important;
    font-family: 'Outfit', sans-serif;
    outline: none !important;
    box-shadow: none !important;
    -webkit-text-fill-color: #fff !important;
}

.tj-search-input::placeholder {
    color: #64748b;
    opacity: 1;
}

/* Fix for Chrome autofill white background */
.tj-search-input:-webkit-autofill,
.tj-search-input:-webkit-autofill:hover,
.tj-search-input:-webkit-autofill:focus,
.tj-search-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1e293b inset !important;
    -webkit-text-fill-color: white !important;
}

.tj-search-btn {
    margin: 6px;
    padding: 10px 24px;
    background: #38bdf8;
    /* Accent */
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease;
    font-family: 'Outfit', sans-serif;
}

.tj-search-btn:hover {
    background: #0ea5e9;
}

/* --- Quick Filters (Visual only for now) --- */
.tj-hero-tags {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tj-hero-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tj-hero-tag:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #38bdf8;
    color: #fff;
}

/* --- List View: Grid de Juegos --- */
.tj-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.tj-game-card {
    background: #1e293b;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tj-game-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.3);
}

.tj-game-card__image {
    width: 100%;
    aspect-ratio: 3/4;
    /* Formato carátula */
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.tj-game-card:hover .tj-game-card__image {
    transform: scale(1.05);
}

.tj-game-card__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95), transparent);
    padding: 20px;
    padding-top: 60px;
    text-align: left;
}

.tj-game-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.tj-game-card__count {
    font-size: 0.85rem;
    color: #38bdf8;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Detail View: Grid de Imágenes (Masonry-like) --- */
.tj-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.tj-photo-item {
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: zoom-in;
    aspect-ratio: 16/9;
    /* Unificar por ahora, podría ser dinámico */
    background: #1e293b;
}

.tj-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tj-photo-item:hover img {
    transform: scale(1.03);
}

/* --- Navegación / Breadcrumbs --- */
.tj-breadcrumb {
    margin-bottom: 30px;
    font-size: 1rem;
    color: #94a3b8;
}

.tj-breadcrumb a {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 600;
}

.tj-breadcrumb a:hover {
    text-decoration: underline;
}

.tj-breadcrumb span {
    margin: 0 10px;
    color: #64748b;
}

/* --- Paginación --- */
.tj-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 50px;
}

.tj-pagination a,
.tj-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #1e293b;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.tj-pagination a i,
.tj-pagination span i {
    width: 20px;
    height: 20px;
}

.tj-pagination a:hover {
    background: #334155;
    border-color: #38bdf8;
}

.tj-pagination .active {
    background: #38bdf8;
    color: #0f172a;
    border-color: #38bdf8;
}

/* --- Lightbox Styles --- */
.tj-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tj-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.tj-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

.tj-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    /* Allow clicks to pass through to backdrop for closing */
}

/* The Framed Card for the Image */
.tj-lightbox-image-wrapper {
    background-color: #1e293b;
    /* Slate 800 */
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    pointer-events: auto;
    /* Catch clicks */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tj-lightbox-counter {
    position: absolute;
    top: -40px;
    left: 0;
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
}

#tj-lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    background: #000;
}

#tj-lightbox-caption {
    margin-top: 12px;
    font-size: 1rem;
    color: #cbd5e1;
    text-align: center;
    font-weight: 500;
}

.tj-lightbox-close,
.tj-lightbox-prev,
.tj-lightbox-next {
    position: absolute;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 10px;
    transition: all 0.2s;
    z-index: 10;
    pointer-events: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Botón cerrar arriba a la derecha del todo */
.tj-lightbox-close {
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tj-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #38bdf8;
    transform: rotate(90deg);
}

/* Flechas laterales flotantes */
.tj-lightbox-prev {
    left: 20px;
}

.tj-lightbox-next {
    right: 20px;
}

.tj-lightbox-prev i,
.tj-lightbox-next i,
.tj-lightbox-close i {
    width: 32px;
    height: 32px;
}

.tj-lightbox-prev:hover,
.tj-lightbox-next:hover {
    color: #38bdf8;
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    .tj-gallery-hero h1 {
        font-size: 2.5rem;
    }

    .tj-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 col en móvil */
        gap: 15px;
    }

    .tj-photos-grid {
        grid-template-columns: 1fr;
    }

    .tj-lightbox-prev {
        left: 5px;
    }

    .tj-lightbox-next {
        right: 5px;
    }

    .tj-lightbox-image-wrapper {
        padding: 5px;
    }
}