/* ═══════════════════════════════════════════════════════════
   AFARIAT TUNISIE — Professional Stylesheet v2.0
   Design: RTL-first, bilingual Arabic/French, mobile-first
   ═══════════════════════════════════════════════════════════ */

/* ── 1. CSS Custom Properties ──────────────────────────────── */
:root {
  /* Brand */
  --clr-primary:     #E63946;
  --clr-primary-dk:  #C1121F;
  --clr-primary-lt:  #FFF0F0;
  --clr-accent:      #1D3557;
  --clr-accent-lt:   #E8EEF6;

  /* Neutrals */
  --clr-white:  #FFFFFF;
  --clr-bg:     #F5F5F5;
  --clr-surface:#FFFFFF;
  --clr-border: #E5E7EB;
  --clr-muted:  #6B7280;
  --clr-text:   #1F2937;
  --clr-text-lt:#374151;

  /* Status */
  --clr-success: #10B981;
  --clr-warning: #F59E0B;
  --clr-danger:  #EF4444;
  --clr-info:    #3B82F6;

  /* Typography */
  --font-ar:   'Cairo', system-ui, sans-serif;
  --font-fr:   'Inter', system-ui, sans-serif;
  --font-base: var(--font-ar);

  /* Spacing */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem;
  --sp-4: 1rem;    --sp-5: 1.25rem; --sp-6: 1.5rem;
  --sp-8: 2rem;    --sp-10:2.5rem;  --sp-12:3rem;

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-full:9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.16);

  /* Transitions */
  --t-fast:   150ms ease;
  --t-base:   250ms ease;
  --t-slow:   400ms ease;

  /* Header */
  --header-h: 68px;
}

/* ── 2. Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family:      var(--font-base);
  background-color: var(--clr-bg);
  color:            var(--clr-text);
  line-height:      1.6;
  direction:        rtl;
  -webkit-font-smoothing: antialiased;
}

html[lang="fr"] body { font-family: var(--font-fr); direction: ltr; }

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; cursor: pointer; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── 3. Layout ──────────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding-inline: var(--sp-4);
}

.section { padding-block: var(--sp-10); }

.hidden { display: none !important; }
.w-full  { width: 100%; }
.mb-2    { margin-bottom: var(--sp-2); }
.mt-3    { margin-top: var(--sp-3); }

/* ── 4. Buttons ─────────────────────────────────────────────── */
.btn {
  display:        inline-flex;
  align-items:    center;
  gap:            var(--sp-2);
  padding:        var(--sp-2) var(--sp-5);
  border-radius:  var(--r-md);
  font-weight:    600;
  font-size:      0.9rem;
  transition:     background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  white-space:    nowrap;
  user-select:    none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background:   var(--clr-primary);
  color:        var(--clr-white);
}
.btn-primary:hover { background: var(--clr-primary-dk); box-shadow: 0 4px 14px rgba(230,57,70,.3); }

.btn-ghost {
  background:   transparent;
  color:        var(--clr-text);
  border:       1.5px solid var(--clr-border);
}
.btn-ghost:hover { background: var(--clr-bg); }

.btn-outline {
  background:   transparent;
  color:        var(--clr-primary);
  border:       1.5px solid var(--clr-primary);
}
.btn-outline:hover { background: var(--clr-primary-lt); }

.btn-hero {
  background:   var(--clr-white);
  color:        var(--clr-primary);
  padding:      var(--sp-3) var(--sp-8);
  font-size:    1rem;
  border-radius:var(--r-full);
  box-shadow:   var(--shadow-md);
}
.btn-hero:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.btn-full { width: 100%; justify-content: center; }

