/* ===============================
   JUEGOS.CSS - VERSIÓN MEJORADA
   MÍNIMO 2 COLUMNAS SIEMPRE
   =============================== */

/* ===== GRID PRINCIPAL - SIEMPRE 2 COLUMNAS MÍNIMO ===== */
.game-grid,
#favoriteGamesGrid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
}

/* 3 columnas en tablets */
@media (min-width: 600px) {
    .game-grid,
    #favoriteGamesGrid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 4 columnas en desktop */
@media (min-width: 900px) {
    .game-grid,
    #favoriteGamesGrid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Pantallas muy pequeñas: reducir gap y padding pero MANTENER 2 columnas */
@media (max-width: 360px) {
    .game-grid,
    #favoriteGamesGrid {
        gap: 8px;
        padding: 8px;
    }
}

/* ===== TARJETA DE JUEGO ===== */
.game-card {
    background-color: var(--card-bg, #1e1e2a);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card:active {
    transform: scale(0.98);
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

/* Contenedor de imagen con posición relativa para badges */
.game-card .image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
}

.game-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

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

/* Badge de visitas */
.views-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

.views-badge i {
    font-size: 0.7rem;
}

/* Título del juego */
.game-card .game-title {
    padding: 10px 8px 4px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary, #6ea8fe);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Traductores en tarjeta */
.game-card .game-translators {
    padding: 0 8px 10px;
    font-size: 0.7rem;
    color: var(--text-muted, #aaa);
}

.game-card .game-translators small {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== MODAL DE BÚSQUEDA - RESULTADOS ===== */
#gamesSearchModal .container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 16px;
}

#modalResultsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
    scrollbar-width: thin;
}

/* Garantizar 1 columna en móvil para el modal */
@media (max-width: 480px) {
    #modalResultsGrid {
        grid-template-columns: 1fr;
    }
}

#modalResultsGrid::-webkit-scrollbar {
    width: 4px;
}

#modalResultsGrid::-webkit-scrollbar-thumb {
    background: var(--primary, #6ea8fe);
    border-radius: 4px;
}

/* Tarjetas en modal de búsqueda */
#modalResultsGrid .game-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 12px;
    gap: 12px;
    background: var(--card-bg, #1e1e2a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 12px;
}

#modalResultsGrid .game-img {
    width: 70px;
    height: 70px;
    min-width: 70px;
    border-radius: 8px;
    object-fit: cover;
}

#modalResultsGrid .game-info {
    flex: 1;
    min-width: 0;
}

#modalResultsGrid .game-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary, #6ea8fe);
    margin-bottom: 4px;
    white-space: normal;
    word-break: break-word;
}

#modalResultsGrid .game-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted, #aaa);
}

#modalResultsGrid .game-meta small {
    display: flex;
    align-items: center;
    gap: 4px;
}

#modalResultsGrid .no-results-message {
    grid-column: 1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #aaa);
}

#modalResultsGrid .no-results-message i {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 16px;
    display: block;
}

/* ===== SECCIÓN DE FAVORITOS ===== */
#favoriteGamesGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 360px) {
    #favoriteGamesGrid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
    }
}

#favoriteGamesGrid .game-card {
    width: 60%;
    margin: 0;
}

.empty-favorites {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted, #aaa);
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    margin: 20px;
}

.empty-favorites i {
    font-size: 4rem;
    opacity: 0.5;
    margin-bottom: 16px;
    display: block;
}

.empty-favorites p {
    font-size: 1.1rem;
    margin: 0;
}

/* ===== MODAL DE DETALLES - SECCIÓN DE DESCARGA MEJORADA ===== */

/* Secciones de descarga */
.download-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Sección por traductor */
.translator-section {
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    margin-bottom: 8px;
}

/* Cabecera del traductor */
.translator-header {
    padding: 12px 16px;
    background: rgba(var(--primary-rgb, 110, 168, 254), 0.1);
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1));
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--primary, #6ea8fe);
}

.translator-header i {
    font-size: 1rem;
}

.translator-name {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: 1;
}

