/* ==================== ریست و متغیرهای مدرن ==================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --header-height: 60px;
    --header-bg: #ffffff;
    --header-border: #e5e7eb;
    --accent: #6366f1;
    /* بنفش-آبی مدرن */
    --accent-hover: #4f46e5;
    --sidebar-bg: #ffffff;
    --sidebar-width: 285px;
    --overlay-bg: rgba(15, 23, 42, 0.55);
    --body-bg: #f8fafc;
    --main-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-light: #e2e8f0;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-sidebar: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Vazir', Tahoma, sans-serif;
    --backdrop-blur: blur(8px);
    --input-radius: 8px;
    --input-padding: 12px 14px;
}

html {
    direction: rtl;
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--body-bg);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: var(--header-height);
    position: relative;
    overflow-x: hidden;
    transition: background-color 0.2s ease;
}

body.menu-open {
    overflow: hidden;
    touch-action: none;
}

/* ==================== هدر مدرن ==================== */
.header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 100;
    height: var(--header-height);
    background-color: var(--header-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid var(--header-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    backdrop-filter: saturate(180%) blur(10px);
    background-color: rgba(255,255,255,0.85);
    user-select: none;
}

.header__title {
    font-weight: 650;
    font-size: 1.15rem;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    text-decoration: none;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header__title span {
    color: var(--accent);
    font-weight: 700;
}

/* ==================== دکمه منوی مدرن ==================== */
.menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 101;
    color: var(--text-primary);
}

.menu-btn:hover {
    background-color: #f1f5f9;
}

.menu-btn:active {
    background-color: #e2e8f0;
    transform: scale(0.94);
}

.menu-btn__line {
    display: block;
    width: 20px;
    height: 2px;
    background-color: currentColor;
    border-radius: 2px;
    transition: all var(--transition-base);
    transform-origin: center;
}

body.menu-open .menu-btn__line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.menu-open .menu-btn__line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

body.menu-open .menu-btn__line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ==================== اورلی با محوکنندگی ==================== */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 95;
    background-color: var(--overlay-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

body.menu-open .overlay {
    opacity: 1;
    visibility: visible;
}

/* ==================== سایدبار مدرن ==================== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 99;
    width: var(--sidebar-width);
    max-width: 82vw;
    background-color: var(--sidebar-bg);
    box-shadow: var(--shadow-sidebar);
    transform: translateX(100%);
    transition: transform var(--transition-base);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 0 0 0 0;
    /* گوشه‌های داخلی گرد می‌شوند */
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
    -webkit-overflow-scrolling: touch;
}

body.menu-open .sidebar {
    transform: translateX(0);
}

/* هدر داخلی سایدبار */
.sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    background-color: #fafbfc;
}

.sidebar__brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar__brand i {
    font-style: normal;
    font-size: 1.2rem;
    color: var(--accent);
}

.sidebar__close {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: #fff;
    color: var(--text-secondary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.sidebar__close:hover {
    background: #f1f5f9;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.sidebar__close:active {
    background: #e2e8f0;
    transform: scale(0.92);
}

/* ==================== لینک‌های منوی مدرن ==================== */
.sidebar__nav {
    list-style: none;
    padding: 10px 0;
    flex-grow: 1;
}

.sidebar__nav li {
    margin: 0;
}

.sidebar__nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 24px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(0,0,0,0.02);
    transition: all 0.2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

/* نقطه رنگی مدرن کنار لینک */
.sidebar__nav a::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    background-color: var(--accent);
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.25s ease;
}

.sidebar__nav a:hover {
    background-color: #f8fafc;
    color: var(--text-primary);
    padding-right: 32px;
}

.sidebar__nav a:hover::before {
    opacity: 1;
    transform: scale(1);
}

.sidebar__nav a:active {
    background-color: #f1f5f9;
    transition: background-color 0.05s;
}

/* لینک فعال */
.sidebar__nav a.active {
    background-color: #f5f3ff;
    color: var(--accent-hover);
    font-weight: 600;
    border-right: 3px solid var(--accent);
}

.sidebar__nav a.active::before {
    opacity: 1;
    transform: scale(1);
    background-color: var(--accent-hover);
}

/* ==================== پاورقی سایدبار ==================== */
.sidebar__footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    background-color: #fafbfc;
    letter-spacing: 0.02em;
}

/* ==================== محتوای اصلی (main) ==================== */
.main-content {
    padding: 20px 16px 40px 16px;
    max-width: 720px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
    min-height: calc(100dvh - var(--header-height));
}

.main-content .content-card {
    background-color: var(--main-bg);
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
}