.btn-danger { background: var(--clr-danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn[disabled], .btn.loading {
  opacity: 0.65;
  cursor:  not-allowed;
  pointer-events: none;
}
.btn.loading::after {
  content: '';
  width:  16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-inline-start: var(--sp-2);
}

.icon-btn { padding: var(--sp-2) var(--sp-3); }

/* ── 5. Header ──────────────────────────────────────────────── */
.header {
  position:   sticky;
  top:        0;
  z-index:    1000;
  background: var(--clr-white);
  box-shadow: 0 1px 0 var(--clr-border), var(--shadow-sm);
  height:     var(--header-h);
}

.header-inner {
  display:        flex;
  align-items:    center;
  gap:            var(--sp-4);
  height:         100%;
}

/* Logo */
.logo {
  display:     flex;
  align-items: center;
  gap:         var(--sp-2);
  flex-shrink: 0;
}
.logo-mark {
  width:           38px; height: 38px;
  background:      var(--clr-primary);
  color:           white;
  border-radius:   var(--r-md);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       1.3rem;
  font-weight:     800;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-ar   { font-size: 1.1rem; font-weight: 800; color: var(--clr-primary); }
.logo-fr   { font-size: 0.7rem; font-weight: 600; color: var(--clr-muted); letter-spacing: .05em; }

/* Search */
.header-search { flex: 1; max-width: 520px; }
.search-wrap {
  display:       flex;
  align-items:   center;
  background:    var(--clr-bg);
  border:        1.5px solid var(--clr-border);
  border-radius: var(--r-full);
  padding:       var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-4);
  gap:           var(--sp-2);
  transition:    border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-wrap:focus-within {
  border-color: var(--clr-primary);
  box-shadow:   0 0 0 3px rgba(230,57,70,.12);
}
.search-icon  { color: var(--clr-muted); flex-shrink: 0; }
.search-input { flex: 1; border: none; background: transparent; font-size: .9rem; outline: none; min-width: 0; }
.search-btn   { background: var(--clr-primary); color: white; padding: var(--sp-2) var(--sp-4); border-radius: var(--r-full); font-weight: 600; font-size: .85rem; transition: background var(--t-fast); flex-shrink: 0; }
.search-btn:hover { background: var(--clr-primary-dk); }

/* Nav */
.header-nav   { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.nav-guest, .nav-user { display: flex; align-items: center; gap: var(--sp-2); }

/* Avatar menu */
.avatar-menu    { position: relative; }
.avatar-btn     { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-1); border-radius: var(--r-full); border: 1.5px solid var(--clr-border); transition: border-color var(--t-fast); }
.avatar-btn:hover { border-color: var(--clr-primary); }
.avatar-img     { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--clr-bg); }
.avatar-name    { font-size: .85rem; font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-dropdown {
  position:   absolute;
  top:        calc(100% + 8px);
  inset-inline-end: 0;
  background: var(--clr-white);
  border:     1px solid var(--clr-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width:  180px;
  overflow:   hidden;
  opacity:    0;
  transform:  translateY(-8px);
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
  z-index:    100;
}
.avatar-dropdown.open { opacity: 1; transform: none; pointer-events: auto; }
.avatar-dropdown a    { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); font-size: .9rem; transition: background var(--t-fast); }
.avatar-dropdown a:hover { background: var(--clr-bg); }
.avatar-dropdown a i  { color: var(--clr-muted); width: 16px; }

/* Lang toggle */
.lang-toggle  { display: flex; border: 1.5px solid var(--clr-border); border-radius: var(--r-full); overflow: hidden; }
.lang-btn     { padding: 4px 10px; font-size: .8rem; font-weight: 700; transition: background var(--t-fast), color var(--t-fast); }
.lang-btn.active { background: var(--clr-primary); color: white; }

/* Mobile menu button */
.mobile-menu-btn { display: none; padding: var(--sp-2); font-size: 1.1rem; }

.mobile-menu { background: var(--clr-white); border-top: 1px solid var(--clr-border); padding-block: var(--sp-4); }
.mobile-menu-inner { display: flex; flex-direction: column; gap: var(--sp-2); }
.mobile-nav-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); font-weight: 600; transition: background var(--t-fast); width: 100%; }
.mobile-nav-item:hover { background: var(--clr-bg); }
.mobile-nav-item.danger { color: var(--clr-danger); }

/* ── 6. Hero ─────────────────────────────────────────────────── */
.hero {
  background:    linear-gradient(135deg, var(--clr-accent) 0%, #2D5E9B 60%, var(--clr-primary) 100%);
  padding-block: var(--sp-12) var(--sp-10);
  color:         var(--clr-white);
}
.hero-inner   { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); }
.hero-text    { flex: 1; }
.hero-title   { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.25; margin-bottom: var(--sp-3); }
.hero-sub     { font-size: 1.05rem; opacity: .9; margin-bottom: var(--sp-6); }
.hero-stats   { display: flex; gap: var(--sp-6); flex-shrink: 0; }
.stat         { text-align: center; }
.stat-num     { display: block; font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label   { font-size: .8rem; opacity: .8; margin-top: var(--sp-1); }

/* ── 7. Section Title ───────────────────────────────────────── */
.section-title {
  font-size:     1.4rem;
  font-weight:   800;
  color:         var(--clr-accent);
  margin-bottom: var(--sp-6);
  position:      relative;
  padding-bottom:var(--sp-3);
}
.section-title::after {
  content:    '';
  position:   absolute;
  bottom:     0;
  inset-inline-start: 0;
  width:      48px;
  height:     3px;
  background: var(--clr-primary);
  border-radius: var(--r-full);
}

/* ── 8. Categories Grid ─────────────────────────────────────── */
.categories-section { background: var(--clr-white); }
.categories-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--sp-3); }