.translator-badge-count {
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    color: var(--text-muted, #aaa);
}

/* Contenedor de enlaces del traductor */
.translator-links {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Badge de acortadores */
.shortener-badge {
    display: inline-block;
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
    border: 1px solid rgba(255, 193, 7, 0.3);
    white-space: nowrap;
}

/* Botones de descarga mejorados */
.download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(145deg, var(--primary, #0d6efd), var(--primary-dark, #0b5ed7));
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
    width: 100%;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(13, 110, 253, 0.3);
    filter: brightness(1.1);
}

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

.download-btn i {
    font-size: 1.1rem;
}

.download-btn-text {
    flex: 1;
    text-align: left;
}

/* Badge de traductor en detalles */
.translator-badge {
    display: inline-block;
    background: rgba(var(--primary-rgb, 110, 168, 254), 0.15);
    color: var(--primary, #6ea8fe);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-right: 6px;
    margin-bottom: 6px;
    border: 1px solid rgba(var(--primary-rgb, 110, 168, 254), 0.3);
}

/* Badge de categorías */
.category-badge {
    display: inline-block;
    background: rgba(255,255,255,0.1);
    color: var(--text, #fff);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-right: 6px;
    margin-bottom: 6px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
}

/* ===== ESTADOS VACÍOS ===== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted, #aaa);
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.5;
    margin-bottom: 16px;
    display: block;
}

/* ===== PAGINACIÓN ===== */
.pagination {
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-item .page-link {
    background: var(--card-bg, #1e1e2a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    color: var(--text, #fff);
    border-radius: 8px;
    min-width: 38px;
    text-align: center;
    transition: all 0.2s;
}

.page-item.active .page-link {
    background: var(--primary, #0d6efd);
    border-color: var(--primary, #0d6efd);
    color: white;
}

.page-item .page-link:hover {
    background: var(--primary, #0d6efd);
    border-color: var(--primary, #0d6efd);
    color: white;
}

.page-item.disabled .page-link {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== CARRUSEL DE IMÁGENES MEJORADO ===== */
#gameImagesCarousel {
    max-width: 600px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#gameImagesCarousel .carousel-inner {
    border-radius: 12px;
    overflow: hidden;
}

#gameImagesCarousel .carousel-item {
    aspect-ratio: 16 / 9;
    background: #000;
}

#gameImagesCarousel .carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

#gameImagesCarousel .carousel-control-prev,
#gameImagesCarousel .carousel-control-next {
    opacity: 0;
    transition: opacity 0.3s;
}

#gameImagesCarousel:hover .carousel-control-prev,
#gameImagesCarousel:hover .carousel-control-next {
    opacity: 0.8;
}

/* ===== MODAL DE FILTROS ===== */
#filtersModal {
    padding: 20px;
}

#filtersModal .container {
    max-width: 500px;
    margin: 0 auto;
    background: var(--card-bg, #1e1e2a);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
}

.filter-section {
    margin-bottom: 24px;
}

.filter-section h6 {
    margin-bottom: 12px;
    color: var(--primary, #6ea8fe);
    font-weight: 600;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.2);
    padding: 8px 12px;
    border-radius: 30px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.filter-option:hover {
    background: rgba(var(--primary-rgb, 110, 168, 254), 0.1);
    border-color: var(--primary, #6ea8fe);
}

.filter-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary, #6ea8fe);
}

.filter-label {
    color: var(--text, #fff);
}

/* ===== FILTROS AVANZADOS DE CATEGORÍAS ===== */
.categories-advanced {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.category-filter-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.category-name {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

.category-actions {
    display: flex;
    gap: 6px;
}

.category-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.3);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-action-btn.include-btn:hover,
.category-action-btn.include-btn.active {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    border-color: #28a745;
}

.category-action-btn.exclude-btn:hover,
.category-action-btn.exclude-btn.active {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border-color: #dc3545;
}

.category-action-btn i {
    font-size: 1rem;
}

/* ===== FILTROS DE TRADUCTORES ===== */
.translator-option {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
}

.translator-option:hover {
    background: rgba(var(--primary-rgb), 0.2);
}

/* ===== MEJORAS PARA FILTROS ===== */
.filter-section h6 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.filter-section h6 i {
    color: var(--primary);
}

.filter-section h6 small {
    font-size: 0.7rem;
    font-weight: normal;
    margin-left: auto;
}

/* Scrollbar personalizado para categorías */
.categories-advanced::-webkit-scrollbar {
    width: 4px;
}

.categories-advanced::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* ===== CONTADOR DE FILTROS ACTIVOS ===== */
.active-filters-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    margin-left: 6px;
}

/* ===== BOTÓN DE FILTROS MEJORADO ===== */
#toggleFiltersBtn {
    position: relative;
}

#toggleFiltersBtn.has-filters::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-message {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 11000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ===== ESTILOS TIPO BING/GOOGLE PARA DESCRIPCIONES ===== */
.b_caption {
    font-size: 13px;
    color: #9aa0a6;
    line-height: 1.4;
  }
  
  .b_lineclamp2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  /* Para mantener consistencia con tu tema actual */
  .theme-midnight .b_caption {
    color: var(--muted, #b6baf2);
  }

  /* Ajuste para las tarjetas con descripción */
.game-card .game-description {
    min-height: 45px; /* Para evitar saltos visuales */
    margin: 4px 0;
}

.game-card .game-description p {
    margin: 0;
    font-size: 12px;
}

.new-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff4757;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 12px;
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.game-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.game-grid.list-view .game-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 8px;
}
.game-grid.list-view .image-container {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}
.game-grid.list-view .game-title {
    white-space: normal;
}
/* =====================================================
   NUEVAS FUNCIONALIDADES — AÑADIDAS AUTOMÁTICAMENTE
   ===================================================== */

/* ── Star Rating ── */
.star-rating-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(var(--primary-rgb,110,168,254),0.06);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
}

.star-interactive {
    display: flex;
    gap: 4px;
}

.star-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    font-size: 1.4rem;
    color: var(--muted, #aaa);
    transition: transform 0.12s, color 0.12s;
    line-height: 1;
}

.star-btn.filled i,
.star-btn.hover i {
    color: #ffc107;
}

.star-btn:hover {
    transform: scale(1.2);
}

.star-avg {
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ── Copiar enlace ── */
#copyLinkBtn {
    transition: all 0.2s;
}
#copyLinkBtn:active {
    transform: scale(0.97);
}

/* ── Badges de estado animados ── */
.status-badge-available {
    background: #28a745 !important;
    color: #fff !important;
    animation: statusPulse 2.5s infinite;
}

.status-badge-error {
    background: #dc3545 !important;
    color: #fff !important;
    animation: statusShake 0.5s ease 0s 1, statusErrorPulse 3s infinite 0.6s;
}

.status-badge-maintenance {
    background: #ffc107 !important;
    color: #000 !important;
    animation: statusBlink 1.4s infinite;
}

.status-badge-unknown {
    background: #6c757d !important;
    color: #fff !important;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(40,167,69,0.5); }
    50%       { box-shadow: 0 0 0 6px rgba(40,167,69,0); }
}

@keyframes statusShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-4px); }
    40%       { transform: translateX(4px); }
    60%       { transform: translateX(-3px); }
    80%       { transform: translateX(3px); }
}

@keyframes statusErrorPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,53,69,0.5); }
    50%       { box-shadow: 0 0 0 6px rgba(220,53,69,0); }
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

/* ── Estado de traducción badge ── */
.trad-status-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: inline-block;
}

.trad-done    { background: rgba(13,110,253,0.18); color: #6ea8fe; }
.trad-wip     { background: rgba(255,193,7,0.18);  color: #ffc107; }
.trad-paused  { background: rgba(108,117,125,0.2); color: #adb5bd; }
.trad-unknown { background: rgba(108,117,125,0.15); color: #6c757d; }

/* ── Categorías favoritas para notificaciones ── */
.fav-cats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.fav-cat-btn {
    background: rgba(var(--primary-rgb,110,168,254),0.08);
    border: 1px solid var(--border-color);
    color: var(--text);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.18s;
}

.fav-cat-btn.active {
    background: var(--primary, #6ea8fe);
    border-color: var(--primary, #6ea8fe);
    color: #fff;
    font-weight: 600;
}

.fav-cat-btn:hover:not(.active) {
    border-color: var(--primary, #6ea8fe);
    color: var(--primary, #6ea8fe);
}
