/* ============================================================
   متغیرهای رنگی - با inline style در base.html از روی session
   (theme_colors) بازنویسی می‌شن؛ این‌جا فقط مقادیر پیش‌فرضن.
   ============================================================ */
:root {
  --bg: #F2FAF9;
  --card: #FFFFFF;
  --border: #CFE9E4;
  --container: #E7F6F3;
  --buttons: #13B497;
  --accent: #3AA9E0;
  --accent2: #0C8FA8;
  --text1: #0D2724;
  --text2: #4C726C;
  --text3: #83A8A1;
  --danger: #E5484D;
  --danger-bg: #FEEEEE;
  --success-bg: #E5F5EF;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --sidebar-w: 232px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
body { margin: 0; padding: 0; max-width: 100%; }

body.app-body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text1);
  min-height: 100vh;
  transition: background-color .25s ease, color .25s ease;
}

a { color: inherit; }

/* ============================================================
   شل اصلی: سایدبار (دسکتاپ) + محتوا + نوار پایین (موبایل)
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  max-width: 100vw;
}

.app-sidebar { display: none; }

.app-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.app-content {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  padding: 18px 16px calc(var(--bottomnav-h) + 22px);
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .app-shell { grid-template-columns: var(--sidebar-w) 1fr; }
  .app-sidebar { display: flex; }
  .app-content { padding: 26px 32px 32px; max-width: 960px; }
}

/* ============================================================
   سایدبار (تبلت/دسکتاپ)
   ============================================================ */
.app-sidebar {
  flex-direction: column;
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 26px;
  font-weight: 700;
  font-size: 15px;
  color: var(--buttons);
  text-decoration: none;
}
.sidebar-brand img { width: 32px; height: 32px; border-radius: 9px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--container); color: var(--buttons); }
.nav-item.active {
  background: linear-gradient(135deg, var(--buttons), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 14px -4px var(--buttons);
}
/* ============================================================
   نوار بالا: عنوان صفحه + سوییچ تم + خروج
   ============================================================ */
.app-topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title {
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-title .brand-mobile {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--buttons);
  text-decoration: none;
}
.topbar-title .brand-mobile img { width: 26px; height: 26px; border-radius: 7px; }

@media (min-width: 768px) {
  .brand-mobile { display: none !important; }
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* سوییچ تم */
.theme-switch { display: inline-flex; align-items: center; cursor: pointer; }
.theme-switch input { display: none; }
.theme-switch-track {
  width: 52px;
  height: 28px;
  background: var(--container);
  border: 1px solid var(--border);
  border-radius: 30px;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 6px;
  justify-content: space-between;
  transition: background .2s;
}
.theme-switch-track i { font-size: 11px; color: var(--text3); z-index: 1; }
.theme-switch-track .knob {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--buttons), var(--accent2));
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.theme-switch input:checked ~ .theme-switch-track .knob {
  transform: translateX(-24px);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 15px;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--danger-bg); color: var(--danger); }

.notif-btn { position: relative; }
.notif-btn:hover { background: var(--container); color: var(--buttons); }
/* ============================================================
   امتیازدهی ستاره‌ای - انتخاب امتیاز (فرم ثبت/ویرایش نظر) + نمایش فقط‌خواندنی
   ============================================================ */
.star-picker { display: flex; flex-direction: row-reverse; justify-content: center; gap: 8px; margin: 6px 0 4px; }
.star-picker input { display: none; }
.star-picker label { font-size: 32px; color: var(--border); cursor: pointer; transition: color .15s, transform .12s; line-height: 1; }
.star-picker label:hover,
.star-picker label:hover ~ label,
.star-picker input:checked ~ label { color: #F5A623; transform: scale(1.08); }

.star-display { display: inline-flex; gap: 2px; direction: ltr; }
.star-display i { font-size: 13px; color: var(--border); }
.star-display i.filled { color: #F5A623; }

.notif-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid var(--card);
}

/* ============================================================
   نوار پایین (موبایل)
   ============================================================ */
.app-bottomnav {
  display: flex;
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  height: var(--bottomnav-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 30;
  box-shadow: 0 -6px 20px -8px rgba(0,0,0,.12);
}
@media (min-width: 768px) { .app-bottomnav { display: none; } }

.bottomnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text3);
  font-size: 9.5px;
  position: relative;
}
.bottomnav-item i { font-size: 17px; }
.bottomnav-item.active { color: var(--buttons); }

/* ============================================================
   کارت‌ها، دکمه‌ها، فرم‌ها (مشترک بین همه‌ی صفحات)
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.hero-gradient {
  background: linear-gradient(135deg, var(--buttons), var(--accent2));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: filter .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--buttons), var(--accent2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text2); }
.btn-outline:hover { background: var(--container); }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 13px; font-size: 11.5px; }

.field-label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 8px; }

.text-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--container);
  font-family: inherit;
  font-size: 15px;
  color: var(--text1);
  text-align: center;
}
.text-input:focus { outline: none; border-color: var(--buttons); background: var(--card); }
.otp-input { letter-spacing: 12px; font-weight: 700; font-size: 22px; }

textarea.text-input { text-align: right; resize: vertical; min-height: 110px; }
select.text-input { text-align: right; cursor: pointer; }

.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 16px;
}
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--buttons); }
.alert-info { background: var(--container); color: var(--text1); border: 1px solid var(--border); }

.badge { padding: 3px 9px; border-radius: 20px; font-size: 9.5px; font-weight: 700; }

.empty-state {
  text-align: center;
  padding: 46px 20px;
  color: var(--text3);
}
.empty-state i { font-size: 30px; margin-bottom: 12px; display: block; }

/* ============================================================
   صفحات ورود (بدون شل - قبل از احراز هویت)
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--buttons) 0%, var(--accent2) 100%);
}
.auth-card {
  background: #fff;
  border-radius: 26px;
  padding: 36px 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  text-align: center;
}
.auth-icon {
  width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--success-bg); color: var(--buttons);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.auth-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; color: #0D2724; }
.auth-subtitle { font-size: 12.5px; color: #83A8A1; margin-bottom: 22px; line-height: 1.8; }
.auth-links { margin-top: 16px; display: flex; justify-content: space-between; font-size: 11.5px; }
.auth-links a { color: #83A8A1; text-decoration: none; }
.auth-links a:hover { color: var(--buttons); }

/* ============================================================
   لودینگ سه‌نقطه‌ای مشترک - روی همه‌ی دکمه‌های submit استفاده می‌شه
   ============================================================ */