.category-card {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            var(--sp-2);
  padding:        var(--sp-4) var(--sp-3);
  background:     var(--clr-bg);
  border-radius:  var(--r-lg);
  border:         1.5px solid transparent;
  cursor:         pointer;
  transition:     all var(--t-base);
  text-align:     center;
}
.category-card:hover, .category-card.active {
  background:    var(--clr-primary-lt);
  border-color:  var(--clr-primary);
  transform:     translateY(-3px);
  box-shadow:    var(--shadow-sm);
}
.category-icon {
  width:           52px; height: 52px;
  background:      var(--clr-accent-lt);
  border-radius:   var(--r-md);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       1.3rem;
  color:           var(--clr-accent);
  transition:      background var(--t-base), color var(--t-base);
}
.category-card:hover .category-icon, .category-card.active .category-icon {
  background: var(--clr-primary);
  color:      white;
}
.category-name  { font-size: .82rem; font-weight: 700; color: var(--clr-text); line-height: 1.3; }
.category-count { font-size: .72rem; color: var(--clr-muted); font-weight: 500; }

/* ── 9. Filter Bar ──────────────────────────────────────────── */
.filter-bar {
  background:    var(--clr-white);
  border-block:  1px solid var(--clr-border);
  padding-block: var(--sp-3);
  transition:    box-shadow var(--t-base);
}
.filter-bar.stuck { box-shadow: var(--shadow-md); }
.sticky-filter    { position: sticky; top: var(--header-h); z-index: 900; }

.filter-inner {
  display:     flex;
  align-items: center;
  gap:         var(--sp-2);
  flex-wrap:   wrap;
}
.filter-select, .filter-input {
  border:        1.5px solid var(--clr-border);
  border-radius: var(--r-sm);
  padding:       6px 10px;
  font-size:     .85rem;
  background:    var(--clr-white);
  color:         var(--clr-text);
  transition:    border-color var(--t-fast);
  min-width:     120px;
}
.filter-select:focus, .filter-input:focus {
  outline:      none;
  border-color: var(--clr-primary);
}
.price-range { display: flex; align-items: center; gap: var(--sp-1); }
.price-sep   { color: var(--clr-muted); font-weight: 600; }
.filter-input { width: 100px; }

/* ── 10. Ads Grid ───────────────────────────────────────────── */
.ads-section   { background: var(--clr-bg); }
.ads-header    { display: flex; align-items: baseline; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.ads-count     { font-size: .9rem; color: var(--clr-muted); }

.ads-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap:                   var(--sp-4);
}

