@font-face {
    font-family: 'Estedad';
    src: url('../fonts/Estedad-FD-Thin.woff2') format('woff2');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Estedad';
    src: url('../fonts/Estedad-FD-ExtraLight.woff2') format('woff2');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Estedad';
    src: url('../fonts/Estedad-FD-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Estedad';
    src: url('../fonts/Estedad-FD-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Estedad';
    src: url('../fonts/Estedad-FD-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Estedad';
    src: url('../fonts/Estedad-FD-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Estedad';
    src: url('../fonts/Estedad-FD-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Estedad';
    src: url('../fonts/Estedad-FD-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* ===================== متغیرهای پایه (حالت روشن) ===================== */
:root {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --text: #1f2933;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --input-bg: #ffffff;
    --shadow: 0 10px 30px rgba(15, 23, 42, .08);
    --radius: 16px;
    --success-bg: #ecfdf5;
    --success-text: #059669;
    --error-bg: #fef2f2;
    --error-text: #dc2626;

    /* پیش‌فرض تم رنگی: آبی */
    --c-primary: #2563eb;
    --c-primary-dark: #1d4ed8;
    --c-primary-light: #93c5fd;
    --c-grad-1: #3b82f6;
    --c-grad-2: #1e40af;
}

/* ===================== حالت تیره - فورس شده از پنل مدیریت ===================== */
[data-mode="dark"] {
    --bg: #0f1115;
    --surface: #1a1d24;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #2d313b;
    --input-bg: #23262e;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --success-bg: #052e21;
    --success-text: #34d399;
    --error-bg: #2e0a0a;
    --error-text: #f87171;
}

/* ===================== حالت خودکار: تابع تنظیمات سیستم/مرورگر ===================== */
@media (prefers-color-scheme: dark) {
    html[data-mode="auto"] {
        --bg: #0f1115;
        --surface: #1a1d24;
        --text: #f3f4f6;
        --text-muted: #9ca3af;
        --border: #2d313b;
        --input-bg: #23262e;
        --shadow: 0 10px 30px rgba(0, 0, 0, .45);
        --success-bg: #052e21;
        --success-text: #34d399;
        --error-bg: #2e0a0a;
        --error-text: #f87171;
    }
}

/* ===================== تم‌های رنگی ===================== */
[data-color="blue"]   { --c-primary:#2563eb; --c-primary-dark:#1d4ed8; --c-primary-light:#93c5fd; --c-grad-1:#3b82f6; --c-grad-2:#1e40af; }
[data-color="green"]  { --c-primary:#16a34a; --c-primary-dark:#15803d; --c-primary-light:#86efac; --c-grad-1:#22c55e; --c-grad-2:#166534; }
[data-color="purple"] { --c-primary:#7c3aed; --c-primary-dark:#6d28d9; --c-primary-light:#c4b5fd; --c-grad-1:#8b5cf6; --c-grad-2:#5b21b6; }
[data-color="orange"] { --c-primary:#ea580c; --c-primary-dark:#c2410c; --c-primary-light:#fdba74; --c-grad-1:#f97316; --c-grad-2:#9a3412; }
[data-color="red"]    { --c-primary:#dc2626; --c-primary-dark:#b91c1c; --c-primary-light:#fca5a5; --c-grad-1:#ef4444; --c-grad-2:#991b1b; }
[data-color="teal"]   { --c-primary:#0d9488; --c-primary-dark:#0f766e; --c-primary-light:#5eead4; --c-grad-1:#14b8a6; --c-grad-2:#115e59; }
[data-color="pink"]   { --c-primary:#db2777; --c-primary-dark:#be185d; --c-primary-light:#f9a8d4; --c-grad-1:#ec4899; --c-grad-2:#9d174d; }
[data-color="amber"]  { --c-primary:#d97706; --c-primary-dark:#b45309; --c-primary-light:#fcd34d; --c-grad-1:#f59e0b; --c-grad-2:#92400e; }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Estedad', Tahoma, sans-serif;
    transition: background .25s ease, color .25s ease;
}

body.event-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px;
}

.event-card {
    width: 100%;
    max-width: 460px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: auto 0;
    border: 1px solid var(--border);
}

/* بنر با نسبت تصویر 5:2 */
.event-banner {
    width: 100%;
    aspect-ratio: 5 / 2;
    background: linear-gradient(135deg, var(--c-grad-1), var(--c-grad-2));
    overflow: hidden;
    position: relative;
}

.event-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.event-body {
    padding: 18px 20px 20px;
}

.event-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 4px;
    color: var(--text);
    line-height: 1.5;
    text-align: center;
}

.event-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.7;
    text-align: center;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}

.form-group input:focus {
    border-color: var(--c-primary);
}

.form-group .err-msg {
    display: none;
    color: var(--error-text);
    font-size: 11.5px;
    margin-top: 4px;
}

.form-group.has-error input {
    border-color: var(--error-text);
}

.form-group.has-error .err-msg {
    display: block;
}

/* هانی‌پات - مخفی از دید کاربر واقعی */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px; height: 1px;
    opacity: 0;
    pointer-events: none;
}

.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 14px;
}

.captcha-row .captcha-q {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    color: var(--text);
}

.captcha-row input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}

.btn-submit {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--c-grad-1), var(--c-grad-2));
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .1s, opacity .2s;
}

.btn-submit:active { transform: scale(.98); }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; }

.form-note {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* پیام نتیجه (موفقیت/خطا) */
.result-box {
    padding: 34px 20px;
    text-align: center;
    display: none;
}

.result-box.show { display: block; }
.event-form.hide { display: none; }

.result-icon {
    width: 62px; height: 62px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
    font-size: 30px;
}

.result-icon.success { background: var(--success-bg); color: var(--success-text); }
.result-icon.error { background: var(--error-bg); color: var(--error-text); }

.result-title { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.result-desc { font-size: 13px; color: var(--text-muted); line-height: 1.8; }

.lottery-code-box {
    margin-top: 18px;
    background: var(--bg);
    border: 2px dashed var(--c-primary);
    border-radius: 12px;
    padding: 14px 16px;
}

.lottery-code-label {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.lottery-code-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--c-primary);
    direction: ltr;
}

.top-level-alert {
    width: 100%;
    max-width: 460px;
    background: var(--error-bg);
    color: var(--error-text);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 10px;
    text-align: center;
}

footer.site-footer {
    margin-top: 14px;
    text-align: center;
    font-size: 10.5px;
    color: var(--text-muted);
    opacity: .8;
    padding-bottom: 6px;
    width: 100%;
    max-width: 460px;
}

@media (min-height: 750px) {
    body.event-page { justify-content: center; }
}
