/* ================================================================
   Shipo — Pestaña "Juegos" (portal GameMonetize)
   Mantiene la paleta y el lenguaje visual existentes de Shipo.
   ================================================================ */

#juegos_page {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background: #0d0f14;
    overflow: hidden;
}

.juegos_root {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #0d0f14;
    color: #c8d6e5;
    overflow: hidden;
}

/* ------------------------------ Catálogo ------------------------------ */

.juegos_catalog {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.juegos_header {
    flex-shrink: 0;
    padding: 12px 16px 6px;
    border-bottom: 1px solid #1e2330;
    background: #13161d;
}

.juegos_header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #ffffff;
}

.juegos_header h2 i {
    color: #4db8e8;
    margin-right: 6px;
}

.juegos_sub {
    font-size: 0.78rem;
    color: rgba(200, 214, 229, 0.55);
}

.juegos_toolbar {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #13161d;
    border-bottom: 1px solid #1e2330;
}

/* Búsqueda */
.juegos_search {
    position: relative;
    flex: 1 1 220px;
    min-width: 180px;
}

.juegos_search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(200, 214, 229, 0.45);
    font-size: 0.9rem;
}

.juegos_search input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px 9px 32px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #c8d6e5;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.juegos_search input::placeholder {
    color: rgba(200, 214, 229, 0.36);
}

.juegos_search input:focus {
    border-color: rgba(0, 100, 160, 0.65);
    box-shadow: 0 0 0 2px rgba(0, 100, 160, 0.2);
}

/* Filtros */
.juegos_filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.juegos_filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: #c8d6e5;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.juegos_filter:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
}

.juegos_filter.active {
    background: rgb(0, 96, 138);
    border-color: rgb(0, 96, 138);
    color: #ffffff;
}

.juegos_filter_count {
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 1px 7px;
    color: rgba(200, 214, 229, 0.8);
}

.juegos_filter.active .juegos_filter_count {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

/* Toggle para filtros (solo modo responsivo) */
.juegos_filters_toggle {
    display: none;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #c8d6e5;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.juegos_filters_toggle > i:first-child {
    color: #4db8e8;
    font-size: 0.95rem;
}

.juegos_filters_toggle:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(77, 184, 232, 0.45);
    color: #ffffff;
}

.juegos_filters_toggle:focus-visible {
    outline: none;
    border-color: rgba(77, 184, 232, 0.55);
    box-shadow: 0 0 0 2px rgba(0, 100, 160, 0.2);
}

.juegos_filters_toggle .juegos_filters_toggle_caret {
    margin-left: auto;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #4db8e8;
    font-size: 0.7rem;
    line-height: 1;
    font-style: normal;
    padding: 0;
    transition: transform 0.2s ease, background-color 0.15s;
}

.juegos_filters_toggle .juegos_filters_toggle_caret::before {
    line-height: 1;
    transform: translateY(-0.0625em);
}

.juegos_filters_toggle.open .juegos_filters_toggle_caret {
    transform: rotate(180deg);
    background: rgba(77, 184, 232, 0.18);
}

/* Contador de resultados */
.juegos_meta {
    flex-shrink: 0;
    padding: 6px 16px;
    font-size: 0.78rem;
    color: rgba(200, 214, 229, 0.55);
    background: #13161d;
    border-bottom: 1px solid #1e2330;
}

.juegos_meta:empty {
    display: none;
}

/* Estados (loading / error / vacío) */
.juegos_status {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    color: rgba(200, 214, 229, 0.65);
    overflow-y: auto;
}

.juegos_status:empty {
    display: none;
}

.juegos_status i {
    font-size: 2rem;
    color: rgba(200, 214, 229, 0.35);
}

.juegos_status p {
    margin: 0;
    font-size: 0.92rem;
    max-width: 420px;
}

.juegos_spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, 0.14);
    border-top-color: #4db8e8;
    border-radius: 50%;
    animation: juegosSpin 0.8s linear infinite;
}

@keyframes juegosSpin {
    to { transform: rotate(360deg); }
}

.juegos_retry {
    padding: 8px 16px;
    background: rgb(0, 96, 138);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background-color 0.15s;
}