/* Ad Card */
.ad-card {
  background:    var(--clr-white);
  border-radius: var(--r-lg);
  overflow:      hidden;
  border:        1px solid var(--clr-border);
  cursor:        pointer;
  transition:    transform var(--t-base), box-shadow var(--t-base);
  position:      relative;
  display:       flex;
  flex-direction:column;
}
.ad-card:hover  { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.ad-card:focus  { outline: 2px solid var(--clr-primary); }

.ad-card-img-wrap {
  position:       relative;
  aspect-ratio:   4/3;
  overflow:       hidden;
  background:     var(--clr-bg);
}
.ad-card-img {
  width: 100%; height: 100%;
  object-fit:  cover;
  transition:  transform var(--t-slow);
}
.ad-card:hover .ad-card-img { transform: scale(1.04); }

.ad-card-badge {
  position:     absolute;
  top:          var(--sp-2);
  inset-inline-start: var(--sp-2);
  display:      flex;
  gap:          var(--sp-1);
  flex-wrap:    wrap;
}
.badge {
  padding:       3px 8px;
  border-radius: var(--r-full);
  font-size:     .72rem;
  font-weight:   700;
  letter-spacing:.03em;
}
.badge-new    { background: var(--clr-success);  color: white; }
.badge-sold   { background: var(--clr-muted);    color: white; }
.badge-boost  { background: var(--clr-warning);  color: white; }
.badge-like-new { background: var(--clr-info);   color: white; }

.save-btn {
  position:  absolute;
  top:       var(--sp-2);
  inset-inline-end: var(--sp-2);
  background:rgba(255,255,255,.9);
  border-radius: 50%;
  width:     32px; height: 32px;
  display:   flex;
  align-items:center;
  justify-content:center;
  font-size: .9rem;
  color:     var(--clr-muted);
  transition:color var(--t-fast), background var(--t-fast);
  z-index:   2;
}
.save-btn:hover, .save-btn.saved { color: var(--clr-primary); background: white; }

.ad-card-body { padding: var(--sp-3) var(--sp-4); flex: 1; display: flex; flex-direction: column; gap: var(--sp-1); }
.ad-card-price { font-size: 1.15rem; font-weight: 800; color: var(--clr-primary); }
.ad-card-price .negotiable { font-size: .7rem; color: var(--clr-muted); font-weight: 500; margin-inline-start: var(--sp-1); }
.ad-card-title { font-size: .9rem; font-weight: 700; color: var(--clr-text); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ad-card-meta  { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: var(--sp-2); }
.ad-card-location, .ad-card-time { font-size: .75rem; color: var(--clr-muted); display: flex; align-items: center; gap: 4px; }

/* ── 11. Pagination ─────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-8); flex-wrap: wrap; }
.page-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--clr-border);
  background: var(--clr-white);
  font-weight: 600;
  transition: all var(--t-fast);
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover { border-color: var(--clr-primary); color: var(--clr-primary); }
.page-btn.active { background: var(--clr-primary); color: white; border-color: var(--clr-primary); }

/* ── 12. Modals ─────────────────────────────────────────────── */
.overlay {
  position:   fixed;
  inset:      0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  z-index:    2000;
  opacity:    0;
  pointer-events: none;
  transition: opacity var(--t-base);
}
.overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  position:   fixed;
  inset:      0;
  z-index:    2001;
  display:    flex;
  align-items:center;
  justify-content:center;
  padding:    var(--sp-4);
  pointer-events: none;
  opacity:    0;
  transition: opacity var(--t-base);
}
.modal.open { opacity: 1; pointer-events: auto; }

.modal-dialog {
  background:    var(--clr-white);
  border-radius: var(--r-xl);
  box-shadow:    var(--shadow-xl);
  width:         100%;
  max-width:     480px;
  max-height:    90vh;
  overflow-y:    auto;
  transform:     translateY(16px);
  transition:    transform var(--t-base);
  position:      relative;
  overscroll-behavior: contain;
}
.modal.open .modal-dialog { transform: none; }

.modal-dialog.modal-sm  { max-width: 380px; }
.modal-dialog.modal-lg  { max-width: 720px; }
.modal-dialog.modal-xl  { max-width: 960px; }

.modal-close {
  position:  absolute;
  top:       var(--sp-4);
  inset-inline-end: var(--sp-4);
  width:     36px; height: 36px;
  border-radius: 50%;
  background:rgba(0,0,0,.07);
  color:     var(--clr-text);
  font-size: 1.2rem;
  display:   flex; align-items:center; justify-content:center;
  transition:background var(--t-fast);
  z-index:   10;
}
.modal-close:hover { background: rgba(0,0,0,.14); }

.modal-header { padding: var(--sp-6) var(--sp-6) 0; }
.modal-header h2 { font-size: 1.3rem; font-weight: 800; color: var(--clr-accent); }
.modal-body  { padding: var(--sp-5) var(--sp-6) var(--sp-6); }

/* ── 13. Form Elements ──────────────────────────────────────── */
.form-field { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.form-label { font-size: .85rem; font-weight: 600; color: var(--clr-text-lt); }
.char-count { font-size: .75rem; color: var(--clr-muted); font-weight: 400; margin-inline-start: var(--sp-2); }

.form-input {
  width:         100%;
  padding:       10px 14px;
  border:        1.5px solid var(--clr-border);
  border-radius: var(--r-md);
  font-size:     .9rem;
  color:         var(--clr-text);
  background:    var(--clr-white);
  transition:    border-color var(--t-fast), box-shadow var(--t-fast);
  outline:       none;
}
.form-input:focus {
  border-color: var(--clr-primary);
  box-shadow:   0 0 0 3px rgba(230,57,70,.1);
}
.form-input.error { border-color: var(--clr-danger); }
.form-textarea    { resize: vertical; min-height: 120px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }

.input-with-icon { position: relative; }
.input-with-icon .form-input { padding-inline-end: 40px; }
.toggle-pw { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); color: var(--clr-muted); font-size: .9rem; }

.form-error { color: var(--clr-danger); font-size: .85rem; min-height: 20px; margin-bottom: var(--sp-2); }

.forgot-link, .modal-switch a { color: var(--clr-primary); font-size: .85rem; cursor: pointer; }
.forgot-link { display: block; text-align: end; margin-top: -8px; margin-bottom: var(--sp-4); }
.modal-switch { text-align: center; font-size: .85rem; color: var(--clr-muted); margin-top: var(--sp-4); }
.modal-switch a { font-weight: 700; }
.terms-note { font-size: .78rem; color: var(--clr-muted); text-align: center; margin-bottom: var(--sp-3); }

/* Password strength */
.pw-strength { height: 4px; border-radius: var(--r-full); background: var(--clr-border); margin-top: var(--sp-1); overflow: hidden; }
.pw-strength-bar { height: 100%; border-radius: var(--r-full); transition: width var(--t-base), background var(--t-base); }

/* Steps indicator */
.steps-indicator { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.step { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--clr-border); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: var(--clr-muted); transition: all var(--t-base); }
.step.active { border-color: var(--clr-primary); background: var(--clr-primary); color: white; }
.step.done   { border-color: var(--clr-success); background: var(--clr-success); color: white; }
.step-line   { flex: 1; height: 2px; background: var(--clr-border); }
.step-title  { font-size: 1rem; font-weight: 700; margin-bottom: var(--sp-4); color: var(--clr-accent); }

.form-step { display: none; }
.form-step.active { display: block; }
.step-actions { display: flex; gap: var(--sp-3); justify-content: space-between; margin-top: var(--sp-4); }

/* Upload zone */
.upload-zone {
  border:        2px dashed var(--clr-border);
  border-radius: var(--r-lg);
  padding:       var(--sp-8) var(--sp-4);
  text-align:    center;
  transition:    border-color var(--t-fast), background var(--t-fast);
  position:      relative;
  cursor:        pointer;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--clr-primary); background: var(--clr-primary-lt); }
.upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-icon { font-size: 2.5rem; color: var(--clr-primary); margin-bottom: var(--sp-2); }
.upload-text { font-weight: 600; margin-bottom: var(--sp-1); }
.upload-hint { font-size: .8rem; color: var(--clr-muted); }

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.preview-thumb {
  position:      relative;
  aspect-ratio:  1;
  border-radius: var(--r-md);
  overflow:      hidden;
  border:        2px solid var(--clr-border);
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview-thumb .remove-img {
  position:   absolute;
  top:        4px; inset-inline-end: 4px;
  background: rgba(0,0,0,.65);
  color:      white;
  border-radius: 50%;
  width:      22px; height: 22px;
  display:    flex; align-items: center; justify-content: center;
  font-size:  .75rem;
}

/* ── 14. Ad Detail ──────────────────────────────────────────── */
.ad-detail-content { padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-5); }

.ad-detail-gallery { position: relative; }
.gallery-main { aspect-ratio: 16/9; border-radius: var(--r-lg); overflow: hidden; background: var(--clr-bg); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); overflow-x: auto; }
.gallery-thumb { width: 70px; height: 70px; flex-shrink: 0; border-radius: var(--r-sm); overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color var(--t-fast); }
.gallery-thumb.active { border-color: var(--clr-primary); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

.ad-detail-header {}
.ad-detail-title { font-size: 1.5rem; font-weight: 800; color: var(--clr-text); margin-bottom: var(--sp-2); }
.ad-detail-price { font-size: 1.8rem; font-weight: 800; color: var(--clr-primary); }
.ad-detail-badges { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }

.ad-detail-meta  { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); background: var(--clr-bg); border-radius: var(--r-lg); padding: var(--sp-4); }
.meta-item label { font-size: .75rem; color: var(--clr-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.meta-item span  { font-weight: 700; font-size: .9rem; display: block; margin-top: 2px; }

.ad-detail-desc h3 { font-size: 1rem; font-weight: 700; margin-bottom: var(--sp-2); }
.ad-detail-desc p  { color: var(--clr-text-lt); line-height: 1.8; white-space: pre-wrap; }

.seller-card {
  display:       flex;
  align-items:   center;
  gap:           var(--sp-4);
  padding:       var(--sp-4);
  background:    var(--clr-bg);
  border-radius: var(--r-lg);
}
.seller-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--clr-border); }
.seller-info   { flex: 1; }
.seller-name   { font-weight: 700; }
.seller-since  { font-size: .8rem; color: var(--clr-muted); }
.contact-btn   { background: var(--clr-success); color: white; padding: var(--sp-3) var(--sp-5); border-radius: var(--r-md); font-weight: 700; display: flex; align-items: center; gap: var(--sp-2); transition: background var(--t-fast); }
.contact-btn:hover { background: #059669; }

/* ── 15. My Ads list ────────────────────────────────────────── */
.my-ad-item {
  display:       flex;
  gap:           var(--sp-3);
  padding:       var(--sp-3);
  border:        1px solid var(--clr-border);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
  align-items:   center;
}
.my-ad-thumb { width: 72px; height: 72px; flex-shrink: 0; border-radius: var(--r-sm); overflow: hidden; background: var(--clr-bg); }
.my-ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-ad-info  { flex: 1; min-width: 0; }
.my-ad-title { font-weight: 700; font-size: .9rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.my-ad-price { color: var(--clr-primary); font-weight: 700; font-size: .9rem; }
.my-ad-meta  { font-size: .75rem; color: var(--clr-muted); }
.my-ad-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }
.my-ad-actions .btn { padding: 6px 12px; font-size: .8rem; }

/* Status badge */
.status-pill { padding: 3px 10px; border-radius: var(--r-full); font-size: .72rem; font-weight: 700; }
.status-active  { background: #dcfce7; color: #16a34a; }
.status-sold    { background: #f1f5f9; color: #64748b; }
.status-expired { background: #fef9c3; color: #a16207; }
.status-deleted { background: #fee2e2; color: #dc2626; }

/* ── 16. Skeletons ──────────────────────────────────────────── */
.skeleton {
  background:  linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation:   shimmer 1.5s infinite;
  border-radius: var(--r-md);
}
.skeleton-grid { display: contents; }
.cat-skeleton  { height: 110px; }
.ad-skeleton   { height: 300px; }

/* ── 17. Toast ──────────────────────────────────────────────── */
.toast-container {
  position:  fixed;
  top:       var(--sp-4);
  inset-inline-end: var(--sp-4);
  z-index:   9999;
  display:   flex;
  flex-direction: column;
  gap:       var(--sp-2);
}
.toast {
  display:       flex;
  align-items:   center;
  gap:           var(--sp-3);
  padding:       var(--sp-3) var(--sp-4);
  background:    var(--clr-text);
  color:         white;
  border-radius: var(--r-md);
  box-shadow:    var(--shadow-lg);
  font-size:     .9rem;
  min-width:     260px;
  max-width:     360px;
  animation:     slideIn .3s ease, fadeOut .3s ease 2.7s forwards;
}
.toast.success { background: var(--clr-success); }
.toast.error   { background: var(--clr-danger);  }
.toast.warning { background: var(--clr-warning); color: var(--clr-text); }
.toast i       { font-size: 1rem; flex-shrink: 0; }

/* ── 18. Footer ─────────────────────────────────────────────── */
.footer      { background: var(--clr-accent); color: #cbd5e1; padding-top: var(--sp-10); }
.footer-inner{
  display:               grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap:                   var(--sp-8);
  padding-bottom:        var(--sp-8);
}
.footer-brand p { font-size: .85rem; line-height: 1.7; margin-top: var(--sp-2); opacity: .8; }
.footer-logo .logo-ar { color: white; }
.footer-logo .logo-fr { color: rgba(255,255,255,.6); }
.footer h4    { font-size: .9rem; font-weight: 700; color: white; margin-bottom: var(--sp-3); }
.footer ul    { list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.footer ul a  { font-size: .85rem; opacity: .8; transition: opacity var(--t-fast); }
.footer ul a:hover { opacity: 1; color: white; }
.social-link  { display: flex; align-items: center; gap: var(--sp-2); font-size: .85rem; opacity: .8; margin-bottom: var(--sp-2); transition: opacity var(--t-fast); }
.social-link:hover { opacity: 1; color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-block: var(--sp-4); }
.footer-bottom p { font-size: .8rem; opacity: .6; text-align: center; }

/* ── 19. Empty State ────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align:  center;
  padding:     var(--sp-12) var(--sp-4);
  color:       var(--clr-muted);
}
.empty-state i     { font-size: 3rem; margin-bottom: var(--sp-4); opacity: .4; }
.empty-state h3    { font-size: 1.1rem; font-weight: 700; margin-bottom: var(--sp-2); color: var(--clr-text); }
.empty-state p     { font-size: .9rem; }

/* ── 20. Animations ─────────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── 21. Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-stats { display: none; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --header-h: 60px; }

  .header-search { display: none; }
  .mobile-menu-btn { display: flex; }

  .nav-guest .btn-ghost,
  .nav-user .btn-ghost.icon-btn:not(.post-btn) { display: none; }
  .avatar-name { display: none; }

  .hero { padding-block: var(--sp-8); }
  .hero-title { font-size: 1.4rem; }

  .form-row { grid-template-columns: 1fr; }
  .modal-dialog.modal-xl { max-width: 100%; }
  .ad-detail-meta { grid-template-columns: 1fr; }

  .filter-inner { gap: var(--sp-1); }
  .filter-select { min-width: 100px; font-size: .8rem; }

  .footer-inner { grid-template-columns: 1fr; gap: var(--sp-5); }
}

@media (max-width: 480px) {
  .categories-grid { grid-template-columns: repeat(3, 1fr); }
  .ads-grid        { grid-template-columns: repeat(2, 1fr); }
  .my-ad-actions   { flex-direction: column; }
}

/* ── 22. Accessibility ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

:focus-visible { outline: 2px solid var(--clr-primary); outline-offset: 3px; }

/* ── 23. Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--clr-muted); }
