/**
 * Estilos Principales - Ruleta Promocional Mundo Mineral
 * Diseño responsive, centrado y con paleta de Amatista, Cuarzo y Oro/Pirita.
 */

:root {
    --mm-brand-primary:   #13525B; /* Verde Petróleo / Malaquita */
    --mm-brand-dark:      #0C383E;
    --mm-brand-light:     #29838E;
    --mm-gold-primary:    #C59B27; /* Oro Pirita / Ámbar */
    --mm-gold-hover:      #B3891D;
    --mm-quartz-bg:       #F9F7F4; /* Fondo Caliza Orgánico */
    --mm-quartz-card:     #FFFFFF;
    --mm-quartz-border:   #E5E0D8;
    --mm-text-dark:       #1E252B; /* Grafito Obsidiana */
    --mm-text-muted:      #606C74;
    --mm-shadow-luxury:   0 12px 30px rgba(19, 82, 91, 0.10);
    --mm-radius-round:    14px;
    --mm-transition:      all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   Contenedor Principal y Estructura Flexbox Centrada
   ========================================================================== */
.mm-ruleta-container {
    width: 100%;
    max-width: 1020px;
    margin: 40px auto;
    padding: 30px;
    box-sizing: border-box;
    background-color: var(--mm-quartz-bg);
    border: 1px solid var(--mm-quartz-border);
    border-radius: var(--mm-radius-round);
    box-shadow: var(--mm-shadow-luxury);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap; /* Permite que el crédito baje abajo del todo */
    align-items: center;
    justify-content: center;
    gap: 30px 40px;
}

/* ==========================================================================
   Columna Izquierda: Formulario y Textos
   ========================================================================== */
.mm-ruleta-controls {
    flex: 1 1 380px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

.mm-ruleta-title {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--mm-amethyst-dark);
    margin: 0 0 12px 0;
    line-height: 1.25;
    letter-spacing: -0.5px;
}

.mm-ruleta-desc {
    font-size: 1.05rem;
    color: var(--mm-text-muted);
    line-height: 1.6;
    margin: 0 0 24px 0;
}

.mm-form-inline {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.mm-input {
    width: 100%;
    height: 52px;
    padding: 0 18px;
    font-size: 1rem;
    color: var(--mm-text-dark);
    background: #FFFFFF;
    border: 2px solid var(--mm-quartz-border);
    border-radius: 10px;
    box-sizing: border-box;
    outline: none;
    transition: var(--mm-transition);
}

.mm-input:focus {
    border-color: var(--mm-amethyst-light);
    box-shadow: 0 0 0 4px rgba(140, 103, 182, 0.15);
}

/* Botón Dorado (CTA Oro / Pirita) */
.mm-btn-spin {
    height: 54px;
    background: linear-gradient(135deg, var(--mm-gold-primary) 0%, #B89027 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.35);
    transition: var(--mm-transition);
}

.mm-btn-spin:hover:not(:disabled) {
    background: linear-gradient(135deg, #DFB942 0%, var(--mm-gold-hover) 100%);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    transform: translateY(-2px);
}

.mm-btn-spin:disabled {
    background: #D1CFD4;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.mm-error-msg {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #C0392B;
    background: rgba(192, 57, 43, 0.08);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #C0392B;
}

/* ==========================================================================
   Columna Derecha: Lienzo Canvas (Geometría Circular Forzada)
   ========================================================================== */
.mm-canvas-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1 / 1; /* Garantiza que el contenedor siempre sea un cuadrado perfecto */
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

#mm-ruleta-canvas {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1 !important;
    display: block;
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 6px #FFFFFF, 0 0 0 9px var(--mm-gold-primary);
    box-sizing: border-box;
}

/* Puntero estilizado en forma de faceta de gema */
.mm-ruleta-pointer {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 36px solid var(--mm-brand-primary);
    z-index: 20;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.mm-ruleta-pointer::after {
    content: '';
    position: absolute;
    top: -34px;
    left: -6px;
    width: 12px;
    height: 12px;
    background: var(--mm-gold-primary);
    border-radius: 50%;
}

/* ==========================================================================
   Ventana Modal de Premios
   ========================================================================== */
.mm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.mm-modal.active {
    display: flex;
}

.mm-modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(35, 31, 32, 0.65);
    backdrop-filter: blur(5px);
}

.mm-modal-content {
    position: relative;
    background: var(--mm-quartz-card);
    border: 2px solid var(--mm-gold-primary);
    border-radius: 18px;
    padding: 40px 30px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    z-index: 10;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    animation: mmModalEnter 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes mmModalEnter {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.mm-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 30px;
    line-height: 1;
    color: var(--mm-text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.mm-modal-close:hover {
    color: var(--mm-text-dark);
}

.mm-badge-premio {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--mm-amethyst-dark);
    background: var(--mm-quartz-bg);
    border: 1px solid var(--mm-quartz-border);
    padding: 6px 14px;
    border-radius: 30px;
    margin-bottom: 12px;
}

.mm-modal-title {
    font-size: 1.7rem;
    color: var(--mm-amethyst-dark);
    margin: 8px 0 14px 0;
    font-weight: 700;
}

/* Caja de Cupón Estilo Ticket Joyería */
.mm-cupon-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FCF9FA;
    border: 2px dashed var(--mm-amethyst-light);
    border-radius: 10px;
    padding: 12px 18px;
    margin: 22px 0;
}

.mm-codigo-label {
    font-family: "Courier New", Courier, monospace;
    font-size: 1.35rem;
    font-weight: bold;
    color: var(--mm-amethyst-dark);
    letter-spacing: 2px;
}

.mm-btn-copy {
    background: var(--mm-amethyst-primary);
    color: #FFFFFF;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--mm-transition);
}

.mm-btn-copy:hover {
    background: var(--mm-amethyst-dark);
}

.mm-modal-disclaimer {
    font-size: 0.8rem;
    color: var(--mm-text-muted);
    margin: 0;
}

/* ==========================================================================
   Adaptabilidad Móvil y Tablets (Media Queries)
   ========================================================================== */

/* Tablets y pantallas intermedias */
@media (max-width: 900px) {
    .mm-ruleta-container {
        flex-direction: column-reverse; /* La ruleta arriba, el formulario abajo */
        text-align: center;
        padding: 24px;
        gap: 30px;
    }

    .mm-ruleta-controls {
        text-align: center;
        flex: 1 1 auto;
        width: 100%;
        max-width: 480px;
    }

    .mm-canvas-box {
        width: 380px;
        height: 380px;
    }
}

/* Smartphones (iPhone, Android hasta 480px) */
@media (max-width: 480px) {
    .mm-ruleta-container {
        padding: 18px 12px;
        margin: 20px auto;
        border-radius: 12px;
        border-left: none;
        border-right: none;
    }

    .mm-ruleta-title {
        font-size: 1.6rem;
    }

    .mm-ruleta-desc {
        font-size: 0.95rem;
    }

    /* Redimensionar canvas manteniendo la proporción 1:1 */
    .mm-canvas-box {
        width: 300px;
        height: 300px;
    }

    .mm-ruleta-pointer {
        top: -10px;
        border-left-width: 14px;
        border-right-width: 14px;
        border-top-width: 28px;
    }

    .mm-input,
    .mm-btn-spin {
        height: 48px;
        font-size: 0.95rem;
    }

    .mm-modal-content {
        padding: 28px 18px;
        width: 92%;
    }

    .mm-codigo-label {
        font-size: 1.1rem;
        letter-spacing: 1px;
    }
}

/* ==========================================================================
   Crédito de Desarrollador Discreto
   ========================================================================== */
.mm-ruleta-developer-credit {
    width: 100% !important;
    flex: 0 0 100% !important; /* Fuerza a ocupar toda la fila inferior */
    order: 99 !important;      /* Se coloca obligatoriamente abajo de la ruleta y del formulario */
    text-align: center;
    font-size: 11px;
    color: var(--mm-text-muted, #606C74);
    opacity: 0.6;
    letter-spacing: 0.5px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--mm-quartz-border, #E5E0D8);
    user-select: none;
    clear: both;
}

.mm-ruleta-developer-credit:hover {
    opacity: 0.95;
}