.main-content .content-card h2 {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-content .content-card h2 .accent-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    display: inline-block;
}

.main-content .content-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 12px;
    line-height: 1.85;
}

.main-content .content-card .highlight {
    background-color: #f5f3ff;
    border-right: 3px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 10px 10px 0;
    margin: 14px 0;
    color: #4338ca;
    font-size: 0.9rem;
    font-weight: 500;
}

/* اسکرول‌بار مدرن */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 20px;
}

/* ==================== واکنش‌گرایی بیشتر ==================== */
@media screen and (max-width: 380px) {
    :root {
        --sidebar-width: 260px;
        --header-height: 54px;
    }

    .header {
        padding: 0 12px;
    }

    .header__title {
        font-size: 1rem;
    }

    .sidebar__nav a {
        padding: 12px 18px;
    }

    .main-content {
        padding: 14px 10px 30px 10px;
    }

    .main-content .content-card {
        padding: 18px 14px;
        border-radius: 12px;
    }
}

@media screen and (min-width: 640px) {
    :root {
        --sidebar-width: 310px;
    }

    .main-content {
        padding: 28px 24px 50px 24px;
    }

    .main-content .content-card {
        padding: 30px 28px;
        border-radius: 20px;
    }

    .sidebar__nav a {
        padding: 15px 28px;
    }
}

/* ==================== استایل‌های جدید برای فرم ==================== */
.step {
    display: none; /* مخفی کردن همه تب‌ها در ابتدا */
}

h3 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* برچسب‌های فیلد */
label {
    display: block;
    margin-top: 16px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ورودی‌های متنی، اعداد، تاریخ، انتخاب */
input[type="text"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: var(--input-padding);
    border: 1px solid var(--border-light);
    border-radius: var(--input-radius);
    font-size: 0.95rem;
    background-color: #fff;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-sans);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ورودی فقط‌خواندنی */
input[readonly] {
    background-color: #f1f5f9;
    color: #475569;
    cursor: default;
    border-color: #e2e8f0;
}

/* فیلدهای انتخابی (select) */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 10px center;
    background-size: 1.1em;
    padding-left: 2.5rem; /* فضای کافی برای آیکون در سمت چپ */
}

/* دکمه‌های رادیویی و چک‌باکس */
input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--accent);
    width: 1.1em;
    height: 1.1em;
    margin-left: 6px;
    vertical-align: middle;
    cursor: pointer;
}

/* استایل گروه رادیویی/چک‌باکس برای چیدمان بهتر */
.radio-group,
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.radio-group label,
.checkbox-group label {
    display: inline-flex;
    align-items: center;
    font-weight: 400;
    margin-top: 0;
    margin-bottom: 0;
    color: var(--text-primary);
    cursor: pointer;
}

/* ورودی فایل */
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px dashed var(--border-light);
    border-radius: var(--input-radius);
    background-color: #f8fafc;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s;
}

input[type="file"]:hover {
    border-color: var(--accent);
}

/* پیش‌نمایش تصویر */
.preview-img {
    margin-top: 12px;
    text-align: center;
    display: none; /* به صورت پیش‌فرض مخفی می‌ماند و با JS نمایش داده می‌شود */
}

.preview-img img {
    max-width: 200px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: var(--shadow-card);
}

/* فیلد شرطی (conditional) */
.conditional-field {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* پیغام‌های خطا */
.error-message {
    color: #dc2626;
    font-size: 0.8rem;
    margin-top: 4px;
    display: none;
    font-weight: 500;
}

/* دکمه‌های کنترل مراحل */
.buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 12px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    text-align: center;
}

#prevBtn {
    background-color: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

#prevBtn:hover {
    background-color: #e2e8f0;
}

#nextBtn {
    background-color: var(--accent);
    color: white;
    margin-right: auto; /* چپ‌چین در حالت RTL */
}

#nextBtn:hover {
    background-color: var(--accent-hover);
}

#nextBtn:disabled {
    background-color: #a5b4fc;
    cursor: not-allowed;
}

/* خلاصه اطلاعات */
.summary-item {
    background: #f8fafc;
    padding: 12px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.summary-item span {
    font-weight: 700;
    color: var(--text-primary);
    display: inline-block;
    min-width: 100px;
}

/* کارت شماره تلفن */
.phone-card {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 12px 20px;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: #1e3a8a;
}

.phone-card strong {
    font-weight: 700;
}

/* استایل‌های کمکی برای هماهنگی در صفحات کوچک */
@media screen and (max-width: 500px) {
    .buttons {
        flex-direction: column;
    }

    #nextBtn,
    #prevBtn {
        width: 100%;
        margin-right: 0;
    }
}