/**
 * Persian Coupon Wheel - Modern Styles
 * Enhanced design with smooth animations and RTL support
 */

/* === Main Container === */
.pcw-container {
    direction: rtl;
    text-align: right;
    font-family: Tahoma, 'Segoe UI', Arial, sans-serif;
    max-width: 700px;
    margin: 40px auto;
    padding: 40px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow:
        0 20px 60px rgba(102, 126, 234, 0.4),
        0 10px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Animated Background Pattern */
.pcw-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
    z-index: 0;
}

@keyframes moveBackground {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* === Header Section === */
.pcw-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.pcw-title {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 15px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pcw-description {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.6;
    max-width: 90%;
    margin: 0 auto;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

/* === Wheel Container === */
.pcw-wheel-container {
    position: relative;
    width: 100%;
    max-width: 450px;
    margin: 0 auto 50px;
    z-index: 2;
    animation: fadeInScale 0.8s ease-out 0.3s both;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Glow Effect Around Wheel */
.pcw-wheel-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 110%;
    height: 110%;
    background: radial-gradient(circle,
        rgba(255, 215, 0, 0.4) 0%,
        rgba(255, 215, 0, 0.2) 30%,
        transparent 70%);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
}

.pcw-wheel-canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    border-radius: 50%;
    border: 8px solid #FFD700;
    box-shadow:
        0 0 30px rgba(255, 215, 0, 0.6),
        0 10px 40px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(255, 215, 0, 0.2);
    transition: transform 0.3s ease;
}

.pcw-wheel-canvas:hover {
    transform: scale(1.02);
}

/* === Form Container === */
.pcw-form-container {
    max-width: 400px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    animation: fadeInUp 0.8s ease-out 0.5s both;
}

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

.pcw-form-group {
    margin-bottom: 20px;
}

.pcw-form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #fff;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.pcw-form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 16px;
    direction: rtl;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.pcw-form-group input:focus {
    outline: none;
    border-color: #FFD700;
    background: #fff;
    box-shadow:
        0 0 0 4px rgba(255, 215, 0, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* === Welcome Message === */
.pcw-welcome-message {
    text-align: center;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    margin-bottom: 25px;
    font-size: 17px;
    font-weight: 600;
    color: #667eea;
    border: 2px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* === Spin Button === */
.pcw-spin-button {
    display: block;
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    border: none;
    border-radius: 50px;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    box-shadow:
        0 8px 20px rgba(255, 165, 0, 0.4),
        0 4px 10px rgba(0, 0, 0, 0.2),
        inset 0 -2px 0 rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

.pcw-spin-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.pcw-spin-button:hover::before {
    left: 100%;
}

.pcw-spin-button:hover {
    background: linear-gradient(135deg, #FFA500 0%, #FFD700 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 12px 30px rgba(255, 165, 0, 0.5),
        0 6px 15px rgba(0, 0, 0, 0.25);
}

.pcw-spin-button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow:
        0 5px 15px rgba(255, 165, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.2);
}

.pcw-spin-button:disabled {
    background: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Loading State */
.pcw-spin-button.loading {
    pointer-events: none;
    color: transparent;
}

.pcw-spin-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(51, 51, 51, 0.3);
    border-radius: 50%;
    border-top-color: #333;
    animation: spin 0.8s linear infinite;
}

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

/* === Result Container === */
.pcw-result-container {
    display: none;
    margin-top: 50px;
    text-align: center;
    padding: 35px 30px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 20px;
    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.2),
        inset 0 0 0 3px rgba(255, 215, 0, 0.5);
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    z-index: 5;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.pcw-result-title {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.pcw-result-message {
    font-size: 20px;
    color: #555;
    margin-bottom: 30px;
    line-height: 1.6;
    font-weight: 500;
}

/* === Coupon Code === */
.pcw-coupon-container {
    padding: 20px 30px;
    background: #fff;
    border: 3px dashed #FFD700;
    border-radius: 15px;
    margin: 0 auto 30px;
    max-width: 280px;
    position: relative;
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px rgba(255, 215, 0, 0.3);
    animation: wiggle 0.5s ease-in-out 0.3s;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

/* Coupon Holes */
.pcw-coupon-container::before,
.pcw-coupon-container::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.pcw-coupon-container::before {
    left: -12px;
}

.pcw-coupon-container::after {
    right: -12px;
}

.pcw-coupon-code {
    font-size: 24px !important;
    font-weight: 800;
    color: #667eea;
    letter-spacing: 2px;
    display: block;
    padding: 12px 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    user-select: all;
    cursor: copy;
    direction: ltr;
    text-align: center;
    font-family: 'Courier New', monospace;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.pcw-coupon-code:hover {
    background: #fff;
    border-color: #FFD700;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

/* === Try Again Button === */
.pcw-try-again {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.3);
}

.pcw-try-again:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.pcw-try-again:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* === Messages === */
.pcw-message {
    display: none;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
    animation: slideDown 0.4s ease-out;
}

.pcw-message.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.pcw-message.success {
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* === Popup Styles === */
.pcw-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

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

.pcw-popup-container {
    background: #fff;
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    direction: rtl;
    text-align: right;
    animation: popupSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.pcw-popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pcw-popup-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.pcw-popup-close {
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.9;
}

.pcw-popup-close:hover {
    transform: scale(1.2) rotate(90deg);
    opacity: 1;
}

.pcw-popup-content {
    padding: 30px 25px;
}

.pcw-popup-submit {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(255, 165, 0, 0.3);
}

.pcw-popup-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 165, 0, 0.4);
}

/* === Login Required === */
.pcw-login-required {
    text-align: center;
    padding: 25px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.pcw-login-button,
.pcw-register-button {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 700;
    margin: 10px 5px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.pcw-login-button {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.pcw-register-button {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.pcw-login-button:hover,
.pcw-register-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .pcw-container {
        padding: 30px 20px;
        margin: 20px auto;
    }

    .pcw-title {
        font-size: 26px;
    }

    .pcw-description {
        font-size: 16px;
    }

    .pcw-wheel-container {
        max-width: 350px;
    }

    .pcw-form-container {
        max-width: 100%;
    }

    .pcw-result-title {
        font-size: 26px;
    }

    .pcw-result-message {
        font-size: 17px;
    }

    .pcw-coupon-code {
        font-size: 20px !important;
    }
}

@media (max-width: 480px) {
    .pcw-container {
        padding: 25px 15px;
    }

    .pcw-wheel-container {
        max-width: 300px;
    }

    .pcw-spin-button {
        padding: 15px 20px;
        font-size: 18px;
    }

    .pcw-result-container {
        padding: 25px 20px;
    }

    .pcw-coupon-code {
        font-size: 18px !important;
    }

    .pcw-popup-container {
        width: 95%;
    }
}
