/* ===== بازارچه — سیستم طراحی =====
   رنگ پایه: لاجورد افغانستان (آبی تیره)، طلایی، خاکی گرم
*/

:root{
  --lapis: #1B3A5C;
  --lapis-dark: #122740;
  --gold: #C9922A;
  --gold-light: #E3B45C;
  --sand: #EDE3D0;
  --sand-deep: #DFD0B4;
  --ink: #2B2118;
  --paper: #FBF8F2;
  --line: #D9CBAE;
  --green: #3F7D53;
  --amber: #A67C2E;
  --red: #A5432F;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(27,58,92,0.10);
  --font: "Vazirmatn", "Tahoma", sans-serif;
}

*{ box-sizing: border-box; }

html{
  scroll-behavior: smooth;
}

body{
  margin:0;
  font-family: var(--font);
  background: var(--sand);
  color: var(--ink);
  min-height: 100dvh;
  direction: rtl;
}

img{ max-width:100%; display:block; }
button{ font-family: inherit; }
a{ color: inherit; }

::selection{ background: var(--gold-light); }

/* الگوی تزئینی که یادآور نقش‌مایه‌های قالین افغانی است */
.motif-strip{
  height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    var(--gold) 0 6px,
    var(--lapis) 6px 12px
  );
}

/* ===== نوار بالایی ===== */
.topbar{
  position: sticky;
  top:0;
  z-index: 20;
  background: var(--lapis);
  color: var(--paper);
  padding: 14px 16px 12px;
}
.topbar-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
}
.brand-mark{
  width:34px; height:34px;
  border-radius:9px;
  background: var(--gold);
  display:flex; align-items:center; justify-content:center;
  color: var(--lapis-dark);
  font-weight:800;
  font-size:16px;
  flex-shrink:0;
}
.brand-name{
  font-weight:800;
  font-size:19px;
  letter-spacing:0;
}
.brand-sub{
  font-size:11.5px;
  color: #C9D6E2;
  margin-top:1px;
}
.admin-link{
  font-size:12.5px;
  color:#C9D6E2;
  border:1px solid rgba(255,255,255,0.25);
  padding:6px 10px;
  border-radius:20px;
  white-space:nowrap;
}

