/**
 * public/roulette.css
 * Responsabilidad: Estilos modernos, responsivos y de alta fidelidad visual para la Ruleta Alquímica Diaria.
 */

.roulette-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    box-sizing: border-box;
}

.roulette-wheel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(380px, 80vw, 42vh);
    height: min(380px, 80vw, 42vh);
    aspect-ratio: 1 / 1;
    margin-bottom: 14px;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.65));
}

#roulette-canvas {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

/* Aguja indicadora superior apuntando hacia abajo */
.roulette-pointer {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 26px;
    color: #facc15;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.8), 0 3px 6px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    z-index: 10;
    line-height: 1;
    animation: pointer-wobble 2s ease-in-out infinite alternate;
}

@keyframes pointer-wobble {
    0% { transform: translateX(-50%) translateY(0); }
    100% { transform: translateX(-50%) translateY(2px); }
}

/* Panel de controles y botones */
.roulette-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 380px;
    gap: 12px;
    box-sizing: border-box;
}

.roulette-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}

#roulette-countdown-label {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

.roulette-timer {
    font-size: 14px;
    font-weight: 800;
    color: #38bdf8;
    font-family: 'Cinzel', monospace, sans-serif;
    letter-spacing: 0.5px;
}

.roulette-timer.ready {
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
    animation: pulse-ready 1.5s infinite;
}

@keyframes pulse-ready {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.02); }
}

/* Botón de Girar Ruleta */
.roulette-btn-spin {
    position: relative;
    width: 100%;
    padding: 14px 20px;
    font-family: 'Cinzel', 'Plus Jakarta Sans', sans-serif;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #ffffff;
    background: linear-gradient(135deg, #0284c7 0%, #6366f1 50%, #a855f7 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45), 0 0 20px rgba(2, 132, 199, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.roulette-btn-spin:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.65), 0 0 30px rgba(168, 85, 247, 0.5);
    filter: brightness(1.1);
}

.roulette-btn-spin:active:not(:disabled) {
    transform: translateY(1px);
}

.roulette-btn-spin.pulse-ready {
    animation: spin-pulse 2s infinite ease-in-out;
}

@keyframes spin-pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45), 0 0 15px rgba(2, 132, 199, 0.35);
    }
    50% {
        box-shadow: 0 6px 28px rgba(99, 102, 241, 0.8), 0 0 35px rgba(168, 85, 247, 0.65);
    }
}

.roulette-btn-spin:disabled {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    filter: none;
}

/* Botón de Giro con Anuncio (Deshabilitado / Próximamente) */
.roulette-btn-ad {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    background: rgba(30, 41, 59, 0.6);
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    cursor: not-allowed;
    transition: all 0.2s ease;
    user-select: none;
}

.roulette-btn-ad .badge-soon {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

/* Adaptación Responsive para Móviles y Pantallas Bajas */
@media (max-width: 600px), (max-height: 720px) {
    .roulette-container {
        padding: 6px 8px !important;
        max-width: 100% !important;
    }

    .roulette-wheel-wrapper {
        width: min(270px, 70vw, 34vh) !important;
        height: min(270px, 70vw, 34vh) !important;
        aspect-ratio: 1 / 1 !important;
        margin-bottom: 8px !important;
        filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.55)) !important;
    }

    #roulette-canvas {
        width: 100% !important;
        height: 100% !important;
    }

    .roulette-pointer {
        font-size: 20px !important;
        top: -6px !important;
    }

    .roulette-controls {
        max-width: min(320px, 92vw) !important;
        gap: 8px !important;
    }

    .roulette-status-card {
        padding: 6px 12px !important;
        border-radius: 10px !important;
    }

    #roulette-countdown-label {
        font-size: 11px !important;
    }

    .roulette-timer {
        font-size: 12px !important;
    }

    .roulette-btn-spin {
        padding: 10px 14px !important;
        font-size: 13px !important;
        border-radius: 10px !important;
    }

    .roulette-btn-ad {
        padding: 7px 12px !important;
        font-size: 11px !important;
        border-radius: 10px !important;
    }
}

/* Soporte explícito para móviles en orientación horizontal (Landscape) de baja altura */
@media (max-height: 520px) and (orientation: landscape) {
    .roulette-container {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        padding: 4px !important;
    }
    .roulette-wheel-wrapper {
        width: min(210px, 46vh) !important;
        height: min(210px, 46vh) !important;
        margin-bottom: 0 !important;
    }
    .roulette-controls {
        max-width: 250px !important;
        gap: 6px !important;
    }
}

/* Badge en la pestaña de ruleta */
.account-tab-btn.has-badge {
    position: relative;
    border-color: rgba(245, 158, 11, 0.45);
}

.account-tab-btn.has-badge::after {
    content: "!";
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
    animation: tab-badge-pulse 1.5s infinite;
}

@keyframes tab-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Botón de acceso rápido en el menú principal sincronizado con .btn-sec-card */
.roulette-action-btn {
    position: relative;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.88) 0%, rgba(30, 41, 59, 0.88) 100%) !important;
    border: 1.2px solid rgba(245, 158, 11, 0.4) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.roulette-action-btn:hover {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.3), rgba(99, 102, 241, 0.35)) !important;
    border-color: rgba(245, 158, 11, 0.8) !important;
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.35), 0 6px 22px rgba(0, 0, 0, 0.6) !important;
}

