/* ─── IRANSans Font ─────────────────────────────────────────────── */
@font-face {
    font-family: 'IRANSans';
    font-style:  normal;
    font-weight: 300;
    src: url('../fonts/IRANSansWeb_Light.woff2') format('woff2'),
         url('../fonts/IRANSansWeb_Light.woff')  format('woff');
}
@font-face {
    font-family: 'IRANSans';
    font-style:  normal;
    font-weight: 400;
    src: url('../fonts/IRANSansWeb.woff2') format('woff2'),
         url('../fonts/IRANSansWeb.woff')  format('woff');
}
@font-face {
    font-family: 'IRANSans';
    font-style:  normal;
    font-weight: 700;
    src: url('../fonts/IRANSansWeb_Bold.woff2') format('woff2'),
         url('../fonts/IRANSansWeb_Bold.woff')  format('woff');
}

/* ─── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary-1:  #5d35cc;
    --primary-2:  #094ed1;
    --gradient:   linear-gradient(135deg, var(--primary-1), var(--primary-2));
    --bg:         #ffffff;
    --text:       #111111;
    --text-muted: #6b7280;
    --border:     #e5e7eb;
    --radius:     12px;
    --shadow:     0 4px 24px rgba(9, 78, 209, 0.10);
    --red:        #dc2626;
    --green:      #16a34a;
    --orange:     #ea580c;
}

html { direction: rtl; }

body {
    font-family: 'IRANSans', Tahoma, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    background: #f3f4f8;
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─────────────────────────────────────────────────────── */
.page-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 36px;
    width: 100%;
    max-width: 480px;
}

.card-wide {
    max-width: 720px;
}

/* ─── Logo ───────────────────────────────────────────────────────── */
.logo-wrap {
    text-align: center;
    margin-bottom: 28px;
}
.logo-wrap img {
    max-height: 72px;
    width: auto;
}

/* ─── Page title ─────────────────────────────────────────────────── */
.page-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-top: -16px;
    margin-bottom: 24px;
}

/* ─── Forms ──────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text);
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: 'IRANSans', Tahoma, Arial, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: #fafafa;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    direction: rtl;
    text-align: right;
}

/* اعداد و تلفن: چپ به راست */
input[type="tel"],
input[type="number"],
input[type="password"],
input[inputmode="numeric"] {
    direction: ltr;
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-2);
    box-shadow: 0 0 0 3px rgba(9, 78, 209, 0.12);
    background: #fff;
}

select { direction: rtl; text-align: right; cursor: pointer; }

