/* ============================================================
   TopAffaires — Public Catalog CSS
   Modern, responsive, mobile-first storefront
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  --primary:      #1a56db;
  --primary-dark: #1040b0;
  --accent:       #ff5a1f;
  --green:        #0e9f6e;
  --dark:         #111928;
  --gray-900:     #1f2937;
  --gray-700:     #374151;
  --gray-500:     #6b7280;
  --gray-200:     #e5e7eb;
  --gray-100:     #f3f4f6;
  --white:        #ffffff;
  --radius:       12px;
  --shadow:       0 2px 8px rgba(0,0,0,.08);
  --shadow-md:    0 8px 24px rgba(0,0,0,.12);
  --transition:   all .25s ease;
  --font:         'Poppins', sans-serif;
  --font-ar:      'Cairo', sans-serif;
}

[dir="rtl"] { font-family: var(--font-ar); }
[dir="ltr"] { font-family: var(--font); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: #f8f9fb; color: var(--gray-900); }

img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: var(--white);
  box-shadow: 0 1px 8px rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  color: var(--primary);
  letter-spacing: -.3px;
}

.navbar-logo .logo-dot {
  width: 36px; height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900;
}

.navbar-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}

.navbar-search input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1.5px solid var(--gray-200);
  border-radius: 50px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  background: var(--gray-100);
}
.navbar-search input:focus { border-color: var(--primary); background: white; }
.navbar-search svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--gray-500);
}
[dir="rtl"] .navbar-search input { padding: 10px 40px 10px 16px; }
[dir="rtl"] .navbar-search svg  { left: auto; right: 14px; }

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

.btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #25d366;
  color: white;
  padding: 9px 18px;
  border-radius: 50px;
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-wa:hover { background: #128c7e; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,211,102,.3); }
.btn-wa svg { width: 18px; height: 18px; fill: white; }

.lang-toggle {
  border: 1.5px solid var(--gray-200);
  border-radius: 50px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  background: white;
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ============================================================
   HERO BANNER (Swiper)
   ============================================================ */
.hero-banner {
  max-width: 1280px;
  margin: 24px auto 0;
  padding: 0 24px;
}

.banner-slide {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 21/7;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
}

.banner-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .7;
}

.banner-content {
  position: relative;
  z-index: 2;
  padding: 40px;
  color: white;
}
.banner-content h2 { font-size: clamp(20px, 3vw, 36px); font-weight: 800; margin-bottom: 8px; }
.banner-content p  { font-size: clamp(13px, 1.5vw, 16px); opacity: .85; }

.banner-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 3;
}
.banner-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  cursor: pointer;
  transition: var(--transition);
}
.banner-dot.active { background: white; width: 22px; border-radius: 4px; }

/* ============================================================
   CATEGORY FILTER
   ============================================================ */
.section { max-width: 1280px; margin: 32px auto; padding: 0 24px; }

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--gray-200);
  border-radius: 2px;
}

.cat-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.cat-scroll::-webkit-scrollbar { display: none; }

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--gray-200);
  background: white;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
  color: var(--gray-700);
}
.cat-chip:hover, .cat-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(26,86,219,.25);
}

/* ============================================================
   PRODUCT GRID
   ============================================================ */
.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.sort-select {
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: white;
  cursor: pointer;
  outline: none;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* ---- Product Card ---- */
.product-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.product-card-img {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--gray-100);
}
.product-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.product-card:hover .product-card-img img { transform: scale(1.05); }

.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: white;
  box-shadow: var(--shadow);
}
[dir="rtl"] .card-badge { left: auto; right: 10px; }

.card-badge.neuf    { color: #5b21b6; }
.card-badge.bon     { color: #065f46; }
.card-badge.recon   { color: #92400e; }

.qty-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,.6);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
[dir="rtl"] .qty-badge { right: auto; left: 10px; }

.out-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
}

.product-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-cat {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}

.product-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}
.product-price span { font-size: 13px; font-weight: 500; color: var(--gray-500); }

.product-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-reserve {
  flex: 1;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-align: center;
}
.btn-reserve:hover { background: var(--primary-dark); }
.btn-reserve:disabled { background: var(--gray-500); cursor: not-allowed; }

