/* ==========================================================================
   Luckify Premium Theme - Stylesheet
   ========================================================================== */

:root {
    /* Paleta de Colores de Lujo */
    --color-bg-darker: #060913;
    --color-bg-main: #0b0f19;
    --color-bg-card: rgba(17, 25, 40, 0.65);
    
    --color-primary: #8b5cf6;       /* Violeta / Neón */
    --color-primary-glow: rgba(139, 92, 246, 0.4);
    --color-secondary: #06b6d4;     /* Cian */
    --color-secondary-glow: rgba(6, 182, 212, 0.3);
    
    --color-win: #10b981;           /* Verde Esmeralda */
    --color-win-glow: rgba(16, 185, 129, 0.3);
    --color-loss: #f43f5e;          /* Rosa Coral */
    --color-loss-glow: rgba(244, 63, 94, 0.3);
    --color-draw: #f59e0b;          /* Ámbar */
    --color-draw-glow: rgba(245, 158, 11, 0.3);

    --color-text-primary: #f3f4f6;
    --color-text-secondary: #9ca3af;
    --color-text-muted: #6b7280;
    
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-glow: rgba(139, 92, 246, 0.2);
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset de Estilos & Accesibilidad */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg-darker);
    color: var(--color-text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Fondo Resplandeciente Dinámico */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 45%),
        var(--color-bg-main);
    z-index: -10;
}

/* --- HEADER --- */
.app-header {
    text-align: center;
    padding: 3rem 1.5rem 1.5rem;
    position: relative;
}

.logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.logo-sparkle {
    font-size: 2.2rem;
    animation: sparkle 3s ease-in-out infinite alternate;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 30%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(139, 92, 246, 0.15);
}

.logo-badge {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #c084fc;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
}

.tagline {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* --- DASHBOARD PRINCIPAL --- */
.dashboard {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* --- BARRA DE ESTADÍSTICAS GLOBALES --- */
.global-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.stat-mini-card {
    background: var(--color-bg-card);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s;
}

.stat-mini-card:hover {
    transform: translateY(-3px);
    border-color: var(--glass-border-glow);
}

.stat-mini-icon {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.04);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-mini-info {
    display: flex;
    flex-direction: column;
}

.stat-mini-label {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-mini-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
}

/* --- TARJETAS DE JUEGOS (GRID) --- */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.glassmorphic {
    background: var(--color-bg-card);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

.game-card {
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s, box-shadow 0.3s;
}

.game-card:hover {
    transform: translateY(-6px);
    border-color: var(--glass-border-glow);
    box-shadow: 0 12px 48px 0 rgba(139, 92, 246, 0.12);
}

.game-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.game-emoji {
    font-size: 1.8rem;
}

.game-card h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
}

.game-desc {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    min-height: 40px;
}

.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    margin-bottom: 2rem;
    position: relative;
}

.game-status {
    margin-top: 1.5rem;
    font-weight: 500;
    color: var(--color-text-primary);
    text-align: center;
    font-size: 1rem;
    transition: color 0.3s;
}

/* --- BOTONES PREMIUM --- */
.btn {
    width: 100%;
    border: none;
    outline: none;
    border-radius: 12px;
    padding: 0.9rem 1.5rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #7c3aed 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px var(--color-primary-glow);
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: #ffffff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    width: auto;
}

/* PIE DE TARJETA DE JUEGO */
.game-card-footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1.25rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.game-card-footer strong {
    color: #ffffff;
}

/* ==========================================================================
   JUEGO 1: CARA O CRUZ (DISEÑO 3D DE MONEDA)
   ========================================================================== */
.coin-container {
    width: 100px;
    height: 100px;
    perspective: 1000px;
}

.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s;
}

.coin-side {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.5);
    border: 4px solid #f59e0b;
}

.coin-front {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
}

.coin-back {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: rotateY(180deg);
}

/* Animaciones del giro de Moneda */
.animate-spin-cara {
    animation: spin-to-cara 1.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.animate-spin-cruz {
    animation: spin-to-cruz 1.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes spin-to-cara {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(1440deg); } /* 4 giros completos */
}

@keyframes spin-to-cruz {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(1620deg); } /* 4.5 giros (cae cruz) */
}


/* ==========================================================================
   JUEGO 2: DADO 3D
   ========================================================================== */
.scene {
    width: 60px;
    height: 60px;
    perspective: 400px;
}

.dice {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform: rotateX(-20deg) rotateY(20deg);
}