.field-error {
    color: var(--red);
    font-size: 13px;
    margin-top: 5px;
    display: none;
}
.field-error.visible { display: block; }

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 8px;
    font-family: 'IRANSans', Tahoma, Arial, sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: opacity .2s, transform .1s;
    text-align: center;
    text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
    background: var(--gradient);
    color: #fff;
    width: 100%;
}
.btn-primary:hover { opacity: .9; text-decoration: none; color: #fff; }

.btn-secondary {
    background: #f1f5f9;
    color: var(--text);
    width: 100%;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-outline {
    border: 2px solid var(--primary-2);
    color: var(--primary-2);
    background: transparent;
}
.btn-outline:hover { background: #eef2ff; }

.btn-danger {
    background: var(--red);
    color: #fff;
}
.btn-success {
    background: var(--green);
    color: #fff;
}

/* ─── Alerts ─────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.5;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }

/* ─── OTP input ──────────────────────────────────────────────────── */
.otp-wrap {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 8px 0;
    direction: ltr;
}
.otp-wrap input {
    width: 58px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    padding: 0;
    border-radius: 10px;
}

/* ─── Choice cards ───────────────────────────────────────────────── */
.choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 8px;
}
.choice-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.choice-card:hover {
    border-color: var(--primary-2);
    box-shadow: var(--shadow);
}
.choice-card.selected {
    border-color: var(--primary-1);
    background: #f5f0ff;
}
.choice-card svg { margin-bottom: 10px; }
.choice-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.choice-card p  { font-size: 13px; color: var(--text-muted); }

/* ─── Delivery code display ──────────────────────────────────────── */
.delivery-code-box {
    background: var(--gradient);
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin: 16px 0;
}
.delivery-code-box .label { font-size: 13px; opacity: .85; margin-bottom: 4px; }
.delivery-code-box .code  { font-size: 36px; font-weight: 700; letter-spacing: 6px; }

/* ─── Info box ───────────────────────────────────────────────────── */
.info-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 12px 0;
}
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    gap: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-row .key   { color: var(--text-muted); white-space: nowrap; }
.info-row .val   { font-weight: 600; text-align: left; }

/* ─── Rep selection list ─────────────────────────────────────────── */
.rep-list { display: flex; flex-direction: column; gap: 10px; }
.rep-item {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color .2s;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.rep-item input[type="radio"] { margin-top: 3px; accent-color: var(--primary-1); }
.rep-item .rep-name  { font-weight: 700; font-size: 14px; }
.rep-item .rep-addr  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.rep-item:has(input:checked) { border-color: var(--primary-1); background: #f5f0ff; }

/* ─── Divider ────────────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); font-size: 13px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }

/* ─── Gradient text ──────────────────────────────────────────────── */
.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* ─── Step indicator ─────────────────────────────────────────────── */
.steps {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
}
.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 80px;
}
.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: #fff;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}
.step.active .step-num  { background: var(--gradient); color: #fff; border-color: transparent; }
.step.done   .step-num  { background: var(--green);    color: #fff; border-color: transparent; }
.step-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center;
}
.step.active .step-label { color: var(--primary-1); font-weight: 700; }
.step::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    right: auto;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}
.step:first-child::before { display: none; }
.step.done::before { background: var(--green); }

/* ─── Admin layout ───────────────────────────────────────────────── */
.admin-body {
    display: flex;
    min-height: 100vh;
    background: #f3f4f8;
}

.admin-sidebar {
    width: 240px;
    background: #1e1b4b;
    color: #c7d2fe;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.admin-sidebar .logo-area {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.admin-sidebar .logo-area img { max-height: 52px; filter: brightness(0) invert(1); }

.admin-nav { padding: 16px 0; flex: 1; }
.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #c7d2fe;
    font-size: 14px;
    transition: background .15s;
    text-decoration: none;
}
.admin-nav a:hover   { background: rgba(255,255,255,.07); color: #fff; }
.admin-nav a.active  { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; }
.admin-nav .nav-section {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    color: #6366f1;
    padding: 14px 20px 4px;
    text-transform: uppercase;
}
.admin-logout {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
}
.admin-logout a { color: #f87171; font-size: 14px; text-decoration: none; }

.admin-main {
    flex: 1;
    overflow: auto;
}
.admin-topbar {
    background: #fff;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.admin-topbar h1 { font-size: 18px; font-weight: 700; }

.admin-content { padding: 28px; }

.admin-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 1px 8px rgba(0,0,0,.07);
    padding: 24px;
    margin-bottom: 24px;
}
.admin-card h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ─── Stats cards ────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 1px 8px rgba(0,0,0,.07);
    padding: 20px;
    text-align: center;
}
.stat-card .num {
    font-size: 32px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-card .lbl { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ─── Table ──────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: right;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: right;
}
.data-table tr:hover td { background: #fafbfc; }
.data-table .badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }

/* ─── Bulk select ────────────────────────────────────────────────── */
.bulk-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
}
.bulk-bar.visible { display: flex; }
.bulk-bar .bulk-count { color: var(--primary-2); font-weight: 700; }
.data-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-1);
    cursor: pointer;
}

/* ─── Textarea (admin) ───────────────────────────────────────────── */
textarea.code-area {
    font-family: monospace;
    font-size: 13px;
    direction: ltr;
    text-align: left;
    min-height: 160px;
    resize: vertical;
}

/* ─── Upload zone ────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: border-color .2s;
}
.upload-zone:hover { border-color: var(--primary-2); }
.upload-zone input[type="file"] { display: none; }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .card { padding: 28px 20px; }
    .choice-grid { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .admin-topbar h1 { font-size: 16px; }
}