.btn-wa-small {
  width: 40px; height: 40px;
  background: #25d366;
  color: white;
  border: none;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-wa-small:hover { background: #128c7e; }
.btn-wa-small svg { width: 20px; height: 20px; }

/* Featured star */
.featured-star {
  position: absolute;
  top: 10px;
  left: 10px;
  color: #f59e0b;
  font-size: 18px;
}
[dir="rtl"] .featured-star { left: auto; right: 10px; }

/* ============================================================
   PRODUCT DETAIL MODAL
   ============================================================ */
.product-modal {
  max-width: 860px;
}
.modal-img-gallery { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.modal-thumb {
  width: 60px; height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid var(--gray-200);
  flex-shrink: 0;
  transition: var(--transition);
}
.modal-thumb:hover, .modal-thumb.active { border-color: var(--primary); }

/* ============================================================
   RESERVATION FORM (modal)
   ============================================================ */
.reservation-modal { max-width: 520px; }

.form-group-pub {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-label-pub {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}
.form-input-pub {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.form-input-pub:focus { border-color: var(--primary); }

/* ============================================================
   CUSTOM ORDER SECTION
   ============================================================ */
.custom-order-banner {
  max-width: 1280px;
  margin: 40px auto;
  padding: 0 24px;
}

.custom-order-card {
  background: linear-gradient(135deg, #1a56db 0%, #0e9f6e 100%);
  border-radius: 16px;
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  color: white;
  flex-wrap: wrap;
}

.custom-order-card h3 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.custom-order-card p  { font-size: 15px; opacity: .9; }

.btn-custom-order {
  background: white;
  color: var(--primary);
  border: none;
  border-radius: 50px;
  padding: 13px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.btn-custom-order:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,.7);
  margin-top: 80px;
  padding: 48px 24px 24px;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand .logo { font-size: 22px; font-weight: 800; color: white; margin-bottom: 12px; }
.footer-brand p { font-size: 13.5px; line-height: 1.7; }

.footer-col h4 { color: white; font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; font-size: 13.5px; }
.footer-col ul li a:hover { color: white; }

.footer-bottom {
  max-width: 1280px;
  margin: 0 auto;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  flex-wrap: wrap;
  gap: 10px;
}

/* WhatsApp FAB */
.wa-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px; height: 58px;
  background: #25d366;
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(37,211,102,.4);
  z-index: 999;
  transition: var(--transition);
  animation: pulse 2s infinite;
}
.wa-fab:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(37,211,102,.5); animation: none; }
.wa-fab svg { width: 28px; height: 28px; fill: white; }
[dir="rtl"] .wa-fab { right: auto; left: 28px; }

@keyframes pulse {
  0%,100% { box-shadow: 0 4px 20px rgba(37,211,102,.4); }
  50%      { box-shadow: 0 4px 32px rgba(37,211,102,.7); }
}

/* ============================================================
   MODAL (public)
   ============================================================ */
.pub-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all .25s ease;
}
.pub-modal-overlay.open { opacity: 1; visibility: visible; }

.pub-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  transform: scale(.95);
  transition: transform .25s ease;
}
.pub-modal-overlay.open .pub-modal { transform: scale(1); }
.pub-modal-lg { max-width: 860px; }

.pub-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.pub-modal-title { font-size: 17px; font-weight: 700; }
.pub-modal-close {
  background: none; border: none;
  font-size: 20px; cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  transition: var(--transition);
}
.pub-modal-close:hover { background: var(--gray-100); }
.pub-modal-body   { padding: 24px; }
.pub-modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; gap: 10px; justify-content: flex-end; }

/* Success state */
.success-state {
  text-align: center;
  padding: 32px;
}
.success-icon { font-size: 64px; margin-bottom: 16px; }
.success-state h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.success-state p  { color: var(--gray-500); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .navbar-search { display: none; }
  .navbar-inner  { padding: 0 16px; }
  .section       { padding: 0 16px; margin: 20px auto; }
  .hero-banner   { padding: 0 16px; margin-top: 16px; }
  .banner-slide  { aspect-ratio: 16/9; }
  .banner-content{ padding: 20px; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .footer-inner  { grid-template-columns: 1fr; gap: 24px; }
  .custom-order-card { flex-direction: column; text-align: center; padding: 28px 20px; }
}

@media (max-width: 420px) {
  .products-grid { grid-template-columns: 1fr; }
}
