@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2"),
         url("../fonts/vazirmatn_regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/vazirmatn_medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2"),
         url("../fonts/vazirmatn_bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --ink: #0E0E0E;
    --ink-soft: #4A4A4E;
    --mist: #EBE9ED;
    --mist-deep: #E2E0E6;
    --periwinkle: #B7C3E6;
    --taupe: #B5ACA6;
    --copper: #A96854;
    --surface: #FFFFFF;
    --trust-bg: rgba(220, 229, 245, 0.9);
    --trust-text: #3A4566;
    --input-bg: #F7F6F8;
    --price: #A96854;
    --nav-inactive: #B5ACA6;
    --pistachio-bg: #DCEFCF;
    --pistachio-text: #2F5D2E;
    --danger: #B4554A;
    --overlay: rgba(14, 14, 14, 0.65);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
    height: 100%;
    background: var(--mist);
}

body {
    font-family: "Vazirmatn", Tahoma, sans-serif;
    color: var(--ink);
    direction: rtl;
    text-align: right;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

button, input, textarea, select {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
    outline: none;
}

button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.ltr { direction: ltr; text-align: left; }
.center { text-align: center; }
.muted { color: var(--ink-soft); font-size: 14px; }
.strong { font-weight: 700; color: var(--ink); font-size: 13px; margin-top: 8px; }
.hint { color: var(--ink-soft); font-size: 12px; margin: 4px 0 10px; }

.app {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100%;
    margin: 0 auto;
    background:
        radial-gradient(ellipse 80% 50% at 15% -10%, rgba(183, 195, 230, 0.55), transparent 60%),
        radial-gradient(ellipse 70% 45% at 95% 90%, rgba(175, 190, 230, 0.35), transparent 55%),
        radial-gradient(ellipse 50% 40% at 70% 40%, rgba(255, 255, 255, 0.35), transparent 60%),
        var(--mist);
    overflow: hidden;
}

.screen {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.28s ease;
}

.screen.active { display: flex; }

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

.screen-splash {
    align-items: center;
    justify-content: flex-start;
    padding: 56px 28px 40px;
}

.splash-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    pointer-events: none;
}

.splash-orb-a {
    width: 220px; height: 220px;
    top: -40px; right: -40px;
    background: radial-gradient(circle, rgba(183,195,230,.7), transparent 70%);
    animation: float 5s ease-in-out infinite;
}

.splash-orb-b {
    width: 260px; height: 260px;
    bottom: -60px; left: -50px;
    background: radial-gradient(circle, rgba(169,104,84,.25), transparent 70%);
    animation: float 6.5s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(12px); }
}

.splash-logo {
    position: relative;
    z-index: 1;
    width: min(56vw, 200px);
    height: auto;
    margin: 0 auto;
    display: block;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
    animation: floatIn 0.7s ease;
}

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

.splash-text {
    position: relative;
    z-index: 1;
    margin-top: auto;
    margin-bottom: auto;
    width: min(100%, 340px);
    text-align: center;
    padding: 0 8px 8px;
}

.splash-text p {
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.9;
}

.splash-wait {
    margin-top: 28px;
    color: var(--copper);
    font-size: 14px;
    font-weight: 700;
}

.home-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.home-header {
    padding: 10px 16px 8px;
    flex-shrink: 0;
}

.home-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand {
    font-weight: 700;
    font-size: 17px;
    white-space: nowrap;
}

.org-pill {
    flex: 1;
    height: 36px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 0 8px;
    box-shadow: 0 2px 8px rgba(14,14,14,.12);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-round {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}

.trust-banner {
    margin-top: 14px;
    background: var(--trust-bg);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 12px;
    font-weight: 700;
    color: var(--trust-text);
    line-height: 1.7;
    box-shadow: 0 2px 10px rgba(14,14,14,.04);
}

.trust-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--copper);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 12px;
    flex-shrink: 0;
}