.search-row{
  margin-top:12px;
}
.search-box{
  width:100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  background: #ffffff;
  font-size: 14.5px;
  font-family: var(--font);
  color: var(--ink);
}
.search-box::placeholder{ color:#8b8072; }

/* دسته‌بندی‌ها */
.chips{
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding: 12px 16px 4px;
  scrollbar-width:none;
}
.chips::-webkit-scrollbar{ display:none; }
.chip{
  flex-shrink:0;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  font-size: 13.5px;
  font-weight:600;
  color: var(--ink);
  cursor:pointer;
}
.chip.active{
  background: var(--lapis);
  border-color: var(--lapis);
  color: #fff;
}

/* ===== لیست آگهی‌ها ===== */
.wrap{
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 100px;
}
.section-title{
  font-size: 15px;
  font-weight:700;
  color: var(--lapis-dark);
  margin: 4px 4px 12px;
}
.grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.card{
  background: var(--paper);
  border-radius: var(--radius);
  overflow:hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  cursor:pointer;
}
.card-photo{
  width:100%;
  aspect-ratio: 4/3;
  background: var(--sand-deep) center/cover no-repeat;
  display:flex; align-items:center; justify-content:center;
  color:#a99a7d;
  font-size:12px;
  position:relative;
}
.card-cat{
  position:absolute;
  top:8px;
  inset-inline-start:8px;
  background: rgba(27,58,92,0.85);
  color:#fff;
  font-size:11px;
  padding:3px 9px;
  border-radius: 20px;
}
.card-body{
  padding: 10px 12px 12px;
}
.card-title{
  font-size: 13.5px;
  font-weight: 700;
  line-height:1.4;
  margin:0 0 4px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.card-loc{
  font-size:12px;
  color:#6b5f4e;
  margin-bottom:6px;
}
.card-price{
  font-size:14px;
  font-weight:800;
  color: var(--amber);
}

.empty{
  text-align:center;
  padding: 60px 20px;
  color:#8b8072;
}
.empty-title{
  font-weight:700;
  font-size:15px;
  color: var(--lapis-dark);
  margin-bottom:6px;
}

/* ===== دکمه شناور افزودن آگهی ===== */
.fab{
  position: fixed;
  bottom: 20px;
  inset-inline-end: 20px;
  z-index: 30;
  background: var(--gold);
  color: var(--lapis-dark);
  border:none;
  border-radius: 50%;
  width: 58px; height:58px;
  font-size: 26px;
  font-weight:700;
  box-shadow: 0 6px 16px rgba(201,146,42,0.45);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
}

/* ===== شیت / مودال پایین‌صفحه ===== */
.sheet-overlay{
  position:fixed; inset:0;
  background: rgba(20,20,15,0.55);
  z-index: 50;
  display:none;
}
.sheet-overlay.open{ display:block; }
.sheet{
  position:fixed;
  left:0; right:0; bottom:0;
  max-height: 92dvh;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  z-index: 51;
  transform: translateY(100%);
  transition: transform .25s ease;
  overflow-y:auto;
  padding-bottom: 24px;
}
.sheet.open{ transform: translateY(0); }
.sheet-handle{
  width:40px; height:4px;
  background: var(--line);
  border-radius:4px;
  margin: 10px auto 4px;
}
.sheet-head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 6px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.sheet-title{ font-weight:800; font-size:16px; color:var(--lapis-dark); }
.sheet-close{
  background:none; border:none; font-size:20px; color:#8b8072; cursor:pointer;
  padding:4px 8px;
}
.sheet-body{ padding: 16px 18px 0; }

/* ===== فرم ===== */
.field{ margin-bottom: 16px; }
.field label{
  display:block;
  font-size:13px;
  font-weight:700;
  color: var(--lapis-dark);
  margin-bottom:6px;
}
.field input[type=text],
.field input[type=tel],
.field input[type=number],
.field select,
.field textarea{
  width:100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  font-size: 14px;
  font-family: var(--font);
  background:#fff;
  color: var(--ink);
}
.field textarea{ min-height:80px; resize:vertical; }
.field-hint{ font-size:11.5px; color:#8b8072; margin-top:5px; }

.type-toggle{
  display:flex;
  gap:8px;
}
.type-toggle button{
  flex:1;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background:#fff;
  font-weight:700;
  font-size: 13px;
  cursor:pointer;
}
.type-toggle button.active{
  background: var(--lapis);
  border-color: var(--lapis);
  color:#fff;
}

.photo-picker{
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align:center;
  cursor:pointer;
  background: #fff;
}
.photo-picker input{ display:none; }
.photo-picker-label{ font-size:13px; font-weight:700; color:var(--lapis); }
.photo-picker-hint{ font-size:11.5px; color:#8b8072; margin-top:4px; }
.photo-preview{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}
.photo-thumb{
  position:relative;
  width:72px; height:72px;
  border-radius:8px;
  overflow:hidden;
  background: var(--sand-deep);
}
.photo-thumb img{ width:100%; height:100%; object-fit:cover; }
.photo-thumb button{
  position:absolute; top:2px; inset-inline-end:2px;
  background: rgba(0,0,0,0.55);
  color:#fff; border:none; border-radius:50%;
  width:18px; height:18px; font-size:11px; line-height:1;
  cursor:pointer;
}

.btn-primary{
  width:100%;
  padding: 13px;
  border-radius: 12px;
  border:none;
  background: var(--gold);
  color: var(--lapis-dark);
  font-weight:800;
  font-size:15px;
  cursor:pointer;
  margin-top: 4px;
}
.btn-primary:disabled{ opacity:.5; }
.btn-secondary{
  width:100%;
  padding: 12px;
  border-radius: 12px;
  border:1.5px solid var(--line);
  background:#fff;
  color: var(--ink);
  font-weight:700;
  font-size:14px;
  cursor:pointer;
  margin-top: 8px;
}

.notice{
  background:#EAF3EC;
  border:1px solid #bfe0c7;
  color: var(--green);
  padding: 10px 14px;
  border-radius:10px;
  font-size:13px;
  margin-bottom:14px;
  display:none;
}
.notice.show{ display:block; }

/* ===== جزئیات آگهی ===== */
.detail-photos{
  display:flex;
  overflow-x:auto;
  scroll-snap-type:x mandatory;
}
.detail-photos img{
  width:100%; flex-shrink:0;
  scroll-snap-align:start;
  aspect-ratio: 4/3;
  object-fit:cover;
}
.detail-body{ padding: 16px 18px; }
.detail-title{ font-size:18px; font-weight:800; margin:0 0 6px; }
.detail-price{ font-size: 19px; font-weight:800; color:var(--amber); margin-bottom:10px; }
.detail-meta{
  display:flex; gap:14px; flex-wrap:wrap;
  font-size:12.5px; color:#6b5f4e; margin-bottom:14px;
  border-bottom:1px solid var(--line); padding-bottom:14px;
}
.detail-desc{ font-size:14px; line-height:1.9; color:var(--ink); margin-bottom:18px; white-space:pre-wrap; }
.detail-contact{
  display:flex; align-items:center; justify-content:space-between;
  background: var(--sand);
  border-radius:12px;
  padding: 12px 14px;
}
.detail-contact-name{ font-weight:700; font-size:13.5px; }
.detail-contact-phone{ font-size:13px; color:#6b5f4e; margin-top:2px; direction:ltr; text-align:right; }
.call-btn{
  background: var(--green);
  color:#fff;
  border:none;
  border-radius:10px;
  padding:10px 18px;
  font-weight:700;
  font-size:13.5px;
  cursor:pointer;
  text-decoration:none;
}

/* ===== ادمین ===== */
.admin-body{ background: var(--sand); min-height:100dvh; }
.admin-list{ display:flex; flex-direction:column; gap:12px; }
.admin-item{
  background:var(--paper);
  border:1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display:flex;
  gap:12px;
}
.admin-thumb{
  width:76px; height:76px;
  border-radius:8px;
  background: var(--sand-deep) center/cover no-repeat;
  flex-shrink:0;
}
.admin-info{ flex:1; min-width:0; }
.admin-info h4{ margin:0 0 4px; font-size:13.5px; }
.admin-info p{ margin:0; font-size:12px; color:#6b5f4e; }
.status-pill{
  display:inline-block;
  font-size:11px;
  font-weight:700;
  padding:2px 9px;
  border-radius:20px;
  margin-top:6px;
}
.status-pending{ background:#F5E6C8; color: var(--amber); }
.status-approved{ background:#DCEEE0; color: var(--green); }
.status-rejected{ background:#F3DAD3; color: var(--red); }
.admin-actions{
  display:flex; flex-direction:column; gap:6px;
  justify-content:center;
  flex-shrink:0;
}
.admin-actions button{
  border:none; border-radius:8px;
  padding:7px 12px; font-size:12px; font-weight:700; cursor:pointer;
}
.btn-approve{ background: var(--green); color:#fff; }
.btn-reject{ background: var(--red); color:#fff; }
.btn-delete{ background: var(--sand-deep); color: var(--ink); }

.login-box{
  max-width:320px;
  margin: 80px auto;
  background:var(--paper);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align:center;
}

@media(min-width:720px){
  .grid{ grid-template-columns: repeat(4, 1fr); }
  .sheet{ max-width:520px; left:auto; right:auto; inset-inline-end:0; border-radius:20px 0 0 20px; height:100dvh; max-height:100dvh; }
  .sheet.open{ transform: translateX(0); }
  html[dir=rtl] .sheet{ transform: translateX(100%); }
}
