/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; height: auto; }
/* Prevent CLS - reserve space for images */
.ad-card .card-img img { aspect-ratio: 16/12; object-fit: cover; width: 100%; height: 100%; }
.gallery-main img { aspect-ratio: 4/3; object-fit: contain; width: 100%; height: 100%; }
.ad-detail .detail-img img { aspect-ratio: 4/3; object-fit: cover; width: 100%; height: 100%; }
.hero { min-height: 320px; }
@media (max-width: 768px) { .hero { min-height: 280px; } }

/* ===== Loading ===== */
.loading-spinner { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; color: var(--text-secondary); }
.loading-spinner .spinner { width: 36px; height: 36px; border: 3px solid var(--border-color,#444); border-top-color: var(--primary,#e94560); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Accessibility ===== */
.skip-link { position: absolute; top: -40px; left: 0; background: var(--primary,#e94560); color: #fff; padding: 8px 16px; z-index: 99999; transition: top 0.2s; font-size: 14px; }
.skip-link:focus { top: 0; outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ===== RTL Support ===== */
body.rtl { direction: rtl; font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif; }
body.rtl .navbar .nav-links { margin-right: auto; margin-left: 0; }
body.rtl .search-box input { padding: 12px 20px 12px 120px; }
body.rtl .search-box button { right: auto; left: 4px; }
body.rtl .ad-card .card-actions { left: 10px; right: auto; }
body.rtl .sidebar { border-left: 1px solid var(--border); border-right: none; }
body.rtl .modal-header .close-btn { right: auto; left: 15px; }
body.rtl .header-left { display: flex; align-items: center; gap: 15px; }
body.rtl .navbar .nav-links li a i { margin-left: 5px; margin-right: 0; }
body.rtl .password-strength { direction: ltr; }
body.rtl .msg-item .msg-body { margin-right: 60px; margin-left: 0; }
body.rtl .msg-item .msg-time { text-align: left; }

/* ===== CSS Variables / Dark Mode ===== */
:root {
  --bg: #f0f2f5;
  --card-bg: #fff;
  --text: #1a1a2e;
  --text-secondary: #888;
  --border: #e0e0e0;
  --sidebar-bg: #1a1a2e;
  --sidebar-text: #fff;
  --navbar-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --hero-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  --hover-bg: rgba(255,255,255,0.08);
  --input-bg: #fff;
  --input-text: #333;
  --table-hover: #f9f9f9;
  --shadow: rgba(0,0,0,0.08);
  --badge-bg: #f0f2f5;
}
body.dark {
  --bg: #0d1117;
  --card-bg: #161b22;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --border: #30363d;
  --sidebar-bg: #0d1117;
  --sidebar-text: #e6edf3;
  --navbar-bg: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
  --hero-bg: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1c2333 100%);
  --hover-bg: rgba(255,255,255,0.05);
  --input-bg: #21262d;
  --input-text: #e6edf3;
  --table-hover: #1c2128;
  --shadow: rgba(0,0,0,0.3);
  --badge-bg: #21262d;
}
body { background: var(--bg); color: var(--text); }
body.dark .navbar { background: var(--navbar-bg); }
body.dark .hero { background: var(--hero-bg); }
body.dark .categories { background: var(--card-bg); }
body.dark .ad-card { background: var(--card-bg); }
body.dark .ad-card .card-img { background: #21262d; }
body.dark .sidebar { background: var(--sidebar-bg); }
body.dark .sidebar .nav-item:hover,
body.dark .sidebar .nav-item.active { background: var(--hover-bg); }
body.dark .auth-card { background: var(--card-bg); }
body.dark .ad-form-container { background: var(--card-bg); }
body.dark .profile-card { background: var(--card-bg); }
body.dark .stat-card { background: var(--card-bg); }
body.dark .table-container { background: var(--card-bg); }
body.dark td { border-bottom: 1px solid var(--border); }
body.dark tr:hover td { background: var(--table-hover); }
body.dark .form-group input,
body.dark .form-group select,
body.dark .form-group textarea { background: var(--input-bg); color: var(--input-text); border-color: var(--border); }
body.dark .filter-bar select,
body.dark .filter-bar input { background: var(--input-bg); color: var(--input-text); border-color: var(--border); }
body.dark .cat-item { background: var(--badge-bg); }
body.dark .modal { background: var(--card-bg); }
body.dark .modal-header .close-btn { background: var(--badge-bg); color: var(--text); }
body.dark .section-header h2 { color: var(--text); }
body.dark .ad-detail .detail-grid { background: var(--card-bg); }
body.dark .ad-detail .detail-img { background: #21262d; }
body.dark .ad-detail .detail-info .seller-info { background: var(--badge-bg); }
body.dark .msg-item { border-color: var(--border); }
body.dark .msg-item:hover { background: var(--table-hover); }
body.dark .msg-item.unread { background: rgba(233,69,96,0.08); }
body.dark .chat-box { background: var(--badge-bg); }
body.dark .chat-box .msg-bubble.sent { background: #e94560; }
body.dark .chat-box .msg-bubble.received { background: var(--card-bg); border: 1px solid var(--border); }
body.dark .profile-card .info-row { border-color: var(--border); }
body.dark .profile-card .profile-header { border-color: var(--border); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ===== Navigation ===== */
#navbar-container { min-height: 65px; contain: layout style; }
#footer-container { min-height: 108px; contain: layout style; }
#serviceNoticeBar { min-height: 41px; box-sizing: border-box; contain: layout style; }
@media (max-width: 600px) {
  #serviceNoticeBar { min-height: 62px; }
  #footer-container { min-height: 150px; }
}
.navbar {
  background: var(--navbar-bg);
  color: #fff;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 15px rgba(0,0,0,0.15);
}
.navbar .container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 65px;
}
.navbar .logo {
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e94560;
}
.navbar .logo span { color: #fff; }
.navbar .logo i { font-size: 28px; }
.navbar .logo-img { width: 34px; height: 34px; border-radius: 9px; display: block; }
.navbar .nav-links { display: flex; align-items: center; gap: 5px; }
.navbar .nav-links li a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.navbar .nav-links li a:hover,
.navbar .nav-links li a.active {
  background: rgba(255,255,255,0.12);
  color: #e94560;
}
.navbar .nav-links li a.post-ad-btn {
  background: #e94560;
  color: #fff;
  padding: 8px 18px;
  font-weight: 600;
}
.navbar .nav-links li a.post-ad-btn:hover { background: #d63851; }
.lang-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s;
}
.lang-toggle:hover { background: rgba(255,255,255,0.2); }
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  background: none;
  border: none;
  padding: 5px;
}
.hamburger span {
  width: 26px;
  height: 3px;
  background: #fff;
  margin: 3px 0;
  border-radius: 3px;
  transition: all 0.3s;
}

/* ===== Hero Section ===== */
.hero {
  background: var(--hero-bg);
  color: #fff;
  padding: 60px 20px;
  text-align: center;
  min-height: 320px;
  contain: layout style;
}
.hero h1 { font-size: 38px; margin-bottom: 12px; }
.hero p { font-size: 18px; opacity: 0.9; margin-bottom: 30px; }
.hero .search-box {
  max-width: 650px;
  margin: 0 auto;
  position: relative;
}
.hero .search-box input {
  width: 100%;
  padding: 15px 20px 15px 110px;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  outline: none;
  background: rgba(255,255,255,0.95);
  color: #333;
}
.hero .search-box input::placeholder { color: #555; opacity: 1; }
body.rtl .hero .search-box input { padding: 15px 110px 15px 20px; }

.hero .search-box button {
  position: absolute;
  left: 5px;
  top: 5px;
  bottom: 5px;
  padding: 0 25px;
  border: none;
  border-radius: 50px;
  background: #e94560;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.3s;
}
body.rtl .hero .search-box button { left: auto; right: 5px; }
.hero .search-box button:hover { background: #d63851; }

/* ===== Search Tabs ===== */
.search-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-tab {
  padding: 8px 20px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}
.search-tab:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.search-tab.active {
  background: #e94560;
  border-color: #e94560;
  color: #fff;
  font-weight: 600;
}

/* ===== Search Panels ===== */
.search-panel {
  display: none;
  max-width: 700px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}
.search-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.search-quick-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
.search-quick-filters select,
.search-quick-filters input {
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 13px;
  min-width: 110px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.3s, background 0.3s;
}
.search-quick-filters select:focus,
.search-quick-filters input:focus {
  background: rgba(255,255,255,0.25);
  border-color: #e94560;
}
.search-quick-filters select option { color: #333; background: #fff; }
.search-quick-filters input::placeholder { color: rgba(255,255,255,0.6); }
body.rtl .search-quick-filters select option { direction: rtl; }

.search-reset-btn {
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}
.search-reset-btn:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* ===== City Search ===== */
.search-box-city select {
  width: 100%;
  padding: 15px 50px 15px 20px;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  outline: none;
  background: rgba(255,255,255,0.95);
  color: #333;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
}
body.rtl .search-box-city select {
  padding: 15px 20px 15px 50px;
  background-position: right 16px center;
}
body.rtl .search-box-city select option { direction: rtl; }
.search-box-city select:focus { outline: 2px solid #e94560; }

/* ===== Advanced Search Grid ===== */
.advanced-search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(10px);
}
.adv-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  margin-bottom: 5px;
}
.adv-field select,
.adv-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.3s, background 0.3s;
}
.adv-field select:focus,
.adv-field input:focus {
  background: rgba(255,255,255,0.25);
  border-color: #e94560;
}
.adv-field select option { color: #333; background: #fff; }
body.rtl .adv-field select option { direction: rtl; }
.adv-field input::placeholder { color: rgba(255,255,255,0.5); }
.adv-search-btn { margin-top: 15px; width: 100%; justify-content: center; }

body.dark .search-quick-filters select,
body.dark .search-quick-filters input,
body.dark .adv-field select,
body.dark .adv-field input,
body.dark .search-reset-btn { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
body.dark .search-quick-filters select:focus,
body.dark .search-quick-filters input:focus,
body.dark .adv-field select:focus,
body.dark .adv-field input:focus { background: rgba(255,255,255,0.15); border-color: #e94560; }
body.dark .advanced-search-grid { background: rgba(255,255,255,0.05); }

/* ===== Categories ===== */
.categories {
  background: #fff;
  padding: 25px 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  background: var(--card-bg);
}
.categories .container {
  max-width: 1200px;
  margin: 0 auto;
}
.categories-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}
.cat-item {
  padding: 10px 22px;
  border-radius: 50px;
  background: var(--badge-bg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}
.cat-item:hover,
.cat-item.active {
  background: #e94560;
  color: #fff;
  border-color: #e94560;
}
.cat-item i { margin-right: 6px; }
body.rtl .cat-item i { margin-right: 0; margin-left: 6px; }

/* ===== Main Content ===== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
  content-visibility: auto;
  contain-intrinsic-size: 0 500px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}
.section-header h2 { font-size: 24px; font-weight: 700; color: var(--text); }
.section-header .view-all {
  color: #e94560;
  font-weight: 600;
  font-size: 14px;
}
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 25px;
}
.filter-bar select,
.filter-bar input {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--input-bg);
  color: var(--input-text);
}
.filter-bar select:focus,
.filter-bar input:focus { border-color: #e94560; }

/* ===== Ads Grid ===== */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}
.ad-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 0 320px;
  will-change: transform;
}
.ad-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}
.ad-card .card-img {
  height: 200px;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #999;
  overflow: hidden;
  position: relative;
}
.ad-card .card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ad-card .card-img .no-img {
  font-size: 48px;
  color: #bbb;
}
.ad-card .card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #e94560;
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
body.rtl .ad-card .card-badge { right: auto; left: 10px; }
.ad-card .featured-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #ffc107;
  color: #333;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
body.rtl .ad-card .featured-badge { left: auto; right: 10px; }
.ad-card .card-body { padding: 16px; }
.ad-card .card-body h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ad-card .card-body .price {
  font-size: 18px;
  font-weight: 700;
  color: #e94560;
  margin-bottom: 8px;
}
.ad-card .card-body .meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}
.ad-card .card-body .meta i { margin-right: 4px; }
body.rtl .ad-card .card-body .meta i { margin-right: 0; margin-left: 4px; }
.ad-card .card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.3s;
}
.ad-card:hover .card-actions { opacity: 1; }
body.rtl .ad-card .card-actions { right: auto; left: 10px; }
.ad-card .card-actions button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-card .card-actions .fav-btn:hover { background: #e94560; color: #fff; }
.ad-card .card-actions .del-btn:hover { background: #dc3545; color: #fff; }

/* ===== Buttons ===== */
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: #e94560; color: #fff; }
.btn-primary:hover { background: #d63851; }
.btn-secondary { background: #1a1a2e; color: #fff; }
.btn-secondary:hover { background: #2a2a4e; }
.btn-outline {
  background: transparent;
  border: 2px solid #e94560;
  color: #e94560;
}
.btn-outline:hover { background: #e94560; color: #fff; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #c82333; }
.btn-success { background: #28a745; color: #fff; }
.btn-success:hover { background: #218838; }
.btn-warning { background: #ffc107; color: #333; }
.btn-warning:hover { background: #e0a800; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 17px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--input-text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: #e94560; }
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group .error-text {
  color: #dc3545;
  font-size: 13px;
  margin-top: 4px;
  display: none;
}
.form-group.error input,
.form-group.error select,
.form-group.error textarea { border-color: #dc3545; }
.form-group.error .error-text { display: block; }
.form-group.success input { border-color: #28a745; }

/* ===== Password Strength ===== */
.password-strength {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}
.password-strength .bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}
.password-strength .bar.active.weak { background: #dc3545; }
.password-strength .bar.active.medium { background: #ffc107; }
.password-strength .bar.active.strong { background: #28a745; }
.password-strength .bar.active.very-strong { background: #1a7f37; }
.pw-strength-text { font-size: 12px; margin-top: 4px; display: block; }

/* ===== Auth Pages ===== */
.auth-page {
  min-height: calc(100vh - 65px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}
.auth-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 5px 30px var(--shadow);
}
.auth-card h2 {
  font-size: 28px;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text);
}
.auth-card p {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 30px;
}
.auth-card .auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}
.auth-card .auth-footer a { color: #e94560; font-weight: 600; }
.password-toggle { position: relative; }
.password-toggle input { padding-right: 45px !important; }
body.rtl .password-toggle input { padding-right: 16px !important; padding-left: 45px !important; }
.password-toggle .toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  font-size: 18px;
}
body.rtl .password-toggle .toggle-btn { right: auto; left: 12px; }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 14px;
  display: none;
}
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; display: block; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; display: block; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; display: block; }

/* ===== Dashboard Layout ===== */
.dashboard {
  display: flex;
  min-height: calc(100vh - 65px);
}
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 25px 0;
  flex-shrink: 0;
}
.sidebar .user-info {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 15px;
}
.sidebar .user-info .avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #e94560;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}
.sidebar .user-info h4 { font-size: 16px; }
.sidebar .user-info p { font-size: 13px; opacity: 0.7; }
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  border-right: 3px solid transparent;
}
body.rtl .sidebar .nav-item { border-right: none; border-left: 3px solid transparent; }
.sidebar .nav-item:hover,
.sidebar .nav-item.active {
  background: rgba(255,255,255,0.08);
  border-color: #e94560;
  color: #e94560;
}
.sidebar .nav-item i { width: 20px; text-align: center; }
.sidebar .nav-item .badge-count {
  margin-right: auto;
  background: #e94560;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.dashboard-content {
  flex: 1;
  padding: 30px;
  background: var(--bg);
  overflow-x: hidden;
}
.dashboard-content .page-title {
  font-size: 24px;
  margin-bottom: 25px;
  color: var(--text);
}
.dash-section { display: none; }
.dash-section.active { display: block; }

/* ===== Stats Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 10px var(--shadow);
  display: flex;
  align-items: center;
  gap: 18px;
}
.stat-card .stat-icon {
  width: 55px;
  height: 55px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
}
.stat-card .stat-info h3 { font-size: 26px; font-weight: 700; }
.stat-card .stat-info p { font-size: 14px; color: var(--text-secondary); }

/* ===== Tables ===== */
.table-container {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px var(--shadow);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead { background: #1a1a2e; color: #fff; }
th, td { padding: 12px 16px; text-align: left; font-size: 14px; }
body.rtl th, body.rtl td { text-align: right; }
th { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
td { border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--table-hover); }
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.action-btns button {
  padding: 5px 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s;
}
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active { background: #d4edda; color: #155724; }
.badge-banned { background: #f8d7da; color: #721c24; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-open { background: #fff3cd; color: #856404; }
.badge-resolved { background: #d4edda; color: #155724; }
.badge-dismissed { background: #e2e3e5; color: #383d41; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* bulk checkbox */
.bulk-checkbox { width: 18px; height: 18px; cursor: pointer; }

/* ===== Profile Info ===== */
.profile-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 10px var(--shadow);
  max-width: 700px;
}
.profile-card .profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.profile-card .profile-header .big-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #e94560;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}
.profile-card .info-row {
  display: flex;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.profile-card .info-row .label {
  font-weight: 600;
  width: 150px;
  color: var(--text-secondary);
  font-size: 14px;
}
.profile-card .info-row .value { font-size: 15px; color: var(--text); }

/* ===== Ad Form ===== */
.ad-form-container {
  max-width: 750px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 10px var(--shadow);
}
.ad-form-container h2 { margin-bottom: 25px; }

/* ===== Image Preview ===== */
.img-preview-container {
  margin-top: 10px;
  display: none;
}
.img-preview-container.show { display: block; }
.img-preview-container img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  border: 2px solid var(--border);
  object-fit: cover;
}

/* ===== Ad Detail ===== */
.ad-detail {
  max-width: 900px;
  margin: 30px auto;
  padding: 0 20px;
}
.ad-detail .detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 10px var(--shadow);
}
.ad-detail .detail-img {
  height: 350px;
  background: #e0e0e0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: #999;
  overflow: hidden;
}
.ad-detail .detail-img img { width: 100%; height: 100%; object-fit: cover; }
.ad-detail .detail-info h1 { font-size: 26px; margin-bottom: 12px; }
.ad-detail .detail-info .price-big {
  font-size: 28px;
  font-weight: 700;
  color: #e94560;
  margin-bottom: 20px;
}
.ad-detail .detail-info .desc {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.ad-detail .detail-info .detail-meta { margin-bottom: 20px; }
.ad-detail .detail-info .detail-meta p {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
}
.ad-detail .detail-info .detail-meta span { font-weight: 600; color: var(--text); }
.ad-detail .detail-info .seller-info {
  background: var(--badge-bg);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.ad-detail .detail-info .seller-info h4 { margin-bottom: 8px; font-size: 16px; }
.ad-detail .detail-info .seller-info p { font-size: 14px; color: var(--text-secondary); }

/* ===== Image Gallery ===== */
.detail-img-gallery { display: flex; flex-direction: column; gap: 10px; }
.gallery-main {
  position: relative;
  height: 350px;
  background: var(--badge-bg);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  z-index: 2;
}
.gallery-nav:hover { background: rgba(0,0,0,0.8); }
.gallery-prev { right: 10px; }
body.rtl .gallery-prev { right: auto; left: 10px; }
.gallery-next { left: 10px; }
body.rtl .gallery-next { left: auto; right: 10px; }
.gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}
.gallery-thumbs img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.5;
  border: 2px solid transparent;
  transition: all 0.3s;
  flex-shrink: 0;
}
.gallery-thumbs img:hover { opacity: 0.8; }
.gallery-thumbs img.active { opacity: 1; border-color: #e94560; }

/* ===== Images Preview (form) ===== */
.images-preview img { border-radius: 8px; object-fit: cover; }

/* ===== Inbox & Messages ===== */
.inbox-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  min-height: 500px;
}
.inbox-list {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 10px var(--shadow);
  overflow: hidden;
  max-height: 600px;
  overflow-y: auto;
}
.inbox-list .inbox-header {
  padding: 15px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
}
.msg-item {
  display: flex;
  gap: 12px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
  align-items: flex-start;
}
.msg-item:hover { background: var(--table-hover); }
.msg-item.unread { background: rgba(233,69,96,0.05); }
.msg-item.active { background: rgba(233,69,96,0.1); border-right: 3px solid #e94560; }
body.rtl .msg-item.active { border-right: none; border-left: 3px solid #e94560; }
.msg-item .msg-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #e94560;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.msg-item .msg-info { flex: 1; min-width: 0; }
.msg-item .msg-info h4 { font-size: 14px; margin-bottom: 3px; }
.msg-item .msg-info p { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-item .msg-time { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.msg-item .unread-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #e94560;
  flex-shrink: 0;
  margin-top: 5px;
}

.chat-area {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 10px var(--shadow);
  display: flex;
  flex-direction: column;
}
.chat-area .chat-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.chat-box {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  max-height: 400px;
  background: var(--badge-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-box .msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.chat-box .msg-bubble.sent {
  align-self: flex-end;
  background: #e94560;
  color: #fff;
  border-bottom-right-radius: 4px;
}
body.rtl .chat-box .msg-bubble.sent { border-bottom-right-radius: 12px; border-bottom-left-radius: 4px; }
.chat-box .msg-bubble.received {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
body.rtl .chat-box .msg-bubble.received { border-bottom-left-radius: 12px; border-bottom-right-radius: 4px; }
.chat-box .msg-bubble .bubble-time {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 4px;
  display: block;
}
.chat-input-area {
  display: flex;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid var(--border);
}
.chat-input-area input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--input-bg);
  color: var(--input-text);
}
.chat-input-area input:focus { border-color: #e94560; }
.chat-input-area button {
  padding: 10px 20px;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
}
.chat-input-area button:hover { background: #d63851; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 20px; color: var(--text); }
.modal-header .close-btn {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: none;
  background: #f0f0f0;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.modal-header .close-btn:hover { background: #e0e0e0; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.rtl .toast-container { right: auto; left: 20px; }
.toast {
  padding: 14px 20px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 5px 20px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
}
.toast-success { background: #28a745; }
.toast-error { background: #dc3545; }
.toast-info { background: #17a2b8; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
body.rtl .toast { animation-name: slideInRTL; }
@keyframes slideInRTL { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state i { font-size: 64px; margin-bottom: 15px; opacity: 0.5; }
.empty-state h3 { font-size: 20px; margin-bottom: 8px; color: var(--text-secondary); }

/* ===== Skeleton Loading ===== */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--badge-bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card { height: 320px; border-radius: 12px; }
.skeleton-img { height: 200px; border-radius: 12px 12px 0 0; }
.skeleton-text { height: 16px; margin: 8px 0; }
.skeleton-text-short { width: 60%; }

/* ===== Loading Spinner ===== */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top: 4px solid #e94560;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Warning Box ===== */
.warning-box {
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .ad-detail .detail-grid { grid-template-columns: 1fr; }
  .inbox-container { grid-template-columns: 1fr; }
  .inbox-list { max-height: 300px; }
}
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .navbar .nav-links {
    display: none;
    position: absolute;
    top: 65px;
    left: 0; right: 0;
    background: #1a1a2e;
    flex-direction: column;
    padding: 15px 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
  }
  .navbar .nav-links.show { display: flex; }
  .hero { padding: 40px 15px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  .hero .search-box input { padding: 12px 20px 12px 100px; font-size: 14px; }
  .hero .search-box button { padding: 0 16px; font-size: 13px; }
  .search-tabs { gap: 4px; }
  .search-tab { padding: 6px 14px; font-size: 12px; }
  .search-quick-filters select,
  .search-quick-filters input { min-width: 80px; font-size: 12px; padding: 6px 10px; }
  .search-quick-filters { gap: 5px; }
  .advanced-search-grid { grid-template-columns: 1fr 1fr; gap: 10px; padding: 15px; }
  .adv-field label { font-size: 12px; }
  .adv-field select,
  .adv-field input { font-size: 13px; padding: 8px 12px; }
  .dashboard { flex-direction: column; }
  .sidebar { width: 100%; padding: 15px 0; }
  .sidebar .nav-item { display: inline-flex; padding: 10px 16px; font-size: 13px; border: none; }
  .sidebar .user-info { display: none; }
  .sidebar .nav { display: flex; overflow-x: auto; padding: 0 10px; }
  .sidebar .nav-item.active { border-bottom: 3px solid #e94560; border-right: none; }
  body.rtl .sidebar .nav-item.active { border-left: none; }
  .dashboard-content { padding: 20px 15px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .ads-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .auth-card { padding: 25px 20px; }
  .ad-detail .detail-grid { padding: 20px; }
}
@media (max-width: 480px) {
  .ads-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 22px; }
  .navbar .logo { font-size: 20px; }
  .navbar .logo-img { width: 28px; height: 28px; }
  .search-tab { padding: 5px 10px; font-size: 11px; }
  .search-quick-filters select,
  .search-quick-filters input { min-width: 70px; font-size: 11px; padding: 5px 8px; }
  .advanced-search-grid { grid-template-columns: 1fr; }
  .search-box-city select { font-size: 14px; }
}
.pagination { text-align: center; padding: 12px 0; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.notif-bell-wrap { position: relative; display: inline-flex; align-items: center; }
.notif-bell-btn { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; padding: 6px 8px; position: relative; }
.notif-badge { position: absolute; top: -2px; inset-inline-end: -2px; background: #e94560; color: #fff; font-size: 10px; line-height: 1; padding: 3px 6px; border-radius: 10px; z-index: 5; }
.notif-dropdown { position: absolute; top: 40px; inset-inline-end: 0; width: 320px; max-width: 90vw; max-height: 400px; overflow-y: auto; background: var(--card-bg); color: var(--text-color); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.25); z-index: 2000; display: none; }
.notif-dropdown.show { display: block; }
.notif-dropdown-header { padding: 12px 15px; font-weight: 700; border-bottom: 1px solid var(--border); font-size: 14px; }
.notif-dropdown-item { display: block; padding: 10px 15px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; font-size: 13px; }
.notif-dropdown-item:hover { background: var(--badge-bg); }
.notif-dropdown-item .notif-title { font-weight: 600; display: block; margin-bottom: 3px; }
.notif-dropdown-item .notif-time { font-size: 11px; color: var(--text-secondary); display: block; margin-top: 4px; }
.notif-dropdown-empty { padding: 20px 15px; text-align: center; color: var(--text-secondary); font-size: 13px; }