.home-tools {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.city-selector {
    height: 52px;
    padding: 0 12px 0 10px;
    background: #fff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 14px;
    color: #1B3A6B;
    box-shadow: 0 2px 10px rgba(14,14,14,.06);
    white-space: nowrap;
}

.search-bar {
    flex: 1;
    height: 52px;
    background: #F7F6F8;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    box-shadow: 0 2px 10px rgba(14,14,14,.04);
}

.search-bar input {
    flex: 1;
    min-width: 0;
    background: transparent;
    font-size: 13px;
}

.search-bar input::placeholder { color: var(--taupe); }

.filter-chip {
    align-self: flex-start;
    margin: 8px 16px 0;
    background: var(--trust-bg);
    color: var(--copper);
    border-radius: 14px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
}

.ads-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 16px 120px;
    -webkit-overflow-scrolling: touch;
}

.profile-ads { padding-bottom: 24px; }
.profile-pad { overflow-y: auto; flex: 1; padding-bottom: 120px; }

#screen-home .empty-card {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 50%;
    transform: translateY(-58%);
    margin: 0;
    z-index: 1;
}

.ad-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 14px;
    margin-top: 14px;
    box-shadow: 0 4px 18px rgba(14,14,14,.06);
    animation: fadeIn 0.3s ease;
}

.ad-image-wrap {
    position: relative;
    height: 200px;
    border-radius: 14px;
    background: var(--input-bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 15px;
}

.ad-image-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    background: var(--input-bg);
}