.juegos_retry:hover {
    background: rgb(0, 120, 170);
}

/* Cuadrícula de tarjetas */
.juegos_grid {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 22px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    grid-auto-rows: max-content;
    gap: 12px;
    scrollbar-width: thin;
}

.juegos_card {
    display: flex;
    flex-direction: column;
    background: #13161d;
    border: 1px solid #1e2330;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.juegos_card:hover,
.juegos_card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(77, 184, 232, 0.55);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    outline: none;
}

.juegos_card_img {
    position: relative;
    width: 100%;
    padding-top: 75%; /* relación 4:3 reservada siempre (3/4 = 75%) */
    background: #0b0e13;
    overflow: hidden;
}

.juegos_card_img img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.juegos_card_img.noimg {
    color: rgba(200, 214, 229, 0.35);
}

.juegos_card_img.noimg::before {
    content: "\f11b"; /* fa-gamepad */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.8rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.juegos_card_body {
    padding: 9px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
}

.juegos_card_title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.juegos_card_cat {
    font-size: 0.74rem;
    color: #4db8e8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.juegos_card_tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.juegos_tag {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(200, 214, 229, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.juegos_badge_mp {
    align-self: flex-start;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 150, 90, 0.22);
    color: #48e6a0;
}

.juegos_sentinel {
    flex-shrink: 0;
    height: 1px;
}

/* ------------------------------ Vista del juego ------------------------------ */

.juegos_detail {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #0d0f14;
}

.juegos_detail_top {
    flex-shrink: 0;
    height: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    background: #13161d;
    border-bottom: 1px solid #1e2330;
}

.juegos_back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #c8d6e5;
    font-size: 0.86rem;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.juegos_back:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.juegos_detail_meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.juegos_detail_title {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.juegos_detail_cat {
    font-size: 0.74rem;
    color: #4db8e8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.juegos_detail_ext {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    background: rgb(0, 96, 138);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.86rem;
    text-decoration: none;
    transition: background-color 0.15s;
    white-space: nowrap;
}

.juegos_detail_ext:hover {
    background: rgb(0, 120, 170);
    color: #ffffff;
}

.juegos_detail_body {
    position: relative;
    flex: 1;
    background: #000;
}

.juegos_detail_body iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

.juegos_detail_fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background: rgba(13, 15, 20, 0.96);
    color: rgba(200, 214, 229, 0.8);
    z-index: 2;
}

.juegos_detail_fallback a {
    padding: 9px 16px;
    background: rgb(0, 96, 138);
    border-radius: 8px;
    color: #ffffff;
    text-decoration: none;
}

.juegos_detail_fallback a:hover {
    background: rgb(0, 120, 170);
}

/* ------------------------------ Responsive ------------------------------ */

@media (max-width: 863px) {
    .juegos_toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .juegos_search {
        flex: 1 1 auto;
        min-width: 0;
    }
    .juegos_filters_toggle {
        display: flex;
    }
    .juegos_filters {
        display: none;
    }
    .juegos_filters.open {
        display: flex;
    }
    .juegos_grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
        padding: 10px 10px 18px;
    }
}

@media (max-width: 640px) {
    #juegos_page {
        top: 36px;
    }
    .juegos_header h2 {
        font-size: 1rem;
    }
    .juegos_grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px 8px 16px;
    }
    .juegos_card_title {
        font-size: 0.8rem;
    }
    .juegos_detail_ext {
        padding: 8px 10px;
    }
}

/* ------------------------------ Tema claro ------------------------------ */

html[data-theme="light"] #juegos_page,
html[data-theme="light"] .juegos_root {
    background: #f5f7fa;
    color: #1a2d42;
}

html[data-theme="light"] .juegos_header,
html[data-theme="light"] .juegos_toolbar,
html[data-theme="light"] .juegos_meta {
    background: #ffffff;
    border-bottom-color: #d0d8e4;
}

html[data-theme="light"] .juegos_header h2 {
    color: #1a2d42;
}

html[data-theme="light"] .juegos_header h2 i {
    color: #1565c0;
}

html[data-theme="light"] .juegos_sub {
    color: rgba(26, 45, 66, 0.55);
}