.btn-loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: btn-dot-bounce 1.4s infinite ease-in-out both;
}
.btn-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.btn-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes btn-dot-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: .5; }
  40% { transform: scale(1); opacity: 1; }
}
.btn[disabled] { opacity: .85; cursor: default; }

/* ============================================================
   جعبه‌های ورود کد تایید (۴ مربع)
   ============================================================ */
.otp-boxes {
  display: flex;
  gap: 10px;
  justify-content: center;
  direction: ltr;
}
.otp-box {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--container);
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  color: var(--text1);
}
.otp-box:focus {
  outline: none;
  border-color: var(--buttons);
  background: var(--card);
}

/* ============================================================
   صفحه‌ی مرور آگهی‌ها: نوار جستجو+فیلتر، ردیف دسته‌بندی‌ها، کارت آگهی
   (طراحی دقیقاً هماهنگ با نسخه‌ی فلاتر)
   ============================================================ */
.browse-toolbar { display: flex; gap: 10px; margin-bottom: 16px; position: relative; }

.browse-search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 14px;
}
.browse-search-box i { color: var(--text3); font-size: 13px; }
.browse-search-box input {
  border: none;
  background: transparent;
  flex: 1;
  padding: 13px 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--text1);
  outline: none;
  text-align: right;
}

.filter-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  font-size: 15px;
}
.filter-btn.active { background: var(--buttons); color: #fff; border-color: var(--buttons); }
.filter-dot {
  position: absolute; top: 6px; left: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--card);
}

.filter-dropdown-panel {
  position: absolute;
  top: 56px;
  left: 0;
  z-index: 40;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  width: 230px;
  box-shadow: 0 20px 45px -12px rgba(0,0,0,.25);
  display: none;
}
.filter-dropdown-panel.show { display: block; }
.filter-dropdown-panel .filter-title {
  font-size: 11.5px; font-weight: 700; margin-bottom: 8px; color: var(--text3);
}
.filter-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 10px;
  border-radius: 11px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text1);
}
.filter-option:hover { background: var(--container); }
.filter-option input { accent-color: var(--buttons); width: 15px; height: 15px; }

.category-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  margin-bottom: 18px;
  flex-wrap: nowrap;
}
@media (min-width: 1024px) {
  .category-scroll { flex-wrap: wrap; overflow-x: visible; }
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text2);
  flex-shrink: 0;
  width: 78px;
}
.category-card-img {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--container);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 20px;
}
.category-card-img img { width: 100%; height: 100%; object-fit: contain; padding: 6px; box-sizing: border-box; }
.category-card.active .category-card-img { border-color: var(--buttons); }
.category-card span {
  font-size: 9.5px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 78px;
}
.category-card.active span { color: var(--buttons); font-weight: 700; }

/* --- کارت آگهی --- */
.project-card-content { display: flex; gap: 11px; text-decoration: none; color: inherit; }
.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--card);
  border-radius: 19px;
  padding: 10px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  margin-bottom: 10px;
  overflow: hidden;
  max-width: 100%;
}
/* project-card-info قبلاً هیچ flex-basis‌ای نداشت، برای همین کنار تصویر
   فقط به اندازه‌ی محتواش جمع می‌شد و کل فضای باقی‌مونده‌ی کارت (به‌خصوص تو
   صفحه‌ی دسکتاپ که کارت خیلی عریض‌تره) به شکل یک فضای خالی سمت چپ کارت
   باقی می‌موند. flex:1 باعث میشه از عرض واقعی در دسترس استفاده کنه. */