.ad-status {
    margin-top: 12px;
    padding: 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.ad-status.pending { background: var(--trust-bg); color: var(--trust-text); }
.ad-status.edited { background: var(--trust-bg); color: var(--trust-text); }
.ad-status.rejected { background: #F3DCD8; color: var(--danger); }
.ad-status.approved { background: var(--pistachio-bg); color: var(--pistachio-text); }

.ad-cat {
    display: inline-block;
    margin-top: 14px;
    background: var(--trust-bg);
    color: var(--trust-text);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
}

.ad-title {
    margin-top: 10px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
}

.ad-price {
    margin-top: 10px;
    color: var(--price);
    font-size: 16px;
    font-weight: 700;
}

.ad-meta {
    margin-top: 6px;
    color: var(--taupe);
    font-size: 12px;
}

.ad-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.empty-card {
    margin: 40px 16px;
    background: var(--surface);
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
    box-shadow: 0 4px 18px rgba(14,14,14,.06);
}

.load-more {
    padding: 0 16px 110px;
    text-align: center;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    flex-shrink: 0;
}

.back-btn {
    color: var(--copper);
    font-weight: 700;
    font-size: 13px;
    padding: 8px 4px;
}

.page-title {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
}

.scroll-pad {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 120px;
    -webkit-overflow-scrolling: touch;
}

.card {
    background: var(--surface);
    border-radius: 22px;
    box-shadow: 0 8px 28px rgba(14,14,14,.06);
}

.form-card { padding: 22px 20px; }
.form-card h2 { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
.form-sub { margin-top: 22px; margin-bottom: 6px; font-size: 15px; }
.about-body { line-height: 1.9; margin-bottom: 8px; }

.field-label {
    display: block;
    margin-top: 18px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
}

.input {
    width: 100%;
    background: var(--input-bg);
    border-radius: 14px;
    padding: 16px;
    font-size: 15px;
    transition: box-shadow .2s;
}

.input:focus { box-shadow: 0 0 0 2px var(--periwinkle); }
.textarea { resize: vertical; min-height: 120px; }
.select-btn { text-align: right; }

.otp-input {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.4em;
    padding: 18px;
}

.test-note {
    margin-top: 14px;
    background: #E8ECF7;
    color: var(--trust-text);
    border-radius: 14px;
    padding: 14px;
    font-size: 12px;
    line-height: 1.8;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 15px;
    margin-top: 18px;
    transition: transform .15s, opacity .15s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-secondary { background: #E8ECF7; color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.file-btn { position: relative; overflow: hidden; margin-top: 10px; }

.photo-hero {
    height: 188px;
    border-radius: 14px;
    background: var(--input-bg);
    display: grid;
    place-items: center;
    color: var(--ink-soft);
    font-weight: 700;
    overflow: hidden;
}

.photo-hero img { width: 100%; height: 100%; object-fit: cover; }

.photo-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-top: 10px;
    padding-bottom: 4px;
}

.photo-thumb {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    border: 2px solid transparent;
    background: var(--input-bg);
}

.photo-thumb.main { border-color: var(--copper); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .rm {
    position: absolute;
    top: 2px; left: 2px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(14,14,14,.75);
    color: #fff;
    font-size: 12px;
}

.profile-card { margin-bottom: 16px; padding: 20px; }
.section-title {
    font-size: 15px;
    font-weight: 700;
    margin: 8px 4px 4px;
}

.notice-card {
    background: #E8ECF7;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}

.notice-card strong { display: block; margin-bottom: 8px; color: var(--ink); }
.notice-card p { color: var(--ink-soft); font-size: 13px; line-height: 1.8; }

.privacy-note {
    background: var(--pistachio-bg);
    color: var(--pistachio-text);
    border-radius: 14px;
    padding: 14px;
    font-size: 12px;
    line-height: 1.8;
    margin-bottom: 8px;
}

.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.captcha-img {
    width: 160px;
    height: 52px;
    border-radius: 14px;
    background: var(--input-bg);
    object-fit: fill;
    cursor: pointer;
    flex-shrink: 0;
}

.bottom-nav {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(12px + var(--safe-bottom));
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
    border-radius: 22px;
    box-shadow: 0 10px 30px rgba(14,14,14,.12);
    display: flex;
    padding: 8px 4px;
    z-index: 20;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    color: var(--nav-inactive);
    font-size: 10px;
    font-weight: 700;
}

.nav-item.active { color: var(--ink); }
.nav-ico { font-size: 18px; line-height: 1; }

.overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 40;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.overlay.center { align-items: center; }

.sheet {
    width: min(100%, 480px);
    background: #fff;
    border-radius: 22px;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(14,14,14,.25);
    animation: slideUp 0.25s ease;
}

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

.sheet h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.sheet-sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 14px; }

.cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.cat-item, .city-option {
    background: var(--input-bg);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    transition: background .15s, box-shadow .15s;
}

.cat-item:active, .city-option:active { transform: scale(0.98); }
.city-option.selected, .cat-item.selected {
    background: #E8ECF7;
    box-shadow: inset 0 0 0 2px var(--periwinkle);
}

.sheet-link {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 14px;
    padding: 14px;
    color: var(--copper);
    font-weight: 700;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(96px + var(--safe-bottom));
    transform: translateX(-50%);
    z-index: 50;
    background: var(--ink);
    color: #fff;
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    max-width: min(90%, 420px);
    text-align: center;
    box-shadow: 0 8px 24px rgba(14,14,14,.2);
    animation: fadeIn 0.2s ease;
}

.toast.error { background: var(--danger); }
.toast.success { background: #2F9E6B; }

.detail-img {
    display: block;
    width: 100%;
    height: 260px;
    object-fit: cover;
    object-position: center;
    background: var(--input-bg);
    border-radius: 14px;
    cursor: zoom-in;
}

.detail-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
}

.detail-thumbs img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    object-position: center;
    border-radius: 10px;
    background: var(--input-bg);
    cursor: zoom-in;
    flex-shrink: 0;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(8, 12, 22, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    cursor: zoom-out;
}

.lightbox.hidden { display: none; }

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: calc(12px + var(--safe-top));
    left: 16px;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    display: grid;
    place-items: center;
    z-index: 1;
}

.divider {
    height: 1px;
    background: rgba(183,195,230,.45);
    margin: 18px 0;
}

@media (min-width: 481px) {
    body { background: #d8d6dc; }
    .app {
        box-shadow: 0 0 0 1px rgba(14,14,14,.06), 0 24px 80px rgba(14,14,14,.12);
        border-radius: 0;
    }
}
