/**
 * Popup Rueda de Descuento – Exit Intent y Captación Email
 * Frontend CSS - Spin Wheel Popup
 */

/* Overlay */
.psol-spin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--psol-overlay-color, rgba(0, 0, 0, 0.7));
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.psol-spin-overlay.active {
    display: flex;
    opacity: 1;
}

/* Popup Container */
.psol-spin-popup {
    position: relative;
    background: var(--psol-bg-color, #ffffff);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.psol-spin-overlay.active .psol-spin-popup {
    transform: scale(1);
    opacity: 1;
}

/* Size Variants */
.psol-spin-popup.size-small { width: 400px; }
.psol-spin-popup.size-medium { width: 550px; }
.psol-spin-popup.size-large { width: 700px; }
.psol-spin-popup.size-fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
}

/* Close Button */
.psol-spin-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 10;
}

.psol-spin-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.psol-spin-close svg {
    width: 18px;
    height: 18px;
    fill: var(--psol-text-color, #333);
}

/* Header */
.psol-spin-header {
    text-align: center;
    padding: 30px 30px 20px;
}

.psol-spin-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--psol-text-color, #333);
    margin: 0 0 10px;
    line-height: 1.2;
}

.psol-spin-subtitle {
    font-size: 16px;
    color: var(--psol-text-color, #666);
    margin: 0;
    opacity: 0.8;
}

/* Content Area */
.psol-spin-content {
    display: flex;
    flex-wrap: wrap;
    padding: 0 30px 30px;
    gap: 30px;
}

/* Wheel Container */
.psol-wheel-container {
    flex: 1;
    min-width: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.psol-wheel-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
}

.psol-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    transition: transform var(--psol-spin-duration, 5s) cubic-bezier(0.17, 0.67, 0.12, 0.99);
    box-shadow: 0 0 0 8px #fff, 0 0 0 12px var(--psol-button-color, #e91e63), 0 10px 30px rgba(0,0,0,0.3);
}

.psol-wheel canvas {
    width: 100%;
    height: 100%;
}

/* Wheel Pointer */
.psol-wheel-pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid var(--psol-button-color, #e91e63);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    z-index: 5;
}

/* Center Button */
.psol-wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--psol-button-color, #e91e63);
    color: var(--psol-button-text-color, #fff);
    border: 4px solid #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 5;
}

.psol-wheel-center:hover:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.psol-wheel-center:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Form Container */
.psol-form-container {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.psol-spin-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.psol-form-group {
    display: flex;
    flex-direction: column;
}

.psol-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--psol-text-color, #333);
    margin-bottom: 5px;
}

.psol-form-group input[type="email"],
.psol-form-group input[type="tel"] {
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.psol-form-group input:focus {
    outline: none;
    border-color: var(--psol-button-color, #e91e63);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.psol-form-group input::placeholder {
    color: #999;
}

/* Checkboxes */
.psol-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 5px;
}

.psol-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--psol-button-color, #e91e63);
}

.psol-checkbox-group label {
    font-size: 13px;
    color: var(--psol-text-color, #666);
    line-height: 1.4;
    cursor: pointer;
}

.psol-checkbox-group label a {
    color: var(--psol-button-color, #e91e63);
    text-decoration: underline;
}

/* Submit Button */
.psol-spin-btn {
    padding: 16px 32px;
    background: var(--psol-button-color, #e91e63);
    color: var(--psol-button-text-color, #fff);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    margin-top: 10px;
}

.psol-spin-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.4);
}

.psol-spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Result Screen */
.psol-result-screen {
    display: none;
    text-align: center;
    padding: 40px 30px;
}

.psol-result-screen.active {
    display: block;
}

.psol-result-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.psol-result-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--psol-text-color, #333);
    margin: 0 0 15px;
}

.psol-result-message {
    font-size: 16px;
    color: var(--psol-text-color, #666);
    margin: 0 0 25px;
    line-height: 1.5;
}

/* Coupon Display */
.psol-coupon-box {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 2px dashed var(--psol-button-color, #e91e63);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.psol-coupon-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.psol-coupon-code {
    font-size: 28px;
    font-weight: 700;
    color: var(--psol-button-color, #e91e63);
    font-family: monospace;
    letter-spacing: 2px;
    user-select: all;
}

.psol-coupon-expires {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

.psol-copy-btn {
    padding: 12px 24px;
    background: var(--psol-button-color, #e91e63);
    color: var(--psol-button-text-color, #fff);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    transition: transform 0.2s, background 0.2s;
}

.psol-copy-btn:hover {
    transform: scale(1.05);
}

.psol-copy-btn.copied {
    background: #4caf50;
}

/* Retry Button */
.psol-retry-btn {
    padding: 12px 24px;
    background: transparent;
    color: var(--psol-button-color, #e91e63);
    border: 2px solid var(--psol-button-color, #e91e63);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    transition: background 0.2s, color 0.2s;
}

.psol-retry-btn:hover {
    background: var(--psol-button-color, #e91e63);
    color: #fff;
}

/* Confetti */
.psol-confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000000;
}

/* Loading Spinner */
.psol-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: psol-spin 0.8s linear infinite;
}

@keyframes psol-spin {
    to { transform: rotate(360deg); }
}

/* Animations */
@keyframes psol-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

@keyframes psol-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.psol-animate-bounce {
    animation: psol-bounce 1s ease;
}

.psol-animate-pulse {
    animation: psol-pulse 0.5s ease infinite;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .psol-spin-popup {
        width: 95vw;
        max-height: 95vh;
    }
    
    .psol-spin-content {
        flex-direction: column;
        padding: 0 20px 20px;
    }
    
    .psol-wheel-wrapper {
        width: 220px;
        height: 220px;
    }
    
    .psol-spin-title {
        font-size: 22px;
    }
    
    .psol-spin-header {
        padding: 20px 20px 15px;
    }
    
    .psol-coupon-code {
        font-size: 22px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .psol-spin-popup.auto-theme {
        --psol-bg-color: #1e1e1e;
        --psol-text-color: #fff;
    }
}

/* Print - Hide popup */
@media print {
    .psol-spin-overlay {
        display: none !important;
    }
}
