/* Lottery System Styles - Enhanced Version */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

/* Popup Overlay */
.lottery-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Popup Container */
.lottery-popup {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideIn 0.4s ease-out;
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close Button */
.lottery-popup-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.lottery-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Popup Header */
.lottery-popup-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    padding: 30px 40px 20px;
    text-align: center;
    border-radius: 20px 20px 0 0;
    position: relative;
    overflow: hidden;
}

.lottery-popup-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="sparkles" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.3)"/><circle cx="5" cy="5" r="0.5" fill="rgba(255,255,255,0.2)"/><circle cx="15" cy="15" r="0.5" fill="rgba(255,255,255,0.2)"/></pattern></defs><rect width="100" height="100" fill="url(%23sparkles)"/></svg>');
    opacity: 0.6;
    animation: sparkle 3s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.8; }
}

.lottery-popup-header h3 {
    font-size: 2.2em;
    margin: 0 0 10px 0;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.lottery-popup-header p {
    font-size: 1.1em;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    z-index: 1;
}

/* Popup Content */
.lottery-popup-content {
    padding: 30px 40px;
    background: white;
    border-radius: 0 0 20px 20px;
}

/* Form Styles */
.lottery-participation-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.form-group input[type="tel"] {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    text-align: center;
    direction: ltr;
}

.form-group input[type="tel"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

/* Button Styles */
.lottery-participate-btn,
.spin-btn {
    width: 100%;
    padding: 18px 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lottery-participate-btn::before,
.spin-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.lottery-participate-btn:hover::before,
.spin-btn:hover::before {
    left: 100%;
}

.lottery-participate-btn:hover,
.spin-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.lottery-participate-btn:active,
.spin-btn:active {
    transform: translateY(-1px);
}

.lottery-participate-btn:disabled,
.spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Wheel Container */
.lottery-wheel {
    text-align: center;
    margin: 30px 0;
}

.wheel-container {
    position: relative;
    display: inline-block;
    margin: 20px 0;
}

.wheel {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 8px solid #fff;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    transition: transform 4s cubic-bezier(0.23, 1, 0.32, 1);
}

.wheel.spinning {
    animation: spin 4s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(var(--rotation, 1800deg)); }
}

.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-size: 12px;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid #e74c3c;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Result Styles */
.lottery-result {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    border: 2px solid #dee2e6;
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lottery-result h4 {
    color: #2c3e50;
    margin: 0 0 15px 0;
    font-size: 1.4em;
}

.result-content {
    font-size: 1.1em;
    color: #495057;
    line-height: 1.6;
}

.result-content.winner {
    color: #27ae60;
    font-weight: 600;
}

.result-content.no-winner {
    color: #e74c3c;
}

/* Loading Animation */
.loading-anim {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

/* Success Animation */
.success-anim {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #27ae60;
    border-radius: 50%;
    margin-left: 10px;
    position: relative;
}

.success-anim::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .lottery-popup {
        margin: 10px;
        max-width: calc(100% - 20px);
        border-radius: 15px;
    }
    
    .lottery-popup-header {
        padding: 25px 20px 15px;
    }
    
    .lottery-popup-header h3 {
        font-size: 1.8em;
    }
    
    .lottery-popup-header p {
        font-size: 1em;
    }
    
    .lottery-popup-content {
        padding: 20px;
    }
    
    .wheel {
        width: 250px;
        height: 250px;
    }
    
    .wheel-segment {
        font-size: 10px;
        padding: 5px;
    }
    
    .form-group input[type="tel"] {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .lottery-participate-btn,
    .spin-btn {
        padding: 15px 25px;
        font-size: 14px;
    }
    
    .lottery-popup-close {
        top: 10px;
        left: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .lottery-popup {
        margin: 5px;
        max-width: calc(100% - 10px);
        border-radius: 12px;
    }
    
    .lottery-popup-header {
        padding: 20px 15px 10px;
    }
    
    .lottery-popup-header h3 {
        font-size: 1.5em;
    }
    
    .lottery-popup-content {
        padding: 15px;
    }
    
    .wheel {
        width: 200px;
        height: 200px;
    }
    
    .wheel-segment {
        font-size: 9px;
        padding: 3px;
    }
    
    .lottery-result {
        padding: 20px 15px;
    }
    
    .lottery-result h4 {
        font-size: 1.2em;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .lottery-popup-content {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .form-group label {
        color: #ecf0f1;
    }
    
    .form-group input[type="tel"] {
        background: #34495e;
        border-color: #4a6741;
        color: #ecf0f1;
    }
    
    .form-group input[type="tel"]:focus {
        background: #2c3e50;
        border-color: #667eea;
    }
    
    .lottery-result {
        background: linear-gradient(135deg, #34495e, #2c3e50);
        border-color: #4a6741;
    }
    
    .lottery-result h4 {
        color: #ecf0f1;
    }
    
    .result-content {
        color: #bdc3c7;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .lottery-popup,
    .lottery-popup-close,
    .lottery-participate-btn,
    .spin-btn,
    .wheel,
    .lottery-result {
        animation: none;
        transition: none;
    }
    
    .wheel.spinning {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .lottery-popup {
        border: 3px solid #000;
    }
    
    .form-group input[type="tel"] {
        border-width: 3px;
    }
    
    .lottery-participate-btn,
    .spin-btn {
        border: 2px solid #000;
    }
}

/* Print Styles */
@media print {
    .lottery-popup-overlay {
        display: none;
    }
}