/* UI font — Kalameh only on global CSS (Yekan loaded on disc/eq pages that need tabular nums) */
/* block + <link rel=preload> = first paint uses Kalameh (no fallback→swap flash). */
@font-face {
    font-family: 'Kalameh';
    src: url('/fonts/KALAMEHWEBFANUM.woff2') format('woff2'),
         url('/fonts/KALAMEHWEBFANUM.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: 'Kalameh';
    src: url('/fonts/KALAMEHWEB-BLACK.woff2') format('woff2'),
         url('/fonts/KALAMEHWEB BLACK.TTF') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: block;
}

/* فونت ایران سنس - غیرفعال شده */
/*
@font-face {
    font-family: 'Iranian Sans';
    src: url('/fonts/Iranian Sans.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
*/

/* فونت آرتین - غیرفعال شده */
/*
@font-face {
    font-family: 'ArtinSharp';
    src: url('/fonts/ArtinSharp-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'ArtinSharp';
    src: url('/fonts/ArtinSharp-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'ArtinSharp';
    src: url('/fonts/ArtinSharp-Light.woff') format('woff');
    font-weight: 300;
    font-style: normal;
}
*/

:root {
    /* تم روشن — شامپاین برند + طلای خوانا (نه کرم فلت AI / نه بنفش) */
    color-scheme: light;
    --bg-base: #f0e9dc;
    --bg-gradient-1: linear-gradient(148deg, #f6efe3 0%, #eee5d4 44%, #e5dccb 100%);
    --bg-gradient-2: linear-gradient(138deg, #f8f2e7 0%, #ebe2d1 52%, #e0e7e4 100%);
    --bg-gradient-3: linear-gradient(162deg, #e8e0d0 0%, #f3ece0 48%, #e4ddd0 100%);

    --glass-bg: rgba(250, 244, 232, 0.92);
    --glass-border: rgba(160, 120, 42, 0.40);
    --glass-shadow: 0 12px 30px rgba(55, 38, 12, 0.10);
    --glass-highlight: rgba(201, 162, 55, 0.16);

    --text-primary: #1a1510;
    --text-secondary: #3a3329;
    --text-muted: rgba(26, 21, 16, 0.70);
    --text-heading: #100e0a;
    --text-on-gold: #1a160f;
    --gold-ink: #7a5618;

    --primary-color: #dab25d;
    --primary-hover: #c49d4a;
    --primary-soft: rgba(201, 162, 55, 0.18);
    --success-color: #10b981;
    --error-color: #ef4444;

    --input-bg: #faf4e8;
    --input-border: rgba(150, 112, 40, 0.36);
    --input-focus: rgba(201, 162, 55, 0.42);
    --radius-lux: 18px;

    /* Spacing + type scale (shared public surfaces) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 22px;
    --space-6: 28px;
    --space-7: 36px;
    --text-xs: 0.78rem;
    --text-sm: 0.88rem;
    --text-md: 1rem;
    --text-lg: clamp(1.05rem, 2vw, 1.2rem);
    --text-xl: clamp(1.28rem, 2.6vw, 1.65rem);
    --text-2xl: clamp(1.45rem, 3.2vw, 2.1rem);
    --leading-body: 1.85;
    --leading-tight: 1.4;

    /* Native <select>: opaque surfaces (rgba washes out / OS popup stays light) */
    --select-bg: #faf4e8;
    --select-option-bg: #faf4e8;
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231a1510' d='M1.41.59 6 5.17 10.59.59 12 2 6 8 0 2z'/%3E%3C/svg%3E");
}

[data-theme="light"] {
    color-scheme: light;
    --bg-base: #f0e9dc;
    --bg-gradient-1: linear-gradient(148deg, #f6efe3 0%, #eee5d4 44%, #e5dccb 100%);
    --bg-gradient-2: linear-gradient(138deg, #f8f2e7 0%, #ebe2d1 52%, #e0e7e4 100%);
    --bg-gradient-3: linear-gradient(162deg, #e8e0d0 0%, #f3ece0 48%, #e4ddd0 100%);
    --glass-bg: rgba(250, 244, 232, 0.92);
    --glass-border: rgba(160, 120, 42, 0.40);
    --glass-shadow: 0 12px 30px rgba(55, 38, 12, 0.10);
    --glass-highlight: rgba(201, 162, 55, 0.16);
    --text-primary: #1a1510;
    --text-secondary: #3a3329;
    --text-muted: rgba(26, 21, 16, 0.70);
    --text-heading: #100e0a;
    --text-on-gold: #1a160f;
    --gold-ink: #7a5618;
    --primary-soft: rgba(201, 162, 55, 0.18);
    --input-bg: #faf4e8;
    --input-border: rgba(150, 112, 40, 0.36);
    --input-focus: rgba(201, 162, 55, 0.42);
    --select-bg: #faf4e8;
    --select-option-bg: #faf4e8;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-base: #071c1e;
    --bg-gradient-1: linear-gradient(155deg, #0a2d30 0%, #0c3438 42%, #051416 100%);
    --bg-gradient-2: linear-gradient(140deg, #12383c 0%, #0a2d30 50%, #041012 100%);
    --bg-gradient-3: linear-gradient(165deg, #051a1c 0%, #0e383c 48%, #0a2d30 100%);

    --glass-bg: rgba(12, 48, 52, 0.48);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 14px 44px rgba(0, 0, 0, 0.45);
    --glass-highlight: rgba(218, 178, 93, 0.12);

    --text-primary: #f3f1ec;
    --text-secondary: #ebe6dc;
    --text-muted: rgba(243, 241, 236, 0.78);
    --text-heading: #fffaf0;
    --text-on-gold: #1a160f;

    --primary-soft: rgba(218, 178, 93, 0.18);
    --input-bg: rgba(8, 36, 39, 0.55);
    --input-border: rgba(255, 255, 255, 0.12);
    --input-focus: rgba(218, 178, 93, 0.35);

    --select-bg: #0c3438;
    --select-option-bg: #0e2e32;
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23f3f1ec' d='M1.41.59 6 5.17 10.59.59 12 2 6 8 0 2z'/%3E%3C/svg%3E");
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kalameh', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* فونت یکان برای اعداد */
@supports (font-variant-numeric: tabular-nums) {
    * {
        font-variant-numeric: tabular-nums;
    }
}

/* اعمال فونت یکان برای اعداد در همه جا */
input[type="number"],
input[type="tel"],
.stat-value,
.numeric-code,
.quiz-page-counter,
.count,
.number,
td,
th,
.otp-input,
#otp-input {
    font-family: 'Kalameh', 'Yekan', 'Segoe UI', sans-serif !important;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* فونت یکان برای کلاس‌هایی که شامل count یا number هستند */
[class*="count"],
[class*="number"] {
    font-family: 'Kalameh', 'Yekan', 'Segoe UI', sans-serif !important;
    font-variant-numeric: tabular-nums;
}

body {
    font-family: 'Kalameh', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-top: var(--site-header-offset, 72px); /* fixed header + logo overhang */
    background: var(--bg-base);
    background-image: var(--bg-gradient-1);
    transition: background 0.5s ease, background-image 0.5s ease;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.18;
    animation: float 26s infinite ease-in-out;
    transition: opacity 0.5s ease;
}

/* اتمسفر نرم در تم تیره — بدون glow افراطی */
[data-theme="dark"] .gradient-orb {
    opacity: 0.38;
}

/* تم روشن: اورب طلایی–شامپاین، عمق ملایم بدون لکه */
[data-theme="light"] .gradient-orb {
    opacity: 0.34;
    filter: blur(110px);
}
[data-theme="light"] .orb-1 {
    background: radial-gradient(circle, rgba(201, 162, 55, 0.38), transparent 72%);
}
[data-theme="light"] .orb-2 {
    background: radial-gradient(circle, rgba(160, 120, 42, 0.26), transparent 70%);
}
[data-theme="light"] .orb-3 {
    background: radial-gradient(circle, rgba(180, 200, 190, 0.16), transparent 68%);
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: var(--bg-gradient-2);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--bg-gradient-3);
    bottom: -150px;
    right: -150px;
    animation-delay: 5s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: var(--bg-gradient-1);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* Glass Morphism — refined luxury */
.glass-card {
    background:
        linear-gradient(165deg, var(--glass-highlight), transparent 42%),
        var(--glass-bg);
    backdrop-filter: blur(14px) saturate(1.12);
    -webkit-backdrop-filter: blur(14px) saturate(1.12);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lux, 18px);
}

[data-theme="light"] .glass-card {
    backdrop-filter: blur(12px) saturate(1.08);
    -webkit-backdrop-filter: blur(12px) saturate(1.08);
    box-shadow:
        var(--glass-shadow),
        inset 0 1px 0 rgba(255, 250, 240, 0.88),
        inset 0 0 0 1px rgba(201, 162, 55, 0.06);
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 40px 20px;
    padding-bottom: 100px !important; /* فاصله برای ناوبری موبایل */
}

/* Logo */
.logo-container {
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease;
}

.logo {
    height: 120px;
    width: auto;
    max-width: 300px;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.3));
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* لوگو در تم روشن */
:root .logo,
[data-theme="light"] .logo {
    filter: drop-shadow(0 6px 16px rgba(72, 52, 20, 0.10));
}

/* لوگو در تم تیره */
[data-theme="dark"] .logo {
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.3));
}

/* Login Box */
.login-box {
    width: 100%;
    max-width: 450px;
    padding: 40px;
    animation: fadeInUp 0.8s ease;
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #c49d4a, #dab25d, #e8c97a);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 100% 0;
    }
}

/* Step Indicator */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 20px 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.step.active {
    opacity: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.step.active .step-number {
    background: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(218, 178, 93, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(218, 178, 93, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(218, 178, 93, 0.8);
    }
}

.step-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.step-line {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 10px;
    position: relative;
    top: -20px;
}

/* Form Steps */
.form-step {
    animation: fadeIn 0.5s ease;
}

.form-step.active {
    display: block;
}

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

h1 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-heading);
    font-size: 32px;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-family: 'Kalameh', sans-serif;
}

h2 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--text-heading);
    font-size: 28px;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-family: 'Kalameh', sans-serif;
}

h3 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--text-heading);
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-family: 'Kalameh', sans-serif;
}

[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3 {
    text-shadow: none;
}

p {
    color: var(--text-primary);
    line-height: 1.6;
    font-family: 'Kalameh', sans-serif;
}

.subtitle {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 30px;
    font-size: 15px;
    line-height: 1.6;
    opacity: 0.95;
    font-family: 'Kalameh', sans-serif;
}

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

label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    opacity: 0.95;
    font-family: 'Kalameh', sans-serif;
}

.input-wrapper {
    position: relative;
}

input[type="tel"],
input[type="text"] {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 16px;
    font-family: 'Kalameh', sans-serif;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

/* Global native <select> — dark glass/gold + readable option list */
select {
    color: var(--text-primary);
    background-color: var(--select-bg, var(--input-bg));
    background-image: var(--select-chevron);
    background-repeat: no-repeat;
    background-size: 12px 8px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    font-family: 'Kalameh', sans-serif;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    color-scheme: inherit;
}

html[dir="rtl"] select,
select {
    background-position: left 0.85rem center;
    padding-left: 2.35rem;
    padding-right: 0.9rem;
}

html[dir="ltr"] select {
    background-position: right 0.85rem center;
    padding-right: 2.35rem;
    padding-left: 0.9rem;
}

select option,
select optgroup {
    background-color: var(--select-option-bg, var(--select-bg));
    color: var(--text-primary);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
}

select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

select::-ms-expand {
    display: none;
}

input[type="tel"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--input-focus);
    background: var(--input-bg);
    box-shadow: 0 0 20px rgba(218, 178, 93, 0.3);
    transform: translateY(-2px);
}

input::placeholder {
    color: var(--text-muted);
}

/* OTP Input */
.otp-input-container {
    position: relative;
}

#otp {
    text-align: center;
    font-size: 24px;
    letter-spacing: 10px;
    font-weight: 700;
    padding: 20px;
}

.otp-timer {
    margin-top: 15px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.resend-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: 13px;
    padding: 5px;
    transition: color 0.3s ease;
}

.resend-btn:hover {
    color: var(--primary-hover);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: var(--text-on-gold, #1a160f);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: 'Kalameh', sans-serif;
    box-shadow: 0 4px 15px rgba(218, 178, 93, 0.4);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(218, 178, 93, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* لودر سراسری صفحه — زیر هدر (z-index هدر ≈ 1100) تا لوگو/همبرگر دیده شوند */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1100px 560px at 50% -10%, rgba(218, 178, 93, 0.2), transparent 56%),
        radial-gradient(700px 400px at 85% 110%, rgba(218, 178, 93, 0.08), transparent 50%),
        #071c1e;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.main-header {
    z-index: 1100;
}
.page-loader.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.page-loader-spinner {
    width: 46px;
    height: 46px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 3px solid rgba(218, 178, 93, 0.22);
    border-top-color: #dab25d;
    animation: pageLoaderSpin 0.75s linear infinite;
}
.page-loader-text {
    color: #f5e6c8;
    font-size: 14px;
    font-family: 'Kalameh', Tahoma, Arial, sans-serif;
}
@keyframes pageLoaderSpin {
    to { transform: rotate(360deg); }
}

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

/* Message */
.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    display: none;
    animation: slideIn 0.3s ease;
    font-family: 'Kalameh', sans-serif;
}

.message.success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    display: block;
}

