/* Bastan Expert – Public CSS */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap');

:root {
  --clay:   #8B5E3C;
  --clay2:  #6e4a2e;
  --gold:   #C9963A;
  --parch:  #F5EDD6;
  --fog:    #EDE3CD;
  --sand:   #D4B896;
  --ink:    #2C1A0E;
  --white:  #FDFAF5;
  --green:  #155724;
  --red:    #721c24;
  --r:      12px;
}

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

#bastan-app,
#bastan-thread {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  color: var(--ink);
  direction: rtl;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

/* ── utils ── */
.bastan-hidden { display: none !important; }

/* ── step animation ── */
.bastan-step { animation: bfadeIn .25s ease; }
@keyframes bfadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── title ── */
.bastan-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--clay);
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--fog);
}

/* ── back button ── */
.bastan-back {
  display: inline-block;
  background: none;
  border: none;
  color: var(--clay);
  font-family: inherit;
  font-size: .9rem;
  cursor: pointer;
  padding: 0 0 12px;
}
.bastan-back:hover { text-decoration: underline; }

/* ══════════════════════════
   STEP 1 – Categories
══════════════════════════ */
.bastan-categories { display: flex; flex-direction: column; gap: 12px; }

.cat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 16px;
  background: var(--white);
  border: 2px solid var(--fog);
  border-radius: var(--r);
  cursor: pointer;
  font-family: inherit;
  text-align: right;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.cat-card:hover, .cat-card.active {
  border-color: var(--clay);
  box-shadow: 0 4px 20px rgba(44,26,14,.12);
  transform: translateY(-2px);
}
.cat-card.active { background: var(--parch); }

.cat-icon  { font-size: 2rem; flex-shrink: 0; }
.cat-info  { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cat-name  { font-size: 1rem; font-weight: 700; color: var(--ink); }
.cat-price { font-size: .8rem; color: var(--clay); }
.cat-desc  { font-size: .78rem; color: #888; margin-bottom: 2px; }

/* پیش‌نمایش ویدیو */
.pthumb-video { background: #1a1a1a; }
.video-label  {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: .65rem; padding: 2px 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* loading spinner for categories */
.cats-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 30px; color: var(--clay); font-size: .9rem;
}

/* ══════════════════════════
   STEP 2 – Count
══════════════════════════ */
.count-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 24px 0;
}
.count-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--clay);
  background: var(--white);
  color: var(--clay);
  font-size: 1.5rem;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: background .15s;
}
.count-btn:hover { background: var(--parch); }

#count-val {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--clay);
  min-width: 48px;
  text-align: center;
  display: block;
}

.price-preview {
  background: var(--parch);
  border-radius: var(--r);
  padding: 14px;
  text-align: center;
  margin-bottom: 24px;
  font-size: .95rem;
}
.price-preview strong { color: var(--clay); font-size: 1.1rem; }

/* ══════════════════════════
   STEP 3 – Form
══════════════════════════ */
.bastan-field { margin-bottom: 16px; }
.bastan-field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--clay);
  margin-bottom: 6px;
}
.req { color: var(--red); }

.bastan-field input[type="text"],
.bastan-field input[type="email"],
.bastan-field input[type="tel"],
.bastan-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--sand);
  border-radius: 10px;
  font-family: inherit;
  font-size: .95rem;
  background: var(--white);
  color: var(--ink);
  -webkit-appearance: none;
  transition: border-color .15s;
}
.bastan-field input:focus,
.bastan-field textarea:focus { outline: none; border-color: var(--clay); }

/* drop zone */
.drop-zone {
  position: relative;
  border: 2px dashed var(--sand);
  border-radius: var(--r);
  padding: 28px 16px;
  text-align: center;
  background: var(--parch);
  cursor: pointer;
  color: var(--clay);
  font-size: .9rem;
  transition: border-color .15s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--clay); }
.drop-zone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; width: 100%; height: 100%;
  cursor: pointer;
}