.project-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.project-card.featured { border: 3px solid #EF4444; }
.project-card.elevated { box-shadow: 0 12px 26px -10px rgba(0,0,0,.22); }

.project-card-image {
  position: relative;
  width: 104px;
  height: 125px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--container);
}
.project-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-card-image::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.04), transparent 55%, rgba(0,0,0,.4));
}
.project-card-badges {
  position: absolute; top: 3px; right: 3px; z-index: 2;
  display: flex; gap: 3px;
}
.badge-urgent, .badge-time {
  display: flex; align-items: center; gap: 2px;
  border-radius: 30px; padding: 3px 6px; font-size: 8px; font-weight: 700; color: #fff;
  white-space: nowrap;
}
.badge-urgent { background: #EF4444; }
.badge-time { background: #3B82F6; }
.bookmark-btn {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  width: 27px; height: 27px; border-radius: 50%;
  background: rgba(0,0,0,.45); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; padding: 0;
  transition: background .15s;
}
.bookmark-btn:hover { background: rgba(0,0,0,.62); }
.bookmark-btn.saved { background: var(--buttons); }
.bookmark-btn.saved:hover { opacity: .9; }
.bookmark-btn-label { display: none; }
.card-side-form { margin: 0; }
.card-propose-btn:disabled { opacity: .45; cursor: not-allowed; }
.project-card-side-actions { display: flex; flex-direction: column; gap: 11px; }

.card-propose-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 38px; border-radius: 12px;
  background: rgba(19, 180, 151, .1);
  border: none; cursor: pointer;
  color: var(--buttons); font-size: 12px; font-weight: 700;
  font-family: inherit;
  transition: background .15s;
}
.card-propose-btn:hover { background: rgba(19, 180, 151, .18); }

.saved-toggle-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 15px;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.saved-toggle-btn.active { background: var(--buttons); color: #fff; border-color: var(--buttons); }

.project-card-category-label {
  position: absolute; right: 6px; bottom: 6px; left: 6px; z-index: 2;
  background: rgba(0,0,0,.45); color: #fff; border-radius: 10px;
  padding: 4px 5px; font-size: 8px; font-weight: 700; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.project-card-image-sm { width: 58px; height: 58px; }
.project-card-title { font-size: 14px; font-weight: 800; color: var(--text1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.project-card-desc {
  font-size: 10px; color: var(--text2); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.project-card-price { display: flex; align-items: center; gap: 4px; font-size: 11px; flex-wrap: wrap; }
.project-card-price i { color: var(--text2); font-size: 13px; }
.price-min { font-weight: 700; color: var(--buttons); opacity: .7; }
.price-max { font-weight: 700; color: var(--buttons); }
.price-sep, .price-unit { font-weight: 700; font-size: 10px; color: var(--text2); }

.project-card-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag-pill { background: var(--container); color: var(--buttons); border-radius: 50px; padding: 3px 7px; font-size: 7.5px; font-weight: 700; white-space: nowrap; }

/* --- کارت فشرده‌ی آگهی (بدون تصویر) - browse_projects.html / my_projects.html --- */
.compact-card-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}
.compact-card-subline { display: flex; align-items: center; gap: 5px; min-width: 0; margin-top: 2px; }
.compact-card-subline img.owner-avatar-xs {
  width: 19px; height: 19px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--container);
}
.compact-card-subline span { font-size: 9.5px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-card-subline .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text3); flex-shrink: 0; }
.compact-card-price { display: flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; color: var(--buttons); }
.compact-card-price i { font-size: 12px; }
.line-clamp-1 { -webkit-line-clamp: 1 !important; }

/* --- کارت فریلنسر (browse_freelancers.html) - روی .project-card سوار می‌شه --- */
.bookmark-btn-card {
  position: absolute; top: 10px; left: 10px; z-index: 5;
  width: 29px; height: 29px; border-radius: 50%;
  background: var(--container); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); cursor: pointer; padding: 0; font-size: 12.5px;
  transition: background .15s, color .15s, border-color .15s;
}
.bookmark-btn-card:hover { color: var(--buttons); border-color: var(--buttons); }
.bookmark-btn-card.saved { background: var(--buttons); color: #fff; border-color: var(--buttons); }
.freelancer-card-content { align-items: center; }
.freelancer-card-avatar {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--container); display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 20px;
}
.freelancer-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.freelancer-card-avatar.ringed { box-shadow: 0 0 0 2px var(--buttons); }
.freelancer-card-tenure { display: flex; align-items: center; gap: 4px; font-size: 8.5px; color: var(--text3); }
.tag-pill-sm { font-size: 7px; padding: 2px 6px; }

.project-card-meta { display: flex; align-items: center; }
.meta-owner { display: flex; align-items: center; gap: 5px; min-width: 0; }
.owner-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--container); }
.meta-owner span { font-size: 9px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-spacer { flex: 1; }
.meta-item { display: flex; align-items: center; gap: 3px; font-size: 8px; color: var(--text2); white-space: nowrap; }
.meta-divider { width: 1px; height: 17px; background: var(--border); margin: 0 5px; flex-shrink: 0; }

/* تبلت/دسکتاپ: کارت آگهی فضای بیشتری از خودش استفاده کنه، فونت‌ها بزرگ‌تر
   باشن - طرح فشرده‌ی فعلی فقط برای موبایل (پیش‌فرض بالا) باقی می‌مونه */
@media (min-width: 768px) {
  .project-card { padding: 16px; gap: 18px; border-radius: 22px; }
  .project-card-image { width: 152px; height: 176px; }
  .project-card-image-sm { width: 84px; height: 84px; }
  .project-card-title { font-size: 17px; }
  .project-card-desc { font-size: 12.5px; line-height: 1.6; }
  .project-card-price { font-size: 14px; gap: 6px; }
  .project-card-price i { font-size: 16px; }
  .price-sep, .price-unit { font-size: 12.5px; }
  .project-card-tags { gap: 6px; }
  .tag-pill { font-size: 10.5px; padding: 5px 12px; }
  .project-card-meta { gap: 4px; }
  .meta-owner span { font-size: 11.5px; }
  .owner-avatar { width: 25px; height: 25px; }
  .meta-item { font-size: 10.5px; gap: 5px; }
  .meta-divider { height: 20px; margin: 0 8px; }
  .badge-urgent, .badge-time { font-size: 10.5px; padding: 5px 10px; }
  .project-card-category-label { font-size: 10.5px; padding: 6px 8px; }
  .status-badge-sm { font-size: 10px; padding: 4px 11px; }
  /* روی دسکتاپ کارت خیلی عریض‌تره - دکمه‌ی ثبت پیشنهاد لازم نیست کل
     عرض کارت رو بگیره، همون‌قدر که رو موبایل به چشم میاد کافیه */
  .card-propose-btn { width: auto; align-self: flex-start; padding: 0 26px; font-size: 13px; }
}

/* ============================================================
   چیدمان دو ستونه‌ی محتوای داخل کارت (فقط دسکتاپ/تبلت، ۷۶۸px به بالا) -
   صفحات مرور آگهی‌ها، فریلنسرها و آگهی‌های من. عرض/تعداد کارت در هر
   ردیف عوض نمی‌شه (هنوز یک کارت تمام‌عرض در هر ردیف، مثل حالت موبایل)؛
   فقط محتوای داخل هر کارت به یک شبکه‌ی دوستونه تقسیم می‌شه: ستون محتوا
   (راست، عریض‌تر) + ستون کناری (چپ) برای بودجه/اکشن‌ها.
   چون grid-column/grid-row فقط روی فرزندهای مستقیمِ گرید اثر می‌کنه،
   موقعیت هر عنصر با کلاس مشخص می‌شه، نه ترتیب DOM.
   ============================================================ */
@media (min-width: 768px) {
  /* توجه: عرض/تعداد کارت در هر ردیف عوض نمی‌شه (همون یک کارت تمام‌عرض
     در هر ردیف مثل قبل) - فقط چیدمان محتوای داخل هر کارت به دو ستون
     تقسیم می‌شه (طبق چیدمانی که خواسته شده). */
  .cards-grid-2col {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .cards-grid-2col .project-card,
  .cards-grid-2col .card {
    margin-bottom: 0;
    display: grid;
    grid-template-columns: 1fr 210px;
    gap: 16px;
    padding: 22px;
  }

  /* ستون محتوا (راست) */
  .cards-grid-2col .project-card > .project-card-content,
  .cards-grid-2col .card > .project-card-content { grid-column: 1; }
  .cards-grid-2col .project-card > .project-card-content { grid-row: 1 / -1; }
  .cards-grid-2col .card > .project-card-content { grid-row: 1; }

  .cards-grid-2col .compact-card-icon { width: 54px; height: 54px; font-size: 21px; border-radius: 16px; }
  .cards-grid-2col .freelancer-card-avatar { width: 70px; height: 70px; font-size: 27px; }
  .cards-grid-2col .project-card-title { font-size: 19px; white-space: normal; }
  .cards-grid-2col .project-card-desc { font-size: 13.5px; line-height: 1.7; }
  .cards-grid-2col .compact-card-subline span { font-size: 11.5px; }
  .cards-grid-2col .compact-card-subline .owner-avatar-xs,
  .cards-grid-2col .compact-card-subline img.owner-avatar-xs { width: 22px; height: 22px; }
  .cards-grid-2col .meta-item { font-size: 12px; gap: 5px; }
  .cards-grid-2col .meta-divider { height: 18px; }
  .cards-grid-2col .status-badge-sm { font-size: 11px; padding: 5px 12px; }
  .cards-grid-2col .tag-pill { font-size: 11px; padding: 5px 13px; }
  .cards-grid-2col .freelancer-card-tenure { font-size: 10.5px; }

  /* ستون کناری (چپ) - بودجه، دکمه‌ی اصلی، دکمه‌ی bookmark */
  .cards-grid-2col .project-card .compact-card-price,
  .cards-grid-2col .card > .compact-card-price {
    justify-content: center;
    background: color-mix(in srgb, var(--buttons) 8%, transparent);
    border-radius: 14px; padding: 13px 14px;
    font-size: 15px; font-weight: 800;
  }
  .cards-grid-2col .card > .compact-card-price {
    grid-column: 2; grid-row: 1; align-self: start;
  }
  .cards-grid-2col .compact-card-price i { font-size: 16px; }

  .cards-grid-2col .project-card .card-propose-btn {
    width: 100%; height: 46px; font-size: 13.5px; padding: 0;
    text-decoration: none;
  }

  .cards-grid-2col .card-side-form {
    grid-column: 2; grid-row: 3; align-self: end;
  }

  /* browse_projects.html: بودجه + دکمه‌ی ثبت پیشنهاد + دکمه‌ی bookmark
     تو یک بلوک واحد، وسط ستون کناری، بدون فاصله‌ی اضافی بین‌شون - وگرنه
     این سه تا تو کل ارتفاع ستون کناری پخش می‌شن و باعث می‌شن کل کارت
     بی‌خودی بلندتر از حد لازم بشه (دقیقاً همون اصلاحی که قبلاً برای
     دکمه‌های فریلنسرها انجام شد) */
  .cards-grid-2col .project-card-side-actions {
    grid-column: 2; grid-row: 1 / -1; align-self: center;
    display: flex; flex-direction: column; gap: 10px;
  }
  .cards-grid-2col .project-card-side-actions .compact-card-price,
  .cards-grid-2col .project-card-side-actions .card-propose-btn,
  .cards-grid-2col .project-card-side-actions .card-side-form {
    grid-column: unset; grid-row: unset; align-self: unset;
  }

  /* فریلنسرها: امتیاز اضافیِ ستون کناری حذف شد (همون امتیاز تو محتوای
     کارت هست). دو دکمه‌ی دعوت/bookmark تو یک بلوک واحد، وسط ستون کناری،
     بدون فاصله‌ی اضافی بین‌شون */
  .cards-grid-2col .freelancer-card-actions {
    grid-column: 2; grid-row: 1 / 4; align-self: center;
    display: flex; flex-direction: column; gap: 10px;
  }
  .cards-grid-2col .freelancer-card-actions .card-propose-btn,
  .cards-grid-2col .freelancer-card-actions .card-side-form {
    grid-column: unset; grid-row: unset; align-self: unset;
  }
  .cards-grid-2col .bookmark-btn,
  .cards-grid-2col .bookmark-btn-card {
    position: static; width: 100%; height: 46px; border-radius: 12px;
    background: var(--container); border: 1px solid var(--border);
    color: var(--text2); display: flex; align-items: center; justify-content: center;
    gap: 8px; font-size: 13px; font-weight: 700; padding: 0;
  }
  .cards-grid-2col .bookmark-btn.saved,
  .cards-grid-2col .bookmark-btn-card.saved {
    background: var(--buttons); color: #fff; border-color: var(--buttons);
  }
  .cards-grid-2col .bookmark-btn-label { display: inline; }

  /* آگهی‌های من: بودجه در ستون کناری، ولی نوار اکشن‌ها (ویرایش/ارتقا/
     مخفی/حذف) هنوز کل عرض کارت رو می‌گیره، زیر هر دو ستون */
  .cards-grid-2col .card > .my-project-actions-footer {
    grid-column: 1 / -1; grid-row: 2;
  }
}

/* ============================================================
   کامپوننت مشترک گالری تصاویر (لایت‌باکس) - برای هر جای پروژه که
   نیاز به نمایش چند عکس کنار هم باشه (جزئیات آگهی، در آینده پروفایل
   فریلنسر و ...)
   ============================================================ */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.gallery.gallery-1 { grid-template-columns: 1fr; }
.gallery.gallery-2 { grid-template-columns: 1fr 1fr; }
.gallery-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: var(--container);
}
.gallery.gallery-1 .gallery-thumb { aspect-ratio: 16/9; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gallery-thumb:hover img { transform: scale(1.05); }
.gallery-thumb-more {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
}

.lightbox-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4,10,8,.92);
  align-items: center; justify-content: center;
}
.lightbox-overlay.show { display: flex; }
.lightbox-image { max-width: 88vw; max-height: 82vh; border-radius: 10px; object-fit: contain; }
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,.22); }
.lightbox-close { top: 18px; left: 18px; }
.lightbox-prev { top: 50%; right: 18px; transform: translateY(-50%); }
.lightbox-next { top: 50%; left: 18px; transform: translateY(-50%); }
.lightbox-counter {
  position: absolute; bottom: 20px; right: 50%; transform: translateX(50%);
  color: #fff; font-size: 11px; background: rgba(255,255,255,.12); padding: 5px 12px; border-radius: 20px;
}