.message.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: block;
}

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

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    border: none;
    padding: 0;
    overflow: hidden;
}

.theme-icon {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.theme-icon.moon-icon {
    stroke: #fbbf24;
    fill: #fbbf24;
    opacity: 1;
}

.theme-icon.sun-icon {
    stroke: #f59e0b;
    fill: #f59e0b;
    opacity: 1;
}

/* مدیریت نمایش آیکن‌ها با CSS */
[data-theme="light"] .theme-icon.moon-icon {
    display: block;
}

[data-theme="light"] .theme-icon.sun-icon {
    display: none;
}

[data-theme="dark"] .theme-icon.moon-icon {
    display: none;
}

[data-theme="dark"] .theme-icon.sun-icon {
    display: block;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
}

.theme-toggle:active {
    transform: scale(0.95);
}


/* Page */
.page {
    display: none;
    width: 100%;
    max-width: 450px;
}

.page.active {
    display: block;
    animation: fadeInUp 0.8s ease;
}

/* Welcome Content */
.welcome-content {
    width: 100%;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.welcome-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #c49d4a, #dab25d, #e8c97a, #c49d4a, transparent);
    background-size: 200% 100%;
    animation: shimmer 4.5s ease-in-out infinite;
}

/* Input Group */
.input-group {
    margin-bottom: 25px;
}

.input-group input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 16px;
    font-family: 'Kalameh', sans-serif;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.input-group input:focus {
    outline: none;
    border-color: var(--input-focus);
    background: var(--input-bg);
    box-shadow: 0 0 20px rgba(218, 178, 93, 0.3);
    transform: translateY(-2px);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

/* Primary Button — gold on deep ink (luxury CTA) */
.primary-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 22px;
    background: linear-gradient(135deg, #e2bf72 0%, var(--primary-color) 45%, var(--primary-hover) 100%);
    color: var(--text-on-gold, #1a160f);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
    position: relative;
    overflow: hidden;
    font-family: 'Kalameh', sans-serif;
    box-shadow: 0 8px 22px rgba(218, 178, 93, 0.28);
    letter-spacing: 0.01em;
}

.primary-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.28) 48%, transparent 62%);
    transform: translateX(-120%);
    transition: transform 0.55s ease;
}

