/* Load Vazirmatn Standard Font */
/*@import url('https://googleapis.com');*/

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    overflow-x: hidden; 
}

#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    overflow: hidden; 
}

body {
    font-family: IRANSans, sans-serif;
    background-color: #020617;
    color: #ffffff;
    min-height: 100vh;
    /* padding: 2rem 1rem; */
	padding-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    direction: rtl;
}

button, textarea{
	font-family: IRANSans;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(2, 6, 23, 0.88);
    backdrop-filter: blur(12px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    overflow: hidden;
}

.popup-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.popup-gradient-border {
    background: linear-gradient(135deg, #fbbf24, #ea580c, #ef4444, #fbbf24);
    background-size: 300% 300%;
    padding: 3px;
    border-radius: 2.5rem;
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.25), 0 0 80px rgba(234, 88, 12, 0.15);
    animation: gradientMove 6s ease infinite;
    transform: scale(0.6) translateY(-40px);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 90%;
    width: 480px;
    position: relative;
}

.popup-overlay.show .popup-gradient-border {
    transform: scale(1) translateY(0);
}

.popup-content {
    background: linear-gradient(180deg, #111827, #070a12);
    border-radius: 2.3rem;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.popup-close-btn {
    position: absolute;
    top: 1.2rem;
    left: 1.5rem;
    background: none;
    border: none;
    color: #4b5563;
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}
.popup-close-btn:hover {
    color: #ef4444;
    transform: scale(1.1);
}

.popup-badge {
    display: inline-block;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.35rem 1.2rem;
    border-radius: 9999px;
    margin-bottom: 1.5rem;
}

.popup-icon {
    font-size: 5.5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 15px rgba(251, 191, 36, 0.5));
    animation: popIcon 1.2s infinite alternate ease-in-out;
}

.popup-title {
    font-size: 1.15rem;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 2rem;
}

.popup-name {
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffffff;
    background: linear-gradient(135deg, #ffffff 30%, #fef08a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
    background-color: #030712;
    padding: 1.2rem 2rem;
    border-radius: 1.8rem;
    border: 1px solid rgba(251, 191, 36, 0.25);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8), 0 10px 20px rgba(0, 0, 0, 0.4);
    word-break: break-all;
    line-height: 1.2;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes popIcon {
    0% { transform: scale(0.95) rotate(-3deg); }
    100% { transform: scale(1.08) rotate(3deg); }
}

.main-header {
    text-align: center;
    margin-bottom: 2rem;
}
.main-header h1 {
    font-size: 2.2rem;
    font-weight: 900;
    color: #fbbf24;
    margin-bottom: 0.5rem;
}
.main-header p { color: #94a3b8; font-size: 0.85rem; }

.main-container {
    width: 100%;
    max-width: 1280px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel-wheel { order: 1; }
.panel-action-btn { order: 2; width: 100%; }
.panel-winners { order: 3; }  
.panel-settings { order: 4; } 

.hidden-panel {
    display: none !important;
}

@media (min-width: 1024px) {
    .main-container {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 2rem;
    }
    .panel-settings { grid-column: 1; grid-row: 1; order: unset; }
    .panel-wheel { grid-column: 2; grid-row: 1; order: unset; }
    
    .panel-winners.hidden-panel, .panel-winners { 
        display: flex !important; 
        grid-column: 3; 
        grid-row: 1 / span 2; 
        order: unset; 
    }
    
    .panel-action-btn { grid-column: 1; grid-row: 2; order: unset; }
    .main-header h1 { font-size: 2.5rem; }
    .main-header p { font-size: 0.9rem; }
}

.card {
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.card h2 {
    /* font-size: 1.25rem; */
    font-size: 1.1rem;
    font-weight: 700;
    color: #fbbf24;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 0.5rem;
}
.input-group { display: flex; flex-direction: column; gap: 0.5rem; }
.input-group label { font-size: 0.875rem; color: #cbd5e1; }
.input-group textarea {
    width: 100%; padding: 0.75rem; background-color: #020617;
    border: 1px solid #334155; border-radius: 1rem; color: #ffffff;
    font-size: 0.875rem; resize: vertical; outline: none;
}
.input-group input[type="number"] {
    width: 100%; padding: 0.75rem; background-color: #020617;
    border: 1px solid #334155; border-radius: 1rem; color: #ffffff;
    font-size: 1.25rem; font-weight: 700; text-align: center; outline: none;
}
.help-text { font-size: 0.75rem; color: #64748b; }
.help-text span { color: #fbbf24; }

/* ==========================================
   Modern Toggle Switch Style
   ========================================== */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #020617;
    padding: 10px 15px;
    border-radius: 1rem;
    border: 1px solid #334155;
    transition: all 0.3s ease;
}
.toggle-group:hover {
    border-color: #fbbf24;
}
.toggle-label {
    font-size: 0.85rem;
    color: #cbd5e1;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #475569;
    transition: 0.4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    right: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}
input:checked + .slider:before {
    transform: translateX(-20px);
}
/* ========================================== */

.btn-spin {
    width: 100%;
    background: linear-gradient(to right, #f59e0b, #ea580c);
    color: #020617; font-weight: 900; font-size: 1.25rem;
    padding: 1rem; border: none; border-radius: 1rem; cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(234, 88, 12, 0.2);
    transition: all 0.2s;
}
.btn-spin:hover { transform: scale(1.02); filter: brightness(1.1); }
.btn-spin:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* =========================================================
   استایل تمیز، مدرن و خوانا برای گردونه
   ========================================================= */
.panel-wheel { 
    align-items: center; 
    justify-content: center; 
    position: relative; 
    padding: 1.5rem;
}

/* فریم دور گردونه: ساده، شیک با سایه نرم */
.wheel-wrapper {
    position: relative; 
    width: 330px; 
    height: 330px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    background-color: #0f172a; 
    border-radius: 50%; 
    border: 6px solid #1e293b;
    box-shadow: 
        0 0 0 6px #334155, 
        0 20px 40px rgba(0, 0, 0, 0.5);
}

/* عقربه: برجسته و با رنگ طلایی کلاسیک */
.wheel-pointer {
    position: absolute; 
    top: -5px; 
    z-index: 20; 
    width: 0; 
    height: 0;
    border-left: 18px solid transparent; 
    border-right: 18px solid transparent;
    border-top: 32px solid #fbbf24;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

#wheelCanvas { 
    border-radius: 50%; 
    transition: transform 4s cubic-bezier(0.1, 0.8, 0.1, 1); 
}

.status-box {
    margin-top: 1.5rem; font-size: 0.875rem; font-weight: 700;
    color: #94a3b8; background-color: #020617; padding: 0.5rem 1rem;
    border-radius: 9999px; border: 1px solid #1e293b;
}

.winners-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #1e293b; padding-bottom: 0.5rem; }
.winners-header h2 { color: #10b981; }

.winners-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Elegant Action Buttons */
.btn-export { font-size: 0.75rem; background-color: #1e293b; color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); padding: 0.35rem 0.75rem; border-radius: 0.75rem; cursor: pointer; transition: all 0.2s; font-weight: 700; }
.btn-export:hover { background-color: #fbbf24; color: #020617; }
.btn-clear { font-size: 0.75rem; background-color: #1e293b; color: #cbd5e1; border: 1px solid #334155; padding: 0.35rem 0.75rem; border-radius: 0.75rem; cursor: pointer; transition: background-color 0.2s; }
.btn-clear:hover { background-color: #991b1b; color: #fef2f2; }

/* Interactive Export Dropdown Overlay Menu */
.export-dropdown { position: relative; display: inline-block; }
.export-menu { display: none; position: absolute; top: 110%; right: 0; background-color: #111827; border: 1px solid #334155; min-width: 160px; border-radius: 0.75rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5); z-index: 50; padding: 0.25rem; }
.export-menu.show { display: block; }
.export-menu button { width: 100%; text-align: right; background: none; border: none; color: #cbd5e1; padding: 0.5rem 0.75rem; font-size: 0.75rem; cursor: pointer; border-radius: 0.5rem; font-family: 'Vazirmatn', sans-serif; }
.export-menu button:hover { background-color: #1f2937; color: #ffffff; }

.winners-list-box { display: flex; flex-direction: column; gap: 0.75rem; max-height: 380px; overflow-y: auto; }

.winner-card { 
    background-color: #020617; border: 1px solid rgba(16, 185, 129, 0.2); 
    border-right: 4px solid #10b981; padding: 0.75rem; border-radius: 0.75rem; 
    display: flex; justify-content: space-between; align-items: center;
    transition: all 0.4s ease; 
}
.winner-info { display: flex; align-items: center; gap: 0.75rem; }
.winner-num { 
    background-color: #10b981; color: #020617; font-weight: 900; 
    width: 1.5rem; height: 1.5rem; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; font-size: 0.75rem;
    transition: transform 0.3s ease;
}
.winner-name { font-weight: 700; font-size: 0.875rem; }
.btn-delete-card { background: none; border: none; color: #64748b; cursor: pointer; font-size: 0.75rem; }
.btn-delete-card:hover { color: #f87171; }
.winner-animate { animation: slideInLeft 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; opacity: 0; }

@keyframes slideInLeft { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

@keyframes flashGlow {
    0% { background-color: #020617; border-color: rgba(16, 185, 129, 0.2); }
    50% { background-color: rgba(251, 191, 36, 0.15); border-color: #fbbf24; box-shadow: 0 0 12px rgba(251, 191, 36, 0.3); }
    100% { background-color: #020617; border-color: rgba(16, 185, 129, 0.2); }
}

.winner-card .winner-num { animation: flashNum 0.6s ease-in-out; }
@keyframes flashNum { 0% { transform: scale(1); } 50% { transform: scale(1.3); background-color: #fbbf24; color: #020617; } 100% { transform: scale(1); } }

.winners-list-box::-webkit-scrollbar { width: 6px; }
.winners-list-box::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }

.action-buttons-group {
    display: flex;
    gap: 6px;
    align-items: center;
}
.btn-export-txt { background-color: #2563eb !important; color: #ffffff !important; }
.btn-export-excel { background-color: #16a34a !important; color: #ffffff !important; }
.btn-reset-all { background-color: #1e293b !important; color: #cbd5e1 !important; }
.btn-export-txt:hover { filter: brightness(1.2); }
.btn-export-excel:hover { filter: brightness(1.2); }
.btn-reset-all:hover { background-color: #991b1b !important; color: #fef2f2 !important; }

/* ==========================================
   Advanced "Delete All" Button Upgrade
   ========================================== */
.action-buttons-group .btn-clear.btn-reset-all {
    background-color: transparent !important;
    color: #f87171 !important;
    border: 1px solid rgba(248, 113, 113, 0.4) !important;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Vibrant Danger Glow on Hover */
.action-buttons-group .btn-clear.btn-reset-all:hover {
    background-color: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.4);
    transform: translateY(-1px);
}

/* Micro-interaction on click */
.action-buttons-group .btn-clear.btn-reset-all:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* =========================================================
   استایل جدید: کارت روشن، مدرن و با کنتراست بالا (ویژه مسابقات)
   ========================================================= */
.popup-gradient-border {
    background: transparent;
    padding: 0;
    transform: scale(0.7) translateY(-30px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 90%;
    width: 460px;
    position: relative;
}

.popup-overlay.show .popup-gradient-border {
    transform: scale(1) translateY(0);
}

.popup-content {
    background-color: #ffffff; /* پس‌زمینه کاملاً سفید برای حداکثر خوانایی */
    border: 4px solid #0f172a; /* حاشیه ضخیم و تیره */
    border-radius: 24px;
    padding: 3.5rem 2rem 2.5rem 2rem;
    text-align: center;
    position: relative;
    /* سایه آفست (Offset Shadow) ترند جدید طراحی */
    box-shadow: 12px 12px 0px #fbbf24; 
}

.popup-close-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-close-btn:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    transform: rotate(90deg);
}

.popup-badge {
    display: inline-block;
    background-color: #fbbf24;
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 900;
    padding: 0.5rem 1.5rem;
    border-radius: 12px;
    border: 2px solid #0f172a;
    margin-bottom: 1rem;
    box-shadow: 3px 3px 0px #0f172a;
}

.popup-icon {
    font-size: 5rem;
    margin-bottom: 0.5rem;
    animation: popBounce 1s infinite alternate cubic-bezier(0.5, 0, 0.5, 1);
}

.popup-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 1.5rem;
}

.popup-name {
    font-size: 2.6rem;
    font-weight: 950;
    color: #1d4ed8; /* رنگ آبی لاجوردی بسیار پررنگ */
    background-color: #eff6ff; /* پس‌زمینه آبی بسیار ملایم */
    border: 3px dashed #93c5fd; /* حاشیه خط‌چین جذاب */
    padding: 1.2rem 1rem;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.4;
    /* اضافه کردن سایه ملایم به خود باکس نام */
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

/* انیمیشن جهش ملایم و جذاب برای کاپ قهرمانی */
@keyframes popBounce {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-8px) scale(1.05); }
}