/**
 * Estilos para Sistema Dinámico de Tipos de Jugadas
 * Archivo: /src/assets/css/modules/terminals/dynamic-game-types.css
 * 
 * Estilos específicos para la funcionalidad dinámica de tipos de juego
 */

/* ============================================================================
   CONTENEDOR PRINCIPAL DE TIPOS DE JUEGO
   ============================================================================ */

.play-type-section {
    position: relative;
    margin-bottom: 0rem;
    transition: all 0.3s ease;
}

.play-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    transition: all 0.3s ease;
}

/* Responsive breakpoints */
@media (max-width: 576px) {
    .play-type-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .play-type-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .play-type-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.6rem;
    }
}

@media (min-width: 993px) {
    .play-type-grid {
        grid-template-columns: repeat(5, 1fr);
/*        gap: 0.7rem;*/
    }
}

/* ============================================================================
   BOTONES DE TIPOS DE JUEGO DINÁMICOS
   ============================================================================ */

.play-type-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    padding: 0.5rem 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: #ffffff;
    color: #495057;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.play-type-btn:hover {
    border-color: #0d6efd;
    background: #f8f9ff;
    color: #0d6efd;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.play-type-btn.active {
    border-color: #0d6efd;
    background: #0d6efd;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
}

.play-type-btn.active:hover {
    background: #0b5ed7;
    border-color: #0b5ed7;
}

/* Iconos en botones */
.play-type-btn i {
    font-size: 1rem;
    margin-right: 0.25rem;
    transition: transform 0.2s ease;
}

.play-type-btn:hover i {
    transform: scale(1.1);
}

/* Estados específicos por color/tipo */
.play-type-btn[data-type*="straight"] {
    border-color: #198754;
}

.play-type-btn[data-type*="straight"]:hover,
.play-type-btn[data-type*="straight"].active {
    background: #198754;
    border-color: #198754;
    color: #ffffff;
}

.play-type-btn[data-type*="box"] {
    border-color: #0dcaf0;
}

.play-type-btn[data-type*="box"]:hover,
.play-type-btn[data-type*="box"].active {
    background: #0dcaf0;
    border-color: #0dcaf0;
    color: #000;
}

.play-type-btn[data-type*="combo"] {
    border-color: #6c757d;
}

.play-type-btn[data-type*="combo"]:hover,
.play-type-btn[data-type*="combo"].active {
    background: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
}

.play-type-btn[data-type*="pair"] {
    border-color: #212529;
}

.play-type-btn[data-type*="pair"]:hover,
.play-type-btn[data-type*="pair"].active {
    background: #212529;
    border-color: #212529;
    color: #ffffff;
}

.play-type-btn[data-type="number_combiner"] {
    border-color: #dc3545;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
}

.play-type-btn[data-type="number_combiner"]:hover,
.play-type-btn[data-type="number_combiner"].active {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: #dc3545;
    color: #ffffff;
}

/* ============================================================================
   ESTADOS DE CARGA Y MENSAJES
   ============================================================================ */

.loading-game-types,
.no-game-types-message {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
    color: #6c757d;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
}

.loading-game-types .spinner-border {
    margin-bottom: 0.5rem;
}

.loading-game-types p,
.no-game-types-message p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
}

.no-game-types-message i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #ffc107;
}

/* ============================================================================
   INDICADORES Y BADGES
   ============================================================================ */

.play-type-btn::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.play-type-btn.active::after {
    opacity: 1;
}

/* Badge para tipos especiales */
.play-type-btn[data-type="number_combiner"]::before {
    content: '★';
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.7rem;
    color: #dc3545;
    opacity: 0.7;
}

.play-type-btn[data-type="number_combiner"].active::before {
    color: #ffffff;
    opacity: 1;
}

/* ============================================================================
   TOOLTIPS Y AYUDAS
   ============================================================================ */

.play-type-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 5px;
}

/* Flecha del tooltip */
.play-type-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    pointer-events: none;
}

/* ============================================================================
   ANIMACIONES Y EFECTOS
   ============================================================================ */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
    }
    50% {
        box-shadow: 0 4px 16px rgba(13, 110, 253, 0.4);
    }
}

.play-type-btn {
    animation: slideInUp 0.3s ease forwards;
}