.primary-btn:hover::before {
    transform: translateX(120%);
}

.primary-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
    box-shadow: 0 12px 28px rgba(218, 178, 93, 0.38);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

/* Secondary Button */
.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: 'Kalameh', sans-serif;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Error Box */
.error-box {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 300px;
    max-width: 90%;
    box-shadow: var(--glass-shadow);
    animation: slideIn 0.3s ease;
}

.error-box p {
    flex: 1;
    color: var(--text-primary);
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    font-family: 'Kalameh', sans-serif;
}

.error-box .warning-icon {
    flex-shrink: 0;
}

.error-box .error-btn {
    flex-shrink: 0;
}

.error-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
}

/* Quiz Container */
.quiz-welcome {
    padding: 15px 20px !important;
    margin-bottom: 20px;
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0;
}

.quiz-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
}

/* Header آزمون با شمارنده صفحات */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: var(--glass-shadow);
}

.quiz-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quiz-page-counter {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(218, 178, 93, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    min-width: 40px;
    text-align: center;
    font-family: 'Kalameh', Arial, sans-serif;
}

.quiz-header-right {
    display: flex;
    align-items: center;
}

.quiz-remaining-text {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Kalameh', Arial, sans-serif;
}

@media (max-width: 768px) {
    .quiz-header {
        padding: 12px 15px;
        margin-bottom: 15px;
    }
    
    .quiz-page-counter {
        font-size: 16px;
        padding: 5px 10px;
        min-width: 35px;
    }
    
    .quiz-remaining-text {
        font-size: 12px;
    }
}

.quiz-container-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.quiz-container-wrapper h2 {
    text-align: center;
    color: var(--text-heading);
    margin-bottom: 30px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.quiz-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
    padding: 0 10px;
}

.quiz-buttons button {
    flex: 1;
    max-width: 200px;
    padding: 8px 16px !important;
    font-size: 14px;
}

#name-display {
    text-align: center;
    color: var(--text-heading);
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Questions */
.question-container {
    display: none;
    animation: fadeIn 0.5s ease;
}

.question-container.active {
    display: block;
}

.q {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    font-family: 'Kalameh', sans-serif;
}

.q * {
    color: var(--text-primary) !important;
    font-family: 'Kalameh', sans-serif;
}

.q .col-title,
.q .row.header {
    color: var(--text-heading) !important;
}

.badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    font-family: 'Kalameh', sans-serif;
}