.dice-face {
    position: absolute;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #1e293b;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.15), 0 4px 15px rgba(255, 255, 255, 0.1);
    backface-visibility: visible;
}

/* Posiciones de las caras en espacio 3D */
.face-1 { transform: rotateY(0deg) translateZ(30px); }
.face-6 { transform: rotateY(180deg) translateZ(30px); }
.face-2 { transform: rotateY(90deg) translateZ(30px); }
.face-5 { transform: rotateY(-90deg) translateZ(30px); }
.face-3 { transform: rotateX(90deg) translateZ(30px); }
.face-4 { transform: rotateX(-90deg) translateZ(30px); }

/* Animación de Tumbado / Giro */
.animate-dice-roll {
    animation: tumbling-dice 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes tumbling-dice {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    30% { transform: rotateX(180deg) rotateY(360deg) rotateZ(90deg); }
    70% { transform: rotateX(360deg) rotateY(540deg) rotateZ(270deg); }
    100% { transform: rotateX(720deg) rotateY(1080deg) rotateZ(360deg); }
}


/* ==========================================================================
   JUEGO 3: PIEDRA, PAPEL O TIJERA (ARENA VS)
   ========================================================================== */
.rps-vs-arena {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 0.5rem;
}

.rps-fighter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.fighter-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fighter-hand {
    font-size: 3.5rem;
    background: rgba(255, 255, 255, 0.03);
    width: 85px;
    height: 85px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rps-vs-divider {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--color-primary);
    background: rgba(139, 92, 246, 0.1);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Selección del Jugador */
.rps-selection {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

.btn-rps {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    font-size: 2.2rem;
    width: 70px;
    height: 70px;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-rps:hover {
    transform: scale(1.1);
    border-color: var(--color-primary);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

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


/* ==========================================================================
   SECCIÓN: PANEL ESTADÍSTICO DE DETALLE (SQLITE ACCUMULATED)
   ========================================================================== */
.stats-dashboard {
    padding: 2.5rem;
    margin-top: 1rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
}

.stat-detail-block {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.stat-detail-block h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

/* Barras de Progreso para Moneda */
.progress-bar-container {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.progress-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--color-text-primary);
}

.progress-bar-track {
    background: rgba(255, 255, 255, 0.04);
    height: 10px;
    border-radius: 9999px;
    width: 100%;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    width: 0;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.fill-purple {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.fill-cyan {
    background: linear-gradient(90deg, #06b6d4, #22d3ee);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* Histograma de Dados */
.dice-histogram {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 120px;
    padding-top: 1rem;
}

.hist-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 12%;
    height: 100%;
}

.hist-bar-track {
    background: rgba(255, 255, 255, 0.04);
    width: 100%;
    height: 80px;
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.hist-bar-fill {
    background: linear-gradient(to top, var(--color-primary), #a78bfa);
    width: 100%;
    height: 0%;
    border-radius: 4px;
    transition: height 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hist-label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* Gráfico de Torta Sustituto */
.donut-chart-substitute {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    justify-content: center;
    height: 100%;
}

.chart-segment {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.bg-win { background-color: var(--color-win); box-shadow: 0 0 8px var(--color-win-glow); }
.bg-draw { background-color: var(--color-draw); box-shadow: 0 0 8px var(--color-draw-glow); }
.bg-loss { background-color: var(--color-loss); box-shadow: 0 0 8px var(--color-loss-glow); }

.text-win { color: var(--color-win); }
.text-draw { color: var(--color-draw); }
.text-loss { color: var(--color-loss); }


/* ==========================================================================
   NOTIFICACIÓN TOAST (MENSAJES FLOTANTES)
   ========================================================================== */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 320px;
}

.toast {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    font-size: 0.9rem;
}

.toast.toast-error {
    border-left: 4px solid var(--color-loss);
}

.toast.toast-success {
    border-left: 4px solid var(--color-win);
}

@keyframes slide-in {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}


/* --- FOOTER --- */
.app-footer {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}


/* ==========================================================================
   ANIMACIONES GENERALES
   ========================================================================== */
@keyframes sparkle {
    0% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 2px rgba(139, 92, 246, 0.5)); }
    100% { transform: scale(1.15) rotate(15deg); filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.8)); }
}


/* ==========================================================================
   DISEÑO RESPONSIVO (MEDIAS QUERIES)
   ========================================================================== */
@media (max-width: 768px) {
    .logo-text {
        font-size: 2.2rem;
    }
    
    .dashboard {
        padding: 0 1rem 2rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-dashboard {
        padding: 1.5rem;
    }
}
