/**
 * Estilos del Frontend
 * Plugin: JOINET Ruleta de Suerte
 * Diseñado con aislamiento de estilos para evitar conflictos
 */

/* Variables de colores JOINET */
.joinet-ruleta-overlay,
.joinet-ruleta-modal {
    --joinet-red: #e74c3c;
    --joinet-red-dark: #c0392b;
    --joinet-white: #ffffff;
    --joinet-black: #000000;
    --joinet-gray-light: #f8f9fa;
    --joinet-gray: #e9ecef;
    --joinet-gray-dark: #6c757d;
    --joinet-text: #333333;
    --joinet-shadow: rgba(0, 0, 0, 0.3);
}

/* Overlay del modal */
.joinet-ruleta-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: joinetRuletaFadeIn 0.3s ease;
}

.joinet-ruleta-overlay.active {
    display: flex;
}

@keyframes joinetRuletaFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal principal */
.joinet-ruleta-modal {
    position: relative;
    background: var(--joinet-white);
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--joinet-shadow);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: joinetRuletaSlideUp 0.4s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

/* Botón de cerrar */
.joinet-ruleta-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: var(--joinet-gray-dark);
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.joinet-ruleta-close:hover {
    background: var(--joinet-gray-light);
    color: var(--joinet-red);
    transform: rotate(90deg);
}

/* Vistas del modal */
.joinet-ruleta-view {
    padding: 40px 30px;
}

.joinet-ruleta-header {
    text-align: center;
    margin-bottom: 30px;
}

.joinet-ruleta-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--joinet-text);
    line-height: 1.3;
}

.joinet-ruleta-header p {
    margin: 0;
    font-size: 16px;
    color: var(--joinet-gray-dark);
    line-height: 1.5;
}

/* Vista de email */
.joinet-ruleta-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.joinet-ruleta-wheel-preview {
    width: 200px;
    height: 200px;
    animation: joinetRuletaPulse 2s ease-in-out infinite;
}

@keyframes joinetRuletaPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.joinet-ruleta-preview-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Formulario */
.joinet-ruleta-form {
    max-width: 400px;
    margin: 0 auto;
}

.joinet-ruleta-input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.joinet-ruleta-input-group input[type="email"] {
    width: 100%;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid var(--joinet-gray);
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.joinet-ruleta-input-group input[type="email"]:focus {
    border-color: var(--joinet-red);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Botones */
.joinet-ruleta-btn,
.joinet-ruleta-btn-secondary {
    width: 100%;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    box-sizing: border-box;
}

.joinet-ruleta-btn {
    background: linear-gradient(135deg, var(--joinet-red) 0%, var(--joinet-red-dark) 100%);
    color: var(--joinet-white);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.joinet-ruleta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.joinet-ruleta-btn:active {
    transform: translateY(0);
}

.joinet-ruleta-btn-secondary {
    background: var(--joinet-gray-light);
    color: var(--joinet-text);
}

.joinet-ruleta-btn-secondary:hover {
    background: var(--joinet-gray);
}

.joinet-ruleta-privacy {
    text-align: center;
    font-size: 12px;
    color: var(--joinet-gray-dark);
    margin: 0;
    line-height: 1.5;
}

/* Error message */
.joinet-ruleta-error {
    padding: 12px 20px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
}

/* Vista de la ruleta */
.joinet-ruleta-wheel-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    aspect-ratio: 1;
}

/* Puntero de la ruleta */
.joinet-ruleta-pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid var(--joinet-red);
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Canvas de la ruleta */
#joinet-ruleta-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Botón de girar */
.joinet-ruleta-spin-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--joinet-red) 0%, var(--joinet-red-dark) 100%);
    color: var(--joinet-white);
    font-size: 18px;
    font-weight: 700;
    border: 6px solid var(--joinet-white);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 11;
}

.joinet-ruleta-spin-button:hover:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.joinet-ruleta-spin-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.joinet-ruleta-spin-button.spinning {
    pointer-events: none;
}

/* Vista de resultado */
.joinet-ruleta-result-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: joinetRuletaBounce 0.6s ease;
}

@keyframes joinetRuletaBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.joinet-ruleta-result-content {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--joinet-gray-light);
    border-radius: 12px;
}

#joinet-ruleta-result-message {
    font-size: 18px;
    line-height: 1.6;
    color: var(--joinet-text);
    margin-bottom: 20px;
}

/* Display del cupón */
.joinet-ruleta-coupon-display {
    margin-top: 25px;
}

.joinet-ruleta-coupon-display p {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--joinet-gray-dark);
}

.joinet-ruleta-coupon-code {
    background: var(--joinet-white);
    border: 3px dashed var(--joinet-red);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--joinet-red);
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.joinet-ruleta-coupon-code.copied {
    animation: joinetRuletaCopied 0.5s ease;
}

@keyframes joinetRuletaCopied {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        background: #d4edda;
    }
}

/* Acciones del resultado */
.joinet-ruleta-result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Responsive */
@media (max-width: 640px) {
    .joinet-ruleta-modal {
        width: 95%;
        border-radius: 15px;
    }

    .joinet-ruleta-view {
        padding: 30px 20px;
    }

    .joinet-ruleta-header h2 {
        font-size: 24px;
    }

    .joinet-ruleta-header p {
        font-size: 14px;
    }

    .joinet-ruleta-wheel-preview {
        width: 150px;
        height: 150px;
    }

    .joinet-ruleta-input-group input[type="email"],
    .joinet-ruleta-btn,
    .joinet-ruleta-btn-secondary {
        padding: 12px 20px;
        font-size: 14px;
    }

    .joinet-ruleta-spin-button {
        width: 80px;
        height: 80px;
        font-size: 16px;
    }

    .joinet-ruleta-coupon-code {
        font-size: 20px;
        padding: 15px;
    }

    .joinet-ruleta-result-icon {
        font-size: 60px;
    }

    #joinet-ruleta-result-message {
        font-size: 16px;
    }
}

/* Animación de carga */
.joinet-ruleta-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--joinet-white);
    animation: joinetRuletaSpin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes joinetRuletaSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Prevención de scroll del body cuando el modal está abierto */
body.joinet-ruleta-no-scroll {
    overflow: hidden;
}