/* photo previews */
.photo-previews {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.pthumb {
  position: relative;
  width: 74px; height: 74px;
  border-radius: 8px; overflow: hidden;
  border: 2px solid var(--sand);
  flex-shrink: 0;
}
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pthumb .rm {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none; border-radius: 50%;
  font-size: 12px; line-height: 20px; text-align: center;
  cursor: pointer; font-family: inherit;
}

/* progress */
.upload-progress {
  display: flex; align-items: center; gap: 10px; margin: 8px 0;
}
.progress-track {
  flex: 1; height: 8px;
  background: var(--fog); border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0;
  background: var(--clay); border-radius: 99px;
  transition: width .2s;
}
#progress-pct { font-size: .8rem; color: var(--clay); font-weight: 600; min-width: 36px; }

/* order summary */
.order-summary {
  background: var(--parch);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.summary-row {
  display: flex; justify-content: space-between;
  font-size: .9rem;
}
.summary-total { font-size: 1rem; padding-top: 8px; border-top: 1px solid var(--sand); }
.summary-total strong { color: var(--clay); }

/* main button */
.bastan-btn {
  display: block; width: 100%;
  padding: 15px;
  background: var(--clay);
  color: #fff;
  border: none; border-radius: var(--r);
  font-size: 1rem; font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background .15s, transform .1s;
}
.bastan-btn:hover  { background: var(--clay2); transform: translateY(-1px); color: #fff; }
.bastan-btn:active { transform: none; }
.bastan-btn:disabled { background: var(--sand); cursor: not-allowed; transform: none; }

/* error */
.bastan-error {
  background: #fde8e8; color: var(--red);
  border-radius: 10px; padding: 12px 16px;
  font-size: .9rem; margin-bottom: 16px;
}

/* ══════════════════════════
   STEP 4 – Success
══════════════════════════ */
.success-box {
  text-align: center;
  padding: 32px 16px 40px;
}

/* دایره تیک سبز */
.success-check {
  width: 72px; height: 72px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  font-size: 2.2rem;
  line-height: 72px;
  margin: 0 auto 18px;
}

.success-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 24px;
}

/* کارت کد پیگیری */
.tracking-card {
  background: var(--parch);
  border: 2px dashed var(--clay);
  border-radius: 16px;
  padding: 24px 20px;
  margin: 0 auto 24px;
  max-width: 360px;
}

.tracking-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--clay);
  margin-bottom: 12px;
  letter-spacing: .02em;
}

.tracking-code {
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .08em;
  background: var(--white);
  border: 2px solid var(--sand);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.tracking-hint {
  font-size: .85rem;
  color: #856404;
  background: #FFF3CD;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  line-height: 1.7;
}

.copy-btn {
  background: var(--clay);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.copy-btn:hover { background: var(--clay2); }

.copy-msg {
  font-size: .85rem;
  color: var(--success);
  font-weight: 600;
  margin-top: 8px;
}

.redirect-msg {
  color: var(--clay);
  font-size: .9rem;
  margin-bottom: 8px;
}

.success-note {
  font-size: .82rem;
  color: #888;
  margin-top: 20px;
  line-height: 1.7;
}

.spinner-wrap { display: flex; justify-content: center; margin: 16px 0; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--fog);
  border-top-color: var(--clay);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════
   THREAD
══════════════════════════ */
.thread-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 2px solid var(--fog);
}
.thread-header h2 { font-size: 1.1rem; color: var(--clay); }

.thread-photos {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.thread-photos img {
  width: 78px; height: 78px; object-fit: cover;
  border-radius: 8px; border: 2px solid var(--sand); cursor: pointer;
}

/* messages */
.thread-messages {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 20px; min-height: 40px;
}
.msg-bubble {
  max-width: 86%; padding: 12px 16px;
  border-radius: 16px; font-size: .92rem; line-height: 1.65;
}
.msg-bubble.from-admin {
  background: var(--parch); border: 1.5px solid var(--sand);
  align-self: flex-start; border-bottom-right-radius: 4px;
}
.msg-bubble.from-user {
  background: var(--clay); color: #fff;
  align-self: flex-end; border-bottom-left-radius: 4px;
}
.msg-meta { font-size: .74rem; opacity: .65; margin-bottom: 6px; }
.msg-bubble audio { width: 100%; margin-top: 6px; }

.reply-area { border-top: 2px solid var(--fog); padding-top: 16px; }
.reply-area textarea {
  width: 100%; padding: 12px;
  border: 1.5px solid var(--sand); border-radius: 10px;
  font-family: inherit; font-size: .95rem;
  margin-bottom: 10px; resize: vertical;
  background: var(--white); color: var(--ink);
}
.reply-area textarea:focus { outline: none; border-color: var(--clay); }

.reply-info { font-size: .82rem; color: var(--clay); margin-top: 8px; }

.locked-notice, .unpaid-notice {
  text-align: center; padding: 18px;
  border-radius: var(--r); font-weight: 600;
}
.locked-notice  { background: var(--fog); color: var(--ink); }
.unpaid-notice  { background: #FFF3CD; color: #856404; }

/* status badge */
.status-badge {
  display: inline-block; padding: 4px 12px;
  border-radius: 99px; font-size: .8rem; font-weight: 600;
}
.st-unpaid    { background: #F8D7DA; color: #721c24; }
.st-pending   { background: #FFF3CD; color: #856404; }
.st-reviewing { background: #CCE5FF; color: #004085; }
.st-answered  { background: #D4EDDA; color: #155724; }
.st-closed    { background: #E9ECEF; color: #495057; }
