/**
 * GAME SELECTION MODAL - Estilos del Modal de Selección de Partidas
 * Ajedrez de Silicio
 */

/* ===== BOTÓN CAMBIAR PARTIDA ===== */
.change-game-btn {
    background: transparent;
    border: 1px solid var(--theme-border);
    color: var(--theme-accent-primary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 12px;
    transition: all var(--transition-theme);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0.8;
}

.change-game-btn:hover {
    background: var(--theme-bg-tertiary);
    border-color: var(--theme-accent-primary);
    color: var(--theme-accent-primary);
    transform: scale(1.05);
    opacity: 1;
}

.change-game-btn:active {
    transform: scale(0.95);
}

/* ===== MODAL DE SELECCIÓN ===== */
.game-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-selection-overlay.active {
    opacity: 1;
}

.game-selection-container {
    background: var(--theme-modal-bg);
    border: 2px solid var(--theme-border);
    border-radius: 16px;
    box-shadow: 
        0 20px 60px var(--theme-shadow),
        0 0 0 1px var(--theme-shadow-glow);
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
    transition: all var(--transition-theme);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.game-selection-header {
    padding: 20px 24px;
    border-bottom: 2px solid var(--theme-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    transition: border-color var(--transition-theme);
}

.game-selection-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--theme-accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color var(--transition-theme);
}

.game-selection-close {
    background: transparent;
    border: none;
    color: var(--theme-text-secondary);
    font-size: 32px;
    cursor: pointer;
    transition: all var(--transition-theme);
    line-height: 1;
    opacity: 0.6;
}

.game-selection-close:hover {
    color: var(--theme-accent-secondary);
    transform: rotate(90deg);
    opacity: 1;
}

.game-selection-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.game-selection-footer {
    padding: 16px 24px;
    border-top: 2px solid var(--theme-border);
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color var(--transition-theme);
}

.game-selection-print-all {
    background: var(--theme-bg-tertiary);
    border: 2px solid var(--theme-border);
    border-radius: 8px;
    padding: 12px 24px;
    color: var(--theme-accent-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-theme);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-main);
}

.game-selection-print-all:hover {
    background: var(--theme-button-hover);
    border-color: var(--theme-accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--theme-shadow-glow);
    color: var(--theme-button-text-hover);
}

.game-selection-print-all:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.2);
}

.game-selection-print-all:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.game-selection-subtitle {
    color: var(--theme-text-secondary);
    margin-bottom: 20px;
    font-size: 15px;
    transition: color var(--transition-theme);
}

.game-selection-subtitle span {
    color: var(--theme-accent-primary);
    font-weight: bold;
}

.games-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-item {
    background: var(--theme-bg-tertiary);
    border: 2px solid var(--theme-border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition-theme);
}

.game-item:hover {
    background: var(--theme-input-bg);
    border-color: var(--theme-accent-primary);
    transform: translateX(5px);
}

.game-item.selected {
    background: var(--theme-button-hover);
    border-color: var(--theme-accent-primary);
}

.game-item.loading {
    position: relative;
    background: var(--theme-bg-tertiary);
    border-color: var(--theme-accent-primary);
    cursor: wait;
    pointer-events: none;
    opacity: 1 !important;
}

.game-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 3px solid var(--theme-border);
    border-top-color: var(--theme-accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.game-item.loading .game-players::after {
    content: ' (Cargando...)';
    color: var(--theme-accent-primary);
    font-size: 12px;
    font-weight: normal;
    margin-left: 8px;
}

.game-item.loading:hover {
    transform: none;
    background: var(--theme-bg-tertiary);
    border-color: var(--theme-accent-primary);
}

.game-players {
    font-size: 16px;
    font-weight: bold;
    color: var(--theme-text-secondary);
    margin-bottom: 8px;
    transition: color var(--transition-theme);
}

.game-players .white {
    color: var(--theme-text-secondary);
}

.game-players .vs {
    color: var(--theme-accent-primary);
    margin: 0 8px;
}

.game-players .black {
    color: var(--theme-text-muted);
}

.game-info {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--theme-text-muted);
    transition: color var(--transition-theme);
}

.game-info-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.game-result {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
}

.game-result.white-win {
    background: var(--theme-bg-tertiary);
    color: var(--theme-text-secondary);
}

.game-result.black-win {
    background: var(--theme-input-bg);
    color: var(--theme-text-muted);
}

.game-result.draw {
    background: var(--theme-bg-tertiary);
    color: var(--theme-accent-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .game-selection-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .game-selection-header {
        padding: 16px;
    }
    
    .game-selection-title {
        font-size: 16px;
    }
    
    .game-item {
        padding: 12px;
    }
    
    .change-game-btn {
        font-size: 12px;
        padding: 3px 6px;
        margin-left: 8px;
    }
}

/* ===== MÓVILES HORIZONTALES ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .game-selection-container {
        max-width: 320px !important;
        max-height: 80vh !important;
    }
    
    .game-selection-header {
        padding: 12px 16px !important;
    }
    
    .game-selection-title {
        font-size: 16px !important;
    }
    
    .game-selection-close {
        font-size: 24px !important;
    }
    
    .game-selection-content {
        padding: 16px !important;
    }
    
    .game-selection-subtitle {
        font-size: 13px !important;
        margin-bottom: 14px !important;
    }
    
    .games-list {
        gap: 10px !important;
    }
    
    .game-item {
        padding: 12px !important;
    }
    
    .game-players {
        font-size: 14px !important;
        margin-bottom: 6px !important;
    }
    
    .game-info {
        font-size: 11px !important;
        gap: 12px !important;
    }
    
    .game-result {
        padding: 3px 8px !important;
        font-size: 11px !important;
    }
    
    .game-selection-footer {
        padding: 12px 16px !important;
    }
    
    .game-selection-print-all {
        padding: 10px 18px !important;
        font-size: 13px !important;
    }
    
    .change-game-btn {
        font-size: 11px !important;
        padding: 2px 5px !important;
        margin-left: 6px !important;
    }
}