@font-face {
    font-family: 'IRANSansX';
    src: url('../fonts/IRANSansX-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANSansX';
    src: url('../fonts/IRANSansX-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #eef3f8;
    --card: #ffffff;
    --text: #172033;
    --muted: #687386;
    --line: #e3e8f0;
    --line-soft: #edf1f5;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --success-dark: #15803d;
    --navy: #102a56;
    --radius: 18px;
    --shadow: 0 12px 40px rgba(21, 37, 72, .08);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    font-family: 'IRANSansX', Tahoma, Arial, sans-serif;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, .07), transparent 34%), var(--bg);
    color: var(--text);
}

body.modal-open { overflow: hidden; }

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

button,
input,
textarea,
select {
    font-family: inherit;
}

button,
.button {
    border: 0;
    border-radius: 10px;
    padding: 11px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    line-height: 1.4;
    transition: .15s ease;
}

button:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); }
.btn-secondary { background: #eef2f7; color: #263244; }
.btn-outline { background: #fff; border: 1px solid #d9e0e9; color: #263244; }
.small-btn { padding: 7px 10px; font-size: 12px; border-radius: 8px; }

.topbar {
    background: var(--navy);
    color: #fff;
    min-height: 58px;
}

.topbar-inner {
    width: min(1080px, calc(100% - 28px));
    min-height: 58px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand { color: #fff; font-weight: 800; font-size: 18px; }

.nav { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.nav a { color: #fff; opacity: .78; }
.nav a.active,
.nav a:hover { opacity: 1; }

.page { min-height: calc(100vh - 58px); padding: 28px 14px; }
.page-shell { width: min(920px, 100%); margin: 0 auto; }
.page-shell-narrow { width: min(680px, 100%); }

.card {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.header { padding: 22px; border-bottom: 1px solid var(--line-soft); }
.header h1 { margin: 0 0 8px; font-size: 22px; }
.header p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.9; }

.progress-wrap { padding: 18px 22px 0; }
.progress { height: 7px; background: #edf0f5; border-radius: 999px; overflow: hidden; }
.progress-bar { width: 25%; height: 100%; background: var(--primary); transition: width .25s ease; }
.step-label { margin-top: 9px; color: #6b7280; font-size: 13px; }

.form-body,
.body-pad { padding: 22px; }

.step { display: none; }
.step.active { display: block; }
.step-title { font-size: 18px; margin: 0 0 18px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field.full { grid-column: 1 / -1; }
.field-gap { margin-bottom: 14px; }

label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; }

input,
textarea,
select {
    width: 100%;
    border: 1px solid #dce2ea;
    border-radius: 10px;
    padding: 12px 13px;
    outline: none;
    background: #fff;
    color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .09);
}

textarea { min-height: 110px; resize: vertical; }
.help { margin-top: 6px; color: #7c8595; font-size: 12px; line-height: 1.8; }

.step-content {
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid #e6ebf2;
    background: #f8fafc;
    border-radius: 12px;
    color: #465267;
    font-size: 13px;
    line-height: 2;
}

.step-content.bottom { margin: 18px 0 0; }
.step-content p { margin: 0; }

.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
}

.error-box,
.success-box,
.info-box {
    display: none;
    margin-top: 16px;
    border-radius: 12px;
    padding: 13px 14px;
    line-height: 1.9;
    font-size: 14px;
}

.visible { display: block !important; }
.error-box { background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239; }
.success-box { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.info-box { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.form-global-error { margin: 0 0 18px; }

#map {
    height: 410px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #dfe5ee;
    background: #f1f5f9;
}

.map-tools {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0;
    flex-wrap: wrap;
    color: #465267;
    font-size: 13px;
}

.map-coordinates {
    justify-content: flex-start;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 10px;
}

.coords { color: #475569; font-size: 12px; direction: ltr; }
.map-error { display: none; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #fff1f2; color: #9f1239; font-size: 13px; }

.choice-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
    margin: 0;
    display: flex;
    min-height: 120px;
    flex-direction: column;
    justify-content: center;
    border: 2px solid #e2e7ef;
    border-radius: 14px;
    padding: 22px;
    cursor: pointer;
    transition: .15s ease;
}
.choice input:checked + label { border-color: var(--primary); background: #eff6ff; }
.choice-title { font-weight: 700; font-size: 15px; }

.summary { border: 1px solid #e5e9f0; border-radius: 14px; overflow: hidden; }
.summary-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
}
.summary-row:last-child { border-bottom: 0; }
.summary-key { color: #6b7280; font-size: 13px; }
.summary-value { overflow-wrap: anywhere; line-height: 1.8; }

.success-screen { text-align: center; padding: 30px 22px; margin: 0; }
.success-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #dcfce7;
    color: var(--success);
    display: grid;
    place-items: center;
    font-size: 42px;
    font-weight: 800;
}
.success-screen h2 { margin: 0 0 8px; color: #065f46; }
.success-screen p { color: #64748b; }
.tracking-panel {
    margin: 22px auto;
    max-width: 420px;
    padding: 18px;
    border-radius: 14px;
    border: 1px solid #dbe5f0;
    background: #f8fafc;
}
.tracking-panel span { display: block; color: #64748b; font-size: 12px; margin-bottom: 8px; }
.tracking-code { display: block; direction: ltr; font-size: 23px; font-weight: 800; letter-spacing: 1px; }
.success-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.track-result { margin-top: 18px; }
.status-badge { display: inline-flex; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-new { background: #eef2ff; color: #3730a3; }
.status-review { background: #eff6ff; color: #1d4ed8; }
.status-contact { background: #fff7ed; color: #c2410c; }
.status-approved { background: #ecfdf5; color: #047857; }
.status-rejected { background: #fff1f2; color: #be123c; }
.status-done { background: #f0fdf4; color: #166534; }

/* Admin */
.admin-login-page { min-height: 100vh; display: grid; place-items: start center; }
.login-box { width: min(430px, calc(100% - 28px)); margin: 70px auto; }

.admin-topbar-inner { width: min(1280px, calc(100% - 28px)); }
.admin-user-name { display: inline-block; margin-right: 10px; color: #bfdbfe; font-size: 12px; }
.admin-nav-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.admin-nav-actions a,
.link-button { color: #fff; }
.inline-form { margin: 0; }
.link-button { background: transparent; padding: 0; border: 0; }

.admin-shell { width: min(1280px, calc(100% - 28px)); margin: 24px auto; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.admin-header h1 { margin: 0 0 4px; font-size: 20px; }
.admin-header p { margin: 0; color: var(--muted); font-size: 13px; }

.admin-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(21, 37, 72, .06);
    overflow: hidden;
}

.filters {
    padding: 14px;
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 10px;
    border-bottom: 1px solid var(--line-soft);
}

.table-wrap { width: 100%; overflow: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 1080px; }
.admin-table th,
.admin-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line-soft);
    text-align: right;
    vertical-align: middle;
    font-size: 13px;
}
.admin-table th { background: #f8fafc; white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table select { min-width: 170px; font-size: 12px; padding: 9px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.row-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }

.empty-state {
    color: #64748b;
    text-align: center;
    padding: 22px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #fff;
}

.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #d9e0e9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #263244;
}
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, .55);
    padding: 18px;
    align-items: center;
    justify-content: center;
}
.modal.open { display: flex; }
.modal-card {
    width: min(760px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .25);
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line-soft);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}
.modal-body { padding: 18px; }
.note-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.note-item { border: 1px solid #e5e9f0; border-radius: 12px; padding: 12px 14px; background: #fafbfc; }
.note-meta { color: #64748b; font-size: 11px; margin-bottom: 7px; direction: rtl; }
.note-text { white-space: pre-wrap; line-height: 1.9; font-size: 13px; }
.note-form { border-top: 1px solid var(--line-soft); padding-top: 18px; }
.status-history { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.status-history > strong { display: block; margin-bottom: 10px; }
.history-item { padding: 10px 0; border-bottom: 1px dashed #e5e7eb; }
.history-main { font-size: 13px; margin-bottom: 5px; }

.toast {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 1200;
    max-width: min(380px, calc(100% - 40px));
    padding: 12px 16px;
    border-radius: 10px;
    color: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #166534; }
.toast-error { background: #9f1239; }

@media (max-width: 760px) {
    .topbar-inner { width: 100%; padding: 0 14px; }
    .nav { gap: 12px; font-size: 12px; }

    .page { padding: 0; }
    .page-shell { width: 100%; }
    .card {
        min-height: calc(100vh - 58px);
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
    }

    .header,
    .progress-wrap,
    .form-body,
    .body-pad { padding-left: 16px; padding-right: 16px; }

    .header h1 { font-size: 19px; }
    .grid,
    .choice-wrap { grid-template-columns: 1fr; }
    .summary-row { grid-template-columns: 1fr; gap: 4px; }

    #map { height: min(58vh, 390px); border-radius: 12px; }
    .map-tools { align-items: stretch; }
    .map-tools .btn-outline { width: 100%; }

    .actions { flex-direction: column-reverse; align-items: stretch; }
    .actions button,
    .actions .button { width: 100%; min-height: 46px; }

    input,
    textarea,
    select,
    button { font-size: 16px; }

    .success-actions { flex-direction: column; }
    .success-actions .button { width: 100%; }

    .admin-topbar-inner { width: 100%; padding: 10px 14px; align-items: flex-start; }
    .admin-nav-actions { flex-wrap: wrap; justify-content: flex-end; }
    .admin-shell { width: 100%; margin: 0; }
    .admin-header { padding: 14px; margin: 0; background: #fff; border-bottom: 1px solid var(--line); }
    .admin-card { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
    .filters { grid-template-columns: 1fr; }

    .modal { padding: 0; align-items: flex-end; }
    .modal-card { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
    .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