/* ============================================================
   کامپوننت مشترک مودال (برای فرم ثبت پیشنهاد، و هر مودال آینده)
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 190;
  background: rgba(4,10,8,.55);
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--card);
  border-radius: 22px;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  font-size: 14px; font-weight: 700;
}

/* --- badge های وضعیت تبلیغ (فوری/ویژه/برجسته) - هماهنگ در همه‌جا --- */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px; font-size: 9.5px; font-weight: 700;
}
.status-badge-urgent { background: rgba(239,68,68,.13); color: #EF4444; }
.status-badge-featured { background: rgba(147,51,234,.13); color: #9333EA; }
.status-badge-elevated { background: color-mix(in srgb, var(--buttons) 13%, transparent); color: var(--buttons); }
.status-badge-sm { padding: 2px 7px; font-size: 7.5px; gap: 3px; }

/* ============================================================
   ویزارد ۴مرحله‌ای ثبت/ویرایش آگهی - دقیقاً هماهنگ با نسخه‌ی فلاتر
   ============================================================ */
.wizard-timeline {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 22px; padding: 13px 12px 12px; margin-bottom: 14px;
}
.wizard-timeline-header { display: flex; align-items: center; margin-bottom: 12px; }
.wizard-timeline-title { flex: 1; font-size: 13px; font-weight: 700; }
.wizard-timeline-counter {
  background: var(--container); color: var(--buttons);
  border-radius: 30px; padding: 5px 9px; font-size: 8.5px; font-weight: 700;
}
.wizard-steps { position: relative; height: 74px; }
.wizard-steps-line {
  position: absolute; top: 21px; right: 32px; left: 32px;
  display: flex; gap: 4px;
}
.wizard-steps-line-seg { flex: 1; height: 3px; border-radius: 10px; background: var(--border); }
.wizard-steps-line-seg.completed { background: #3B82F6; }
.wizard-steps-row { display: flex; position: relative; z-index: 1; }
.wizard-step-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; background: none; border: none; font-family: inherit; }
.wizard-step-circle {
  width: 35px; height: 35px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--container); border: 1px solid var(--border); color: var(--text2);
  font-size: 15px; transition: all .2s;
}
.wizard-step-item.active .wizard-step-circle {
  width: 43px; height: 43px; background: #3B82F6; border-color: #3B82F6; color: #fff;
  font-size: 19px; box-shadow: 0 0 0 6px rgba(59,130,246,.15);
}
.wizard-step-item.done .wizard-step-circle { background: #3B82F6; border-color: #3B82F6; color: #fff; }
.wizard-step-label { font-size: 10px; color: var(--text2); }
.wizard-step-item.active .wizard-step-label { color: #3B82F6; font-weight: 700; }

.form-section-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 13px; margin-bottom: 12px; }
.form-section-header { display: flex; align-items: center; margin-bottom: 12px; gap: 9px; }
.form-section-icon {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--container); color: var(--buttons);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.form-section-title { flex: 1; font-size: 13px; font-weight: 700; }
.form-section-trailing { background: var(--container); color: var(--buttons); border-radius: 30px; padding: 5px 9px; font-size: 8.5px; font-weight: 700; }
.field-error { color: var(--danger); font-size: 10.5px; margin-top: 5px; }

.desc-counter { text-align: left; font-size: 9px; color: var(--text3); margin-top: 4px; }
.desc-counter.over { color: var(--danger); }

.category-picker-scroll { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px; }
.category-picker-card {
  width: 112px; flex-shrink: 0; padding: 7px; border-radius: 17px;
  background: var(--container); border: 1px solid var(--border);
  cursor: pointer; text-align: center; display: block;
}
.category-picker-card.selected { background: rgba(19,180,151,.1); border-color: var(--buttons); }
.category-picker-card input { display: none; }
.category-picker-img { position: relative; width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card); margin-bottom: 5px; }
.category-picker-img img { width: 100%; height: 100%; object-fit: contain; }
.category-picker-img i { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--text3); font-size: 22px; }
.category-picker-check {
  position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 8px;
  background: var(--buttons); color: #fff; display: none; align-items: center; justify-content: center; font-size: 12px;
}
.category-picker-card.selected .category-picker-check { display: flex; }
.category-picker-title { font-size: 8.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-picker-card.selected .category-picker-title { color: var(--buttons); font-weight: 700; }

.tag-picker-search { display: flex; align-items: center; gap: 7px; background: var(--container); border: 1px solid var(--border); border-radius: 15px; padding: 0 11px; }
.tag-picker-search input { flex: 1; border: none; background: transparent; padding: 12px 0; font-family: inherit; font-size: 12px; color: var(--text1); outline: none; text-align: right; }
.tag-picker-results { display: none; max-height: 110px; overflow-y: auto; background: var(--container); border: 1px solid rgba(19,180,151,.12); border-radius: 15px; margin-top: 8px; padding: 4px 8px; }
.tag-result-item { display: flex; align-items: center; gap: 8px; padding: 7px 5px; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,.05); font-size: 9.5px; }
.tag-result-item:last-child { border-bottom: none; }
.tag-result-icon { width: 26px; height: 26px; border-radius: 9px; background: var(--card); color: var(--buttons); display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.tag-selected-box { display: none; margin-top: 10px; background: rgba(19,180,151,.04); border: 1px solid rgba(19,180,151,.1); border-radius: 15px; padding: 9px; }
.tag-selected-label { font-size: 9px; font-weight: 700; color: var(--text2); margin-bottom: 7px; }
.tag-pill-removable {
  display: inline-flex; align-items: center; gap: 4px; background: rgba(19,180,151,.1);
  border-radius: 30px; padding: 5px 5px 5px 9px; margin: 0 4px 4px 0; font-size: 8.5px; font-weight: 700; color: var(--buttons);
}
.tag-pill-removable button {
  width: 19px; height: 19px; border-radius: 10px; background: rgba(19,180,151,.18); border: none;
  color: var(--buttons); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 10px; padding: 0;
}

.price-field-row { display: flex; gap: 8px; }
.price-field-box { flex: 1; }
.price-field-box input {
  width: 100%; border-radius: 15px; height: 52px; padding: 0 15px;
  font-family: inherit; font-size: 13px; text-align: right; direction: ltr; background: var(--card);
}
.price-field-box.min input { border: 1.5px solid rgba(34,197,94,.45); color: #16A34A; }
.price-field-box.max input { border: 1.5px solid rgba(21,128,61,.45); color: #15803D; }
.price-field-box input:focus { outline: none; }

.image-picker-banner {
  display: flex; align-items: center; gap: 11px; border-radius: 18px; padding: 14px;
  cursor: pointer; border: 1px solid rgba(19,180,151,.25); background: rgba(19,180,151,.055);
}
.image-picker-banner.full { cursor: default; border-color: var(--border); background: var(--container); }
.image-picker-icon {
  width: 46px; height: 46px; border-radius: 15px; background: var(--buttons); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.image-picker-banner.full .image-picker-icon { background: rgba(120,120,120,.35); }
.image-picker-text-title { font-size: 12px; font-weight: 700; }
.image-picker-text-sub { font-size: 9px; color: var(--text2); margin-top: 2px; }
.image-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.image-tile { position: relative; aspect-ratio: .95; border-radius: 14px; overflow: hidden; background: var(--container); }
.image-tile img { width: 100%; height: 100%; object-fit: cover; }
.image-tile-remove {
  position: absolute; top: 5px; left: 5px; width: 24px; height: 24px; border-radius: 8px;
  background: rgba(0,0,0,.55); color: #fff; border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px;
}
.image-tile-new-badge {
  position: absolute; bottom: 5px; right: 5px; background: var(--buttons); color: #fff;
  font-size: 7px; font-weight: 700; padding: 2px 6px; border-radius: 8px;
}

.wizard-bottom-bar { display: flex; gap: 8px; margin-top: 6px; }
.wizard-next-btn { flex: 1; height: 56px; border-radius: 19px; font-size: 14px; }
.wizard-prev-btn {
  width: 58px; height: 56px; border-radius: 19px; background: var(--container);
  border: 1px solid var(--border); color: var(--text1); display: flex; align-items: center;
  justify-content: center; font-size: 18px; cursor: pointer;
}

/* ============================================================
   کامپوننت مشترک گفتگو (لیست اتاق + بدنه‌ی پیام‌ها) - هم صفحه‌ی «پیام‌ها»
   (کارفرما/فریلنسر) و هم صفحه‌ی «تیکت‌های پشتیبانی» از این استایل‌های
   مشترک استفاده می‌کنن تا دوباره‌کاری نداشته باشیم.
   ============================================================ */
/* بدون حاشیه - این دو صفحه (پیام‌ها/تیکت‌ها) نباید هیچ padding/max-width
   ارثی از .app-content داشته باشن، چون کل فضای کنار سایدبار باید مال
   خودِ شل گفتگو باشه، بدون هیچ فضای خالی دور تا دورش. فقط پایینِ موبایل
   به اندازه‌ی navbar ثابت پایین فاصله لازمه، وگرنه composer زیرش پنهان
   می‌شه (.app-bottomnav با position:fixed روش سوار می‌شه). */
.app-content.app-content-full {
  padding: 0 0 var(--bottomnav-h) 0;
  max-width: none;
}
@media (min-width: 768px) {
  .app-content.app-content-full { padding: 0; max-width: none; }
}

.messages-shell { display: flex; gap: 14px; height: calc(100vh - var(--topbar-h) - 40px); }
.app-content-full .messages-shell {
  gap: 0;
  height: calc(100vh - var(--topbar-h) - var(--bottomnav-h));
}
@media (min-width: 768px) {
  .app-content-full .messages-shell { height: calc(100vh - var(--topbar-h)); }
}
.app-content-full .room-list-pane,
.app-content-full .conversation-pane {
  border-radius: 0;
}

.room-list-pane { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-y: auto; width: 100%; display: flex; flex-direction: column; }
.room-list-items { flex: 1; overflow-y: auto; }

.room-item { display: flex; align-items: center; gap: 10px; padding: 13px 14px; text-decoration: none; color: var(--text1); border-bottom: 1px solid var(--border); }
.room-item:hover { background: var(--container); }
.room-item.active { background: var(--container); border-right: 3px solid var(--buttons); }
.room-avatar {
  position: relative; width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--buttons), var(--accent2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.room-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.room-role-badge {
  position: absolute; bottom: -2px; left: -2px; width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 8px; color: #fff;
  border: 2px solid var(--card);
}
.role-employer { background: #3B82F6; }
.role-freelancer { background: #9333EA; }
.room-meta { flex: 1; min-width: 0; }
.room-meta .project-title { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-meta .last-msg { font-size: 10.5px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.unread-badge { background: var(--buttons); color: #fff; font-size: 9px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 20px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

.conversation-pane { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); display: none; flex-direction: column; flex: 1; overflow: hidden; }
.conversation-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.conversation-header-info { display: flex; flex-direction: column; }
.conversation-header-name { font-size: 12.5px; font-weight: 700; }
.conversation-header-seen { font-size: 9.5px; color: var(--text3); margin-top: 1px; }
.conversation-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.conversation-footer { padding: 10px 12px; border-top: 1px solid var(--border); }

/* توجه: صفحه RTL هست (dir="rtl")، پس تو flexbox، flex-start یعنی سمت
   راست و flex-end یعنی سمت چپ. علاوه بر جای کل ردیف پیام، همه‌ی عناصر
   جهت‌دار داخلش هم باید آینه بشن: عکس پروفایل باید کنار لبه‌ی بیرونی
   (خودم=راست، طرف مقابل=چپ) بشینه و گوشه‌ی تیز حباب هم رو به همون سمت
   باشه (سمت عکس پروفایل) - دقیقاً مثل بقیه‌ی اپ‌های چت. */
.msg-row { display: flex; align-items: flex-end; gap: 6px; justify-content: flex-end; }
.msg-row.own { justify-content: flex-start; }
.msg-avatar, .msg-avatar-placeholder { order: 1; }
.msg-row.own .msg-avatar, .msg-row.own .msg-avatar-placeholder { order: 0; }
.msg-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; object-fit: cover; background: var(--container); }
.msg-avatar-placeholder {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; background: var(--container);
  display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 11px;
}
.msg-bubble-wrap { max-width: 76%; display: flex; flex-direction: column; position: relative; order: 0; align-items: flex-end; }
.msg-row.own .msg-bubble-wrap { order: 1; align-items: flex-start; }
.msg-sender-name { font-size: 9px; color: var(--text3); margin-bottom: 3px; padding: 0 3px; }
.msg-bubble { padding: 10px 14px; border-radius: 16px; font-size: 12.5px; line-height: 1.8; word-break: break-word; }
.msg-row.own .msg-bubble { background: linear-gradient(135deg, var(--buttons), var(--accent2)); color: #fff; border-bottom-right-radius: 4px; }
.msg-row:not(.own) .msg-bubble { background: var(--container); color: var(--text1); border-bottom-left-radius: 4px; }
.msg-deleted { opacity: .75; font-style: italic; font-size: 11px; }
.msg-image { max-width: 220px; border-radius: 12px; display: block; cursor: pointer; }
.msg-audio { width: 240px; max-width: 100%; }
.msg-video { max-width: 240px; border-radius: 12px; display: block; }
.msg-file-row, .msg-link-row {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px;
  background: rgba(0,0,0,.06); color: inherit; text-decoration: none; font-size: 11.5px; max-width: 220px;
}
.msg-row.own .msg-file-row, .msg-row.own .msg-link-row { background: rgba(255,255,255,.16); }
.msg-file-row span, .msg-link-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg-reply-preview {
  display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text3);
  background: var(--container); border-left: 2px solid var(--buttons); border-radius: 8px;
  padding: 5px 9px; margin-bottom: 4px; text-decoration: none; max-width: 100%;
}
.msg-row.own .msg-reply-preview { border-left: none; border-right: 2px solid var(--buttons); background: var(--container); color: var(--text2); }
.msg-reply-preview span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.msg-footer { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 8.5px; color: var(--text3); }
.msg-edited-tag { font-style: italic; }
.msg-read-status { display: flex; }
.msg-read-status i { font-size: 10px; color: rgba(255,255,255,.7); }
/* پیش‌فرض: یک تیک (fa-check، ارسال‌شده). وقتی JS کلاس seen رو اضافه کنه
   (updateReadStatuses تو chat.js، که خودِ کلاس آیکون رو هم به
   fa-check-double سوییچ می‌کنه)، رنگ آبی روشن می‌شه - دقیقاً همون رنگ و
   آیکونی که سمت فلاتر استفاده می‌شه (Colors.lightBlueAccent.shade100 +
   Icons.done_all_rounded). */
.msg-read-status.seen i { color: #80D8FF; }

.msg-actions { display: flex; gap: 4px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.msg-bubble-wrap:hover .msg-actions { opacity: 1; }
.msg-action-btn {
  width: 24px; height: 24px; border-radius: 50%; background: var(--container); border: none;
  color: var(--text2); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 10px;
}
.msg-action-btn:hover { background: var(--buttons); color: #fff; }
.msg-delete-form { display: inline; }
.msg-delete-card {
  width: auto; height: 24px; padding: 0 8px; border-radius: 8px;
  background: var(--danger-bg); color: var(--danger);
}
.msg-delete-card:hover { background: var(--danger); color: #fff; }

@keyframes msg-highlight-flash {
  0%, 100% { background: transparent; }
  30% { background: rgba(19,180,151,.18); }
}
.msg-highlight .msg-bubble { animation: msg-highlight-flash 1.6s ease; border-radius: 16px; }

.proposal-card-full { align-self: center; width: 100%; max-width: 320px; background: var(--container); border: 1px solid var(--border); border-radius: 16px; padding: 14px; }
.proposal-card-header { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; margin-bottom: 10px; color: var(--buttons); }
.proposal-status { margin-right: auto; font-size: 8.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.proposal-status-pending { background: rgba(245,165,36,.15); color: #F5A524; }
.proposal-status-accepted { background: color-mix(in srgb, var(--buttons) 15%, transparent); color: var(--buttons); }
.proposal-status-rejected, .proposal-status-cancelled { background: rgba(229,72,77,.15); color: var(--danger); }
.proposal-status-completed { background: rgba(59,130,246,.15); color: #3B82F6; }
.proposal-card-body { display: flex; gap: 10px; margin-bottom: 8px; }
.proposal-stat { flex: 1; background: var(--card); border-radius: 10px; padding: 8px; text-align: center; font-size: 11px; font-weight: 700; }
.proposal-description { font-size: 10.5px; color: var(--text2); line-height: 1.7; background: var(--card); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.proposal-actions { display: flex; gap: 6px; }
.proposal-actions form { flex: 1; }

.reply-preview-bar {
  display: flex; align-items: center; gap: 8px; background: var(--container); border-radius: 10px;
  padding: 7px 10px; margin-bottom: 8px; font-size: 10.5px; color: var(--text2);
}
.reply-preview-bar button { background: none; border: none; color: var(--text3); cursor: pointer; margin-right: auto; }

.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-send-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none; flex-shrink: 0;
  background: linear-gradient(135deg, var(--buttons), var(--accent2)); color: #fff; cursor: pointer; font-size: 15px;
}
.composer-image-btn {
  width: 42px; height: 42px; border-radius: 50%; background: var(--container); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text2); flex-shrink: 0; font-size: 16px;
}
.composer-image-preview { display: none; align-items: center; gap: 8px; margin-bottom: 8px; }
.composer-image-preview img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.composer-image-preview button { background: var(--danger-bg); color: var(--danger); border: none; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; }

.composer-file-preview {
  display: none; align-items: center; gap: 8px; margin-bottom: 8px; padding: 7px 10px;
  background: var(--container); border-radius: 10px; font-size: 11px; color: var(--text2);
}
.composer-file-preview i.file-icon { color: var(--buttons); }
.composer-file-preview span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-file-preview button { background: var(--danger-bg); color: var(--danger); border: none; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; flex-shrink: 0; }

.composer-upload-progress {
  display: none; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 10px;
  background: var(--container); border-radius: 10px;
}
.composer-upload-progress.show { display: flex; }
.composer-upload-progress-bar-track {
  flex: 1; height: 6px; border-radius: 30px; background: var(--border); overflow: hidden;
}
.composer-upload-progress-bar {
  height: 6px; width: 0%; border-radius: 30px; background: linear-gradient(135deg, var(--buttons), var(--accent2));
  transition: width .15s ease;
}
.composer-upload-progress span { font-size: 10.5px; font-weight: 700; color: var(--buttons); flex-shrink: 0; }

@media (min-width: 768px) {
  .room-list-pane { width: 320px; flex-shrink: 0; }
  .conversation-pane { display: flex !important; }
}

/* ============================================================
   تیکت‌های پشتیبانی - وضعیت‌ها + سوالات متداول (آکاردئون + جستجو)
   ============================================================ */
.ticket-status-badge { font-size: 8.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.ticket-status-pending { background: rgba(245,165,36,.15); color: #F5A524; }
.ticket-status-in_progress { background: rgba(59,130,246,.15); color: #3B82F6; }
.ticket-status-closed { background: rgba(229,72,77,.15); color: var(--danger); }

.ticket-locked-banner {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 12px;
  background: var(--container); color: var(--text2); font-size: 11.5px;
}

.faq-search-box {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 0 14px; margin-bottom: 16px;
}
.faq-search-box i { color: var(--text3); font-size: 13px; }
.faq-search-box input { border: none; background: transparent; flex: 1; padding: 13px 0; font-family: inherit; font-size: 13px; color: var(--text1); outline: none; text-align: right; }

.faq-accordion-item { background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.faq-accordion-question {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer;
  font-size: 12.5px; font-weight: 700; color: var(--text1); user-select: none;
}
.faq-accordion-question i.faq-chevron { margin-right: auto; color: var(--text3); font-size: 12px; transition: transform .2s; }
.faq-accordion-item.open .faq-accordion-question i.faq-chevron { transform: rotate(180deg); color: var(--buttons); }
.faq-accordion-answer { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.faq-accordion-item.open .faq-accordion-answer { max-height: 600px; }
.faq-accordion-answer-inner { padding: 0 16px 16px; font-size: 11.5px; color: var(--text2); line-height: 1.9; }
.faq-empty-state { text-align: center; padding: 30px 16px; color: var(--text3); font-size: 12px; }

.faq-mini-results { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.faq-mini-item {
  display: block; background: var(--container); border-radius: 10px; padding: 9px 12px;
  font-size: 11px; color: var(--text1); text-decoration: none; cursor: pointer;
}
.faq-mini-item:hover { background: var(--border); }
.faq-mini-item .faq-mini-question { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.faq-mini-item .faq-mini-answer { color: var(--text2); margin-top: 4px; line-height: 1.7; display: none; }
.faq-mini-item.open .faq-mini-answer { display: block; }
.faq-mini-hint { font-size: 10px; color: var(--text3); margin-top: 6px; }

/* ============================================================
   صفحه‌ی عمومی قوانین و مقررات (پیش از لاگین هم قابل مشاهده)
   ============================================================ */
.rules-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--buttons) 0%, var(--accent2) 100%);
}
.rules-card {
  background: #fff;
  border-radius: 26px;
  padding: 30px 26px;
  max-width: 640px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.rules-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.rules-content {
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px 18px;
  background: var(--container);
  border-radius: 16px;
  border: 1px solid var(--border);
}
.rules-h1 { font-size: 20px; font-weight: 700; margin: 10px 0 8px; color: #0D2724; }
.rules-h2 { font-size: 17px; font-weight: 700; margin: 16px 0 8px; color: #0D2724; }
.rules-h3 { font-size: 15px; font-weight: 700; margin: 12px 0 6px; color: #0D2724; }
.rules-li { font-size: 12.5px; color: var(--text2); line-height: 1.9; margin-bottom: 6px; padding-right: 4px; }
.rules-p { font-size: 12.5px; color: var(--text2); line-height: 1.9; margin-bottom: 8px; text-align: justify; }
.rules-content b { color: #0D2724; }

/* ============================================================
   لینک داخل متن پیام چت/تیکت (chat_linkify) - کلیک‌پذیر و مشخص
   ============================================================ */
.msg-row.own .msg-text a { color: #fff; text-decoration: underline; font-weight: 700; }
.msg-row:not(.own) .msg-text a { color: var(--buttons); text-decoration: underline; font-weight: 700; }