.play-type-btn:nth-child(1) { animation-delay: 0.05s; }
.play-type-btn:nth-child(2) { animation-delay: 0.1s; }
.play-type-btn:nth-child(3) { animation-delay: 0.15s; }
.play-type-btn:nth-child(4) { animation-delay: 0.2s; }
.play-type-btn:nth-child(5) { animation-delay: 0.25s; }

.play-type-btn.active {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* ============================================================================
   CONFIGURACIÓN ESPECÍFICA POR TIPO DE LOTERÍA
   ============================================================================ */

/* Pick 3 styles */
.lottery-type-pick3 .play-type-btn {
    border-radius: 6px;
    font-size: 0.8rem;
}

.lottery-type-pick3 .play-type-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

/* Pick 4 styles */
.lottery-type-pick4 .play-type-btn {
    border-radius: 8px;
    font-size: 0.85rem;
    min-height: 50px;
}

.lottery-type-pick4 .play-type-grid {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.6rem;
}

/* Traditional lottery styles */
.lottery-type-traditional .play-type-btn {
    border-radius: 10px;
    font-size: 0.9rem;
    min-height: 55px;
    font-weight: 600;
}

.lottery-type-traditional .play-type-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.7rem;
}

/* ============================================================================
   MODO OSCURO (DARK MODE)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .play-type-btn {
        background: #343a40;
        color: #ffffff;
        border-color: #495057;
    }
    
    .play-type-btn:hover {
        background: #495057;
        border-color: #0d6efd;
        color: #ffffff;
    }
    
    .loading-game-types,
    .no-game-types-message {
        background: #343a40;
        color: #ffffff;
        border-color: #495057;
    }
}

/* ============================================================================
   ESTADOS DE ACCESIBILIDAD
   ============================================================================ */

.play-type-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
    border-color: #0d6efd;
}

.play-type-btn:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Reducir animaciones para usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .play-type-btn {
        animation: none;
        transition: none;
    }
    
    .play-type-btn.active {
        animation: none;
    }
    
    .play-type-btn i {
        transition: none;
    }
}

/* ============================================================================
   IMPRESIÓN
   ============================================================================ */

@media print {
    .play-type-section,
    .play-type-grid,
    .play-type-btn {
        display: none !important;
    }
}

/* ============================================================================
   UTILIDADES ESPECÍFICAS
   ============================================================================ */

.play-type-section.updating {
    pointer-events: none;
    opacity: 0.7;
}

.play-type-section.updating .play-type-btn {
    cursor: not-allowed;
}

/* Indicador de tipo de lotería activa */
.play-type-section::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0d6efd, #198754, #dc3545);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.play-type-section.active::before {
    opacity: 1;
}

/* Estilos para diferentes tamaños de fuente en textos largos */
.play-type-btn span {
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
}

@media (max-width: 480px) {
    .play-type-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.5rem;
        min-height: 40px;
    }
    
    .play-type-btn i {
        font-size: 0.875rem;
        margin-right: 0.15rem;
    }
}

/* ============================================================================
   COMPATIBILIDAD CON TEMA EXISTENTE
   ============================================================================ */

/* Integración con colores del tema principal */
.play-type-btn {
    --bs-btn-padding-x: 0.75rem;
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-font-size: 0.875rem;
    --bs-btn-border-width: 2px;
    --bs-btn-border-radius: 8px;
    --bs-btn-transition: all 0.2s ease;
}

/* Estados hover mejorados */
.play-type-btn:not(.active):hover {
    --bs-btn-hover-bg: var(--bs-light);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-hover-color: var(--bs-primary);
}

.play-type-btn.active {
    --bs-btn-active-bg: var(--bs-primary);
    --bs-btn-active-border-color: var(--bs-primary);
    --bs-btn-active-color: var(--bs-white);
}

/* ============================================================================
   MEJORAS DE RENDIMIENTO
   ============================================================================ */

.play-type-grid {
    contain: layout style paint;
    will-change: contents;
}

.play-type-btn {
    contain: layout style paint;
    transform: translateZ(0); /* Forzar hardware acceleration */
}

.play-type-btn:hover {
    will-change: transform, box-shadow;
}

.play-type-btn:not(:hover) {
    will-change: auto;
}