html[data-theme="light"] .juegos_search i {
    color: rgba(26, 45, 66, 0.45);
}

html[data-theme="light"] .juegos_search input {
    background: #ffffff;
    border-color: #d0d8e4;
    color: #1a2d42;
}

html[data-theme="light"] .juegos_search input::placeholder {
    color: rgba(26, 45, 66, 0.36);
}

html[data-theme="light"] .juegos_search input:focus {
    border-color: #1565c0;
    box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.2);
}

html[data-theme="light"] .juegos_filter {
    background: #ffffff;
    border-color: #d0d8e4;
    color: #1a2d42;
}

html[data-theme="light"] .juegos_filter:hover {
    background: #eef2f7;
    color: #0d1b2a;
}

html[data-theme="light"] .juegos_filter.active {
    background: #1565c0;
    border-color: #1565c0;
    color: #ffffff;
}

html[data-theme="light"] .juegos_filter_count {
    background: rgba(26, 45, 66, 0.08);
    color: rgba(26, 45, 66, 0.8);
}

html[data-theme="light"] .juegos_filter.active .juegos_filter_count {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

html[data-theme="light"] .juegos_filters_toggle {
    background: #ffffff;
    border-color: #d0d8e4;
    color: #1a2d42;
}

html[data-theme="light"] .juegos_filters_toggle:hover {
    background: #eef2f7;
    border-color: #1565c0;
    color: #0d1b2a;
}

html[data-theme="light"] .juegos_filters_toggle .juegos_filters_toggle_caret {
    background: rgba(26, 45, 66, 0.08);
    color: #1565c0;
}

html[data-theme="light"] .juegos_status {
    color: rgba(26, 45, 66, 0.65);
}

html[data-theme="light"] .juegos_status i {
    color: rgba(26, 45, 66, 0.35);
}

html[data-theme="light"] .juegos_spinner {
    border-color: rgba(26, 45, 66, 0.14);
    border-top-color: #1565c0;
}

html[data-theme="light"] .juegos_retry {
    background: #1565c0;
}

html[data-theme="light"] .juegos_retry:hover {
    background: #0d47a1;
}

html[data-theme="light"] .juegos_card {
    background: #ffffff;
    border-color: #d0d8e4;
}

html[data-theme="light"] .juegos_card:hover,
html[data-theme="light"] .juegos_card:focus-visible {
    border-color: #1565c0;
    box-shadow: 0 6px 18px rgba(26, 45, 66, 0.14);
}

html[data-theme="light"] .juegos_card_img {
    background: #e8ecf0;
}

html[data-theme="light"] .juegos_card_img.noimg {
    color: rgba(26, 45, 66, 0.35);
}

html[data-theme="light"] .juegos_card_title {
    color: #1a2d42;
}

html[data-theme="light"] .juegos_card_cat {
    color: #1565c0;
}

html[data-theme="light"] .juegos_tag {
    background: rgba(26, 45, 66, 0.07);
    color: rgba(26, 45, 66, 0.75);
}

html[data-theme="light"] .juegos_detail_top {
    background: #ffffff;
    border-bottom-color: #d0d8e4;
}

html[data-theme="light"] .juegos_back {
    background: rgba(26, 45, 66, 0.06);
    border-color: #d0d8e4;
    color: #1a2d42;
}

html[data-theme="light"] .juegos_back:hover {
    background: rgba(26, 45, 66, 0.12);
    color: #0d1b2a;
}

html[data-theme="light"] .juegos_detail_title {
    color: #1a2d42;
}

html[data-theme="light"] .juegos_detail_cat {
    color: #1565c0;
}

html[data-theme="light"] .juegos_detail_ext {
    background: #1565c0;
}

html[data-theme="light"] .juegos_detail_ext:hover {
    background: #0d47a1;
}

html[data-theme="light"] .juegos_detail_fallback {
    background: rgba(245, 247, 250, 0.96);
    color: rgba(26, 45, 66, 0.8);
}

html[data-theme="light"] .juegos_detail_fallback a {
    background: #1565c0;
}

html[data-theme="light"] .juegos_detail_fallback a:hover {
    background: #0d47a1;
}