.row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.row:last-child {
    border-bottom: none;
}

.row.header {
    font-weight: 700;
    color: var(--text-heading) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    opacity: 1 !important;
}

.row.header .col-radio {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 20px;
    font-size: inherit;
    color: var(--text-heading) !important;
}

.row.header .col-title {
    text-align: right;
}

.col-title {
    color: var(--text-primary) !important;
    font-weight: 500;
    line-height: 1.6;
    opacity: 1 !important;
}

.col-radio {
    text-align: center;
}

.col-radio input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Gauges */
.gauges-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.gauge {
    text-align: center;
}

.gauge-label {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.gauge-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 10px;
}

/* Pattern Display */
.pattern-display {
    text-align: center;
    margin: 20px 0;
    font-size: 24px;
    color: var(--text-primary);
}

.pattern-code span {
    display: inline-block;
    padding: 8px 20px;
    margin: 0;
    border-radius: 8px;
    font-weight: 700;
    font-size: 18px;
}

.pattern-code {
    display: flex;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
    margin-top: 15px;
}

.pattern-code-inline {
    display: inline-flex;
    gap: 0;
    align-items: center;
}

.pattern-code span {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 18px;
}

.pattern-code span.pattern-d,
.pattern-code span.d { 
    background: linear-gradient(135deg, #ef4444, #dc2626); 
    color: white; 
}

.pattern-code span.pattern-i,
.pattern-code span.i { 
    background: linear-gradient(135deg, #fbbf24, #f59e0b); 
    color: white; 
}

.pattern-code span.pattern-s,
.pattern-code span.s { 
    background: linear-gradient(135deg, #10b981, #059669); 
    color: white; 
}

.pattern-code span.pattern-c,
.pattern-code span.c { 
    background: linear-gradient(135deg, #3b82f6, #2563eb); 
    color: white; 
}

.pattern-code span.pattern-h {
    background: linear-gradient(135deg, #c9a24a, #8a6a2e);
    color: white;
}

.numeric-code {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 15px 30px;
    display: inline-block;
    margin-top: 10px;
}

.result-pattern,
.result-numeric {
    text-align: center;
}

.gauge {
    position: relative;
    width: 150px;
    height: 75px;
    margin: 0 auto;
}

.gauge canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.gauge-label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    z-index: 2;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.gauge-value {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    z-index: 2;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* General Gauges */
.gauges-container {
    margin: 30px 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.gauges-container .gauge {
    position: relative;
    width: 220px;
    height: 160px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: visible !important;
    text-align: center;
    padding: 20px 15px 15px 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin: 0 auto;
}

.gauges-container .gauge-label {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    font-weight: bold;
    z-index: 3;
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.gauges-container .gauge canvas {
    position: absolute !important;
    top: 5px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 200px !important;
    height: 120px !important;
    z-index: 1 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.gauges-container .gauge-footer {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 3px;
    z-index: 2;
}

.gauges-container .gauge-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: static;
    transform: none;
}

.gauges-container .gauge-segment {
    font-weight: 600;
    font-size: 12px;
}

#gauge-d .gauge-label,
#gauge-d .gauge-segment { color: #fd0901; }
#gauge-i .gauge-label,
#gauge-i .gauge-segment { color: #fbff00; }
#gauge-s .gauge-label,
#gauge-s .gauge-segment { color: #36bb36; }
#gauge-c .gauge-label,
#gauge-c .gauge-segment { color: #097cff; }

/* Mobile Gauges */
@media (max-width: 768px) {
    .gauges-container {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 100%;
        padding: 15px;
    }

    .gauges-container .gauge {
        width: 100%;
        max-width: 280px;
        height: 200px;
        margin: 0 auto;
    }

    .gauges-container .gauge-label {
        font-size: 28px;
        top: 30px;
    }

    .gauges-container .gauge canvas {
        top: 10px !important;
        width: 280px !important;
        height: 140px !important;
    }

    .gauges-container .gauge-value {
        font-size: 20px;
    }

    .gauges-container .gauge-segment {
        font-size: 14px;
    }
}

.pattern-code span.h { background: #ff6600; color: white; }

.numeric-code {
    text-align: center;
    font-size: 20px;
    color: var(--text-secondary);
    margin: 15px 0;
}

/* Buttons */
.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Result Page */
#result-page {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.name-display {
    text-align: center;
    color: var(--text-heading);
    font-size: 24px;
    font-weight: 700;
    margin: 20px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.pattern-display {
    text-align: center;
    margin: 20px 0;
    font-size: 24px;
    color: var(--text-heading);
    font-weight: 600;
}

.numeric-code {
    text-align: center;
    font-size: 20px;
    color: var(--text-secondary);
    margin: 15px 0;
    font-weight: 500;
}

/* WhatsApp Info */
.whatsapp-info {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.whatsapp-info a {
    color: #25D366;
    text-decoration: none;
    font-weight: 700;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Strong and Phone Display */
strong {
    font-weight: 700;
    color: var(--text-primary);
    opacity: 1;
}

#otp-phone-display {
    color: var(--text-primary);
    font-weight: 700;
    opacity: 1;
}

/* Responsive - Mobile First */
@media (max-width: 768px) {
    /* Keep top offset for fixed header — gutters live on .site-main / .container */
    body {
        padding-top: var(--site-header-offset, 68px);
        padding-inline: 0;
        padding-bottom: 0;
    }
    
    .container {
        padding: 20px 10px;
        padding-bottom: 100px; /* فاصله برای ناوبری موبایل */
        min-height: calc(100vh - 20px);
    }
    
    .logo-container {
        margin-bottom: 20px;
    }
    
    .logo {
        height: 100px;
        max-width: 250px;
    }
    
    .welcome-content {
        padding: 30px 20px;
        max-width: 100%;
    }
    
    .welcome-content h1 {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .welcome-content h2 {
        font-size: 22px;
    }
    
    .welcome-content h3 {
        font-size: 20px;
    }
    
    .welcome-content p,
    .subtitle {
        font-size: 14px;
    }
    
    .input-group {
        margin-bottom: 20px;
    }
    
    .input-group input {
        padding: 14px 18px;
        font-size: 16px; /* جلوگیری از zoom در iOS */
    }
    
    .primary-btn,
    .secondary-btn {
        padding: 14px;
        font-size: 16px;
    }
    
    .theme-toggle {
        top: 15px;
        left: 15px;
        width: 50px;
        height: 50px;
    }
    
    .theme-icon {
        width: 22px;
        height: 22px;
    }
    
    .quiz-container-wrapper {
        padding: 15px 10px;
    }
    
    .quiz-container-wrapper h2 {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .q {
        padding: 20px 15px;
        border-radius: 15px;
    }
    
    .row {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        gap: 8px;
        padding: 10px 0;
        font-size: 13px;
        align-items: center;
    }
    
    .row.header {
        font-size: 12px;
        padding: 8px 0;
        font-weight: 700;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        margin-bottom: 5px;
    }
    
    .row.header .col-title {
        text-align: right;
        padding: 5px;
    }
    
    .row.header .col-radio {
        text-align: center;
        padding: 5px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 12px;
        color: var(--text-heading) !important;
    }
    
    .col-title {
        font-size: 12px;
        line-height: 1.5;
        text-align: right;
        padding-right: 5px;
    }
    
    .col-radio {
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .col-radio input[type="radio"] {
        width: 18px;
        height: 18px;
        margin: 0;
    }
    
    .badge {
        font-size: 12px;
        padding: 4px 12px;
    }
    
    .quiz-container {
        padding: 0;
        margin: 0 auto;
    }
    
    .quiz-welcome {
        margin-bottom: 20px;
    }
    
    .quiz-buttons {
        flex-direction: row;
        gap: 10px;
        margin-top: 20px;
        justify-content: space-between;
    }
    
    .quiz-buttons button {
        flex: 1;
        max-width: 48%;
        padding: 8px 12px !important;
        font-size: 13px;
    }
    
    .buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }
    
    .buttons button {
        width: 100%;
    }
    
    .gauges-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .gauge {
        width: 120px;
        height: 60px;
    }
    
    .gauge-label {
        font-size: 20px;
    }
    
    .gauge-value {
        font-size: 18px;
    }
    
    .pattern-code {
        gap: 5px;
    }
    
    .pattern-code span {
        padding: 6px 15px;
        font-size: 16px;
    }
    
    .gauges-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .error-box {
        left: 10px;
        right: 10px;
        transform: none;
        min-width: auto;
        padding: 15px;
        font-size: 14px;
    }
    
    .pattern-display {
        font-size: 20px;
    }
    
    .numeric-code {
        font-size: 18px;
    }
    
    .whatsapp-info {
        font-size: 13px;
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .welcome-content {
        padding: 25px 15px;
    }
    
    .quiz-welcome {
        padding: 12px 15px !important;
    }
    
    .quiz-welcome h2 {
        font-size: 18px !important;
        margin-bottom: 3px !important;
    }
    
    .quiz-welcome .subtitle {
        font-size: 12px !important;
    }
    
    .welcome-content h1 {
        font-size: 22px;
    }
    
    .welcome-content h2 {
        font-size: 20px;
    }
    
    .row {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 5px;
        padding: 8px 0;
        font-size: 11px;
    }
    
    .row.header {
        font-size: 11px;
        padding: 6px 0;
    }
    
    .row.header .col-title {
        text-align: right;
    }
    
    .row.header .col-radio {
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 11px;
        color: var(--text-heading) !important;
    }
    
    .col-title {
        font-size: 11px;
        line-height: 1.4;
        padding-right: 3px;
    }
    
    .col-radio input[type="radio"] {
        width: 16px;
        height: 16px;
    }
    
    .q {
        padding: 15px 10px !important;
    }
    
    .badge {
        font-size: 11px;
        padding: 3px 10px;
        margin-bottom: 10px;
    }
    
    .row-old {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 5px;
        padding: 8px 0;
        font-size: 11px;
    }
    
    .row.header {
        display: grid;
        font-size: 11px;
        padding: 6px 0;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 6px;
        margin-bottom: 5px;
    }
    
    .row.header .col-title,
    .row.header .col-radio {
        text-align: center;
        padding: 3px;
    }
    
    .col-title {
        font-size: 11px;
        line-height: 1.4;
        padding-right: 3px;
    }
    
    .col-radio {
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .col-radio input[type="radio"] {
        width: 16px;
        height: 16px;
    }
    
    .q {
        padding: 15px 10px !important;
    }
    
    .badge {
        font-size: 11px;
        padding: 3px 10px;
        margin-bottom: 10px;
    }
    
    .col-title {
        font-weight: 600;
        margin-bottom: 8px;
    }
    
    .col-radio {
        display: flex;
        gap: 15px;
        justify-content: center;
        align-items: center;
    }
    
    .col-radio::before {
        content: '';
        display: none;
        font-size: 12px;
        color: var(--text-muted);
    }
    
    .col-radio:last-child::before {
        content: '';
        display: none;
    }
    
    .theme-toggle {
        width: 45px;
        height: 45px;
        top: 15px;
        left: 15px;
    }
    
    .theme-icon {
        width: 20px;
        height: 20px;
    }

    /* Compact public form fields (~375px hot paths) */
    input[type="tel"],
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    select,
    textarea,
    .input-group input {
        padding: 10px 12px;
        min-height: 40px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .input-group input {
        padding: 10px 12px;
    }
}

/* Mobile Navigation - استایل‌ها در mobile_nav.php تعریف شده‌اند */

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.3s ease;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 11px;
    min-width: 50px;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    transition: all 0.3s ease;
}

.nav-item.active {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
}

.nav-item:hover {
    color: var(--text-primary);
    transform: translateY(-3px) scale(1.1);
}

@media (min-width: 769px) {
    .nav-item:hover {
        transform: translateY(-5px) scale(1.15);
    }
}

.nav-item.active svg {
    stroke: #fbbf24;
    fill: none;
}

/* Desktop and Tablet Navigation */
@media (min-width: 769px) {
    .mobile-nav {
        display: flex !important;
        position: fixed;
        bottom: 15px;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%);
        width: auto !important;
        max-width: 500px;
        min-width: 400px;
        border-radius: 20px !important;
        border-bottom-left-radius: 20px !important;
        border-bottom-right-radius: 20px !important;
        padding: 8px 15px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
        margin: 0;
        justify-content: space-around;
        min-height: 65px;
    }
    
    .mobile-nav .nav-item {
        min-width: 70px;
        padding: 6px 15px;
        font-size: 12px;
        gap: 4px;
    }
    
    .mobile-nav .nav-item svg {
        width: 22px;
        height: 22px;
    }
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 30px 0;
}

.stat-card {
    padding: 12px;
    text-align: center;
    border-radius: 15px;
}

.stat-icon {
    width: 24px;
    height: 24px;
    margin: 0 auto 6px;
    color: var(--primary-color);
    stroke: currentColor;
    fill: none;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 4px 0;
    font-family: 'Kalameh', sans-serif;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    font-family: 'Kalameh', sans-serif;
}

.dashboard-actions {
    margin-top: 25px;
}

.dashboard-buttons-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.dashboard-btn {
    flex: 1;
    text-align: center;
    text-decoration: none;
    padding: 10px 16px !important;
    font-size: 14px !important;
    height: auto !important;
}

.logout-btn {
    display: block;
    text-align: center;
    text-decoration: none;
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    height: auto !important;
    margin-top: 0;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.dashboard-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(218, 178, 93, 0.3);
    flex-shrink: 0;
}

.dashboard-header-text h1 {
    font-size: 20px;
    margin: 0;
    margin-bottom: 5px;
}

.dashboard-header-text .subtitle {
    font-size: 13px;
    margin: 0;
    opacity: 0.8;
}

/* Fix OTP section height */
#otp-section .welcome-content {
    min-height: 400px !important;
}

/* فرم تکمیل اطلاعات - عریض برای موبایل */
.user-info-form-container {
    width: 100% !important;
    max-width: 100% !important;
}

@media (max-width: 768px) {
    .user-info-form-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 30px 20px !important;
        margin: 0 !important;
    }
}

#otp-input {
    text-align: center !important;
    font-size: 24px !important;
    letter-spacing: 8px !important;
    font-weight: 600 !important;
}

/* Profile Info Styles */
.profile-info {
    margin-top: 30px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    font-family: 'Kalameh', sans-serif;
}

.info-value {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Kalameh', 'Yekan', sans-serif;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Education Content */
.education-content {
    text-align: right;
    direction: rtl;
}

.education-content h3,
.education-content h4 {
    text-align: right;
    margin-top: 25px;
    margin-bottom: 15px;
    color: #fbbf24;
}

.education-content strong {
    color: #fbbf24;
}

.education-content p {
    text-align: right;
    line-height: 1.8;
}

.education-content ul {
    text-align: right;
    line-height: 2;
    padding-right: 20px;
}

.disc-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.disc-type {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 20px;
    text-align: right;
}

.disc-type h4 {
    color: #fbbf24;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 700;
}

.education-content h3 {
    color: #fbbf24;
    font-weight: 700;
}

.education-content h3,
.education-content h4,
.education-content strong {
    color: #fbbf24;
}

.education-content ul li {
    color: var(--text-primary);
}

.disc-type p {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 14px;
}

/* Profile Avatar */
.user-avatar-container {
    text-align: center;
    margin-bottom: 20px;
}

.user-avatar-container img,
.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(218, 178, 93, 0.3);
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.profile-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    text-align: center;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 20px rgba(218, 178, 93, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 auto;
    display: block;
}

.profile-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(218, 178, 93, 0.5);
}

.avatar-upload-label {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-align: center;
}

.avatar-upload-label:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.avatar-upload-input {
    display: none;
}

/* Profile Edit Form */
.profile-edit-form {
    display: none;
}

.profile-edit-form.active {
    display: block;
}

.profile-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

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

.profile-form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

.profile-form-group select,
.profile-form-group input[type="text"],
.profile-form-group input[type="email"],
.profile-form-group input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--input-border);
    border-radius: 10px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 15px;
    font-family: 'Kalameh', sans-serif;
    text-align: right;
    direction: rtl;
}

.profile-form-group select {
    background-color: var(--select-bg, var(--input-bg));
    background-image: var(--select-chevron);
    background-repeat: no-repeat;
    background-size: 12px 8px;
    background-position: left 0.85rem center;
    padding-left: 2.35rem;
    padding-right: 15px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.profile-form-group select option {
    background-color: var(--select-option-bg, var(--select-bg));
    color: var(--text-primary);
    padding: 10px;
}

.profile-form-group select::-ms-expand {
    display: none;
}

.profile-form-group select:focus,
.profile-form-group input:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

@media (max-width: 768px) {
    .profile-form-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
    
    .user-avatar-container img,
    .user-avatar {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        object-fit: cover;
        border: 3px solid var(--primary-color);
    }
}

/* Responsive adjustments for all devices */
@media (min-width: 481px) and (max-width: 768px) {
    .mobile-nav {
        display: flex;
    }
}

/* Tablet Styles (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 30px 20px;
    }
    
    .welcome-content {
        max-width: 100%;
        padding: 35px 25px;
    }
    
    .quiz-container {
        max-width: 100%;
    }
    
    .q {
        padding: 25px 20px;
    }
    
    .row {
        gap: 12px;
        padding: 12px 0;
    }
    
    .admin-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .tests-container {
        grid-template-columns: 1fr;
    }
    
    .tests-sidebar {
        position: relative;
        top: 0;
        max-height: none;
    }
}

/* Desktop Styles (1025px+) */
@media (min-width: 1025px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 40px 30px;
    }
    
    .welcome-content {
        max-width: 900px;
        margin: 0 auto;
        padding: 40px;
    }
    
    .quiz-container {
        max-width: 900px;
    }
    
    .q {
        padding: 30px;
    }
    
    .row {
        gap: 15px;
        padding: 15px 0;
    }
    
    .admin-stats-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 20px;
    }
    
    .admin-container {
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .tests-container {
        grid-template-columns: 280px 1fr;
        gap: 25px;
    }
    
    .tests-main {
        padding: 30px;
    }
    
    .tests-sidebar {
        position: sticky;
        top: 90px;
        max-height: calc(100vh - 110px);
    }
    
    .results-table {
        font-size: 15px;
    }
    
    .results-table th,
    .results-table td {
        padding: 18px;
    }
}

/* Results Table */
.results-table-container {
    width: 100%;
    margin: 20px 0;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
}

.results-table thead {
    background: rgba(255, 255, 255, 0.1);
}

.results-table th {
    padding: 15px;
    text-align: right;
    color: var(--text-heading);
    font-weight: 700;
    font-size: 16px;
    border-bottom: 2px solid var(--glass-border);
}

.results-table td {
    padding: 15px;
    text-align: right;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    vertical-align: middle;
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

.results-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.3s ease;
}

.view-details-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.view-details-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(218, 178, 93, 0.4);
}

.view-details-btn svg {
    stroke: white;
    fill: none;
}

.pattern-code-inline {
    display: inline-flex;
    gap: 0 !important;
    align-items: center;
    margin: 0;
    padding: 0;
    letter-spacing: 0;
    word-spacing: 0;
    font-size: 0; /* حذف فاصله بین inline-block elements */
}

.pattern-code-inline span {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 0;
    font-weight: 700;
    font-size: 14px !important;
    margin: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-left: none;
    border-right: none;
    vertical-align: middle;
    line-height: 1;
}

.pattern-code-inline span:first-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.pattern-code-inline span:last-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.pattern-code-inline span.pattern-d,
.pattern-code-inline span.d {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.pattern-code-inline span.pattern-i,
.pattern-code-inline span.i {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.pattern-code-inline span.pattern-s,
.pattern-code-inline span.s {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.pattern-code-inline span.pattern-c,
.pattern-code-inline span.c {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.pattern-code-inline span.pattern-h,
.pattern-code-inline span.h {
    background: linear-gradient(135deg, #c9a24a, #8a6a2e);
    color: white;
}

/* Responsive Table */
@media (max-width: 768px) {
    .results-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .results-table {
        min-width: 600px;
        font-size: 14px;
    }
    
    .results-table th,
    .results-table td {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .view-details-btn {
        width: 30px;
        height: 30px;
    }
    
    .view-details-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .pattern-code-inline {
        font-size: 0;
    }
    
    .pattern-code-inline span {
        padding: 4px 8px;
        font-size: 12px !important;
    }
}

/* Result Page Styles */
.result-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.result-header h1 {
    font-size: 24px;
    margin-bottom: 12px;
}

.result-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-date {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.result-pattern-card,
.result-numeric-card {
    margin-top: 20px;
    padding: 20px;
    border-radius: 15px;
}

.result-pattern-header,
.result-numeric-header {
    margin-bottom: 15px;
}

.result-pattern-header h3,
.result-numeric-header h3 {
    font-size: 16px;
    color: var(--primary-color);
    margin: 0;
    font-weight: 700;
}

.result-pattern-display {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-top: 10px;
}

.result-pattern-display span {
    padding: 10px 18px;
    border-radius: 0;
    font-size: 20px;
    font-weight: 700;
}

.result-pattern-display span:first-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.result-pattern-display span:last-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.numeric-code-display {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    padding: 15px;
    background: rgba(218, 178, 93, 0.1);
    border-radius: 12px;
    letter-spacing: 4px;
}

.result-actions {
    margin-top: 30px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.result-actions .primary-btn,
.result-actions .secondary-btn {
    padding: 10px 20px;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

/* Quiz Instructions Styles */
.quiz-instructions {
    max-width: 800px;
    margin: 20px auto;
    padding: 25px;
    display: block;
}

.quiz-instructions-title {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 22px;
}

.quiz-instructions-title i {
    margin-left: 10px;
}

.quiz-instructions-content {
    line-height: 2;
    color: var(--text-primary);
}

.quiz-instructions-intro {
    margin-bottom: 15px;
    font-size: 15px;
}

.quiz-instructions-box {
    background: rgba(218, 178, 93, 0.1);
    padding: 15px;
    border-radius: 12px;
    margin: 15px 0;
    border-right: 3px solid var(--primary-color);
}

.quiz-instructions-box-title {
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 16px;
}

.quiz-instructions-box-title i {
    margin-left: 8px;
}

.quiz-instructions-list {
    margin: 0;
    padding-right: 20px;
    list-style-type: none;
}

.quiz-instructions-list li {
    margin-bottom: 10px;
    font-size: 14px;
}

.quiz-instructions-list li:last-child {
    margin-bottom: 0;
}

.quiz-instructions-list li i {
    color: var(--primary-color);
    margin-left: 8px;
}

.quiz-instructions-note {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.quiz-instructions-note i {
    margin-left: 5px;
    color: var(--primary-color);
}

.quiz-instructions-button {
    text-align: center;
    margin-top: 25px;
}

.quiz-instructions-button .primary-btn {
    padding: 12px 40px;
    font-size: 16px;
}

.quiz-instructions-button .primary-btn i {
    margin-left: 8px;
}

@media (prefers-reduced-motion: reduce) {
    .gradient-orb,
    .background-animation .gradient-orb,
    .logo-container,
    .welcome-content,
    .glass-card.shimmer,
    .primary-btn,
    .pulse {
        animation: none !important;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }
}

@media (max-width: 768px) {
    .quiz-instructions {
        max-width: 100%;
        margin: 15px 5px;
        padding: 18px;
    }
    
    .quiz-instructions-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .quiz-instructions-intro {
        font-size: 13px;
        margin-bottom: 12px;
    }
    
    .quiz-instructions-box {
        padding: 12px;
        margin: 12px 0;
    }
    
    .quiz-instructions-box-title {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .quiz-instructions-list {
        padding-right: 15px;
    }
    
    .quiz-instructions-list li {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .quiz-instructions-note {
        font-size: 12px;
        margin-top: 15px;
    }
    
    .quiz-instructions-button {
        margin-top: 20px;
    }
    
    .quiz-instructions-button .primary-btn {
        padding: 10px 30px;
        font-size: 14px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .primary-btn,
    .result-actions .secondary-btn {
        width: 100%;
    }
}

/* ——— Mobile typography scale (public + guest + admin, ~375–767) ——— */
@media (max-width: 767px) {
    :root {
        --mobile-type-scale: 1;
        --text-xs: 0.8rem;
        --text-sm: 0.9rem;
        --text-md: 0.95rem;
        --text-lg: clamp(1rem, 2.4vw, 1.12rem);
        --text-xl: clamp(1.15rem, 3vw, 1.35rem);
        --text-2xl: clamp(1.3rem, 3.4vw, 1.55rem);
        --space-3: 10px;
        --space-4: 12px;
        --space-5: 16px;
        --space-6: 20px;
        --space-7: 28px;
        --touch-target-min: 44px;
        --btn-pad-y: 10px;
        --btn-pad-x: 16px;
    }

    /* Keep root at 100% — tokens already tune mobile; avoid double-shrinking rem */
    html {
        font-size: 100%;
    }

    body {
        line-height: 1.7;
    }

    h1 {
        font-size: 1.35rem;
        margin-bottom: 10px;
    }

    h2 {
        font-size: 1.15rem;
        margin-bottom: 8px;
    }

    h3 {
        font-size: 1.05rem;
        margin-bottom: 8px;
    }

    p,
    .subtitle {
        font-size: var(--text-md, 0.95rem);
        line-height: 1.7;
    }

    .subtitle {
        margin-bottom: 18px;
    }

    label {
        font-size: var(--text-sm, 0.9rem);
        margin-bottom: 6px;
    }

    .btn-primary,
    .primary-btn,
    .secondary-btn {
        font-size: var(--text-md, 0.95rem);
        padding: var(--btn-pad-y) var(--btn-pad-x);
        min-height: var(--touch-target-min);
    }

    input[type="tel"],
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        padding: 10px 14px;
        font-size: 16px;
    }

    .container {
        padding: 16px 10px 88px;
    }

    .welcome-content h1 {
        font-size: 1.35rem;
    }

    .welcome-content h2 {
        font-size: 1.15rem;
    }

    .welcome-content h3 {
        font-size: 1.05rem;
    }

    .welcome-content p,
    .welcome-content .subtitle {
        font-size: var(--text-md, 0.95rem);
    }

    .theme-toggle {
        width: 44px;
        height: 44px;
    }

    .theme-icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 375px) {
    :root {
        --text-xl: clamp(1.1rem, 4.2vw, 1.28rem);
        --text-2xl: clamp(1.22rem, 4.8vw, 1.42rem);
    }

    h1 {
        font-size: 1.28rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    h3 {
        font-size: 1.02rem;
    }
}
