/* ============================================================
   TopAffaires - Catalogue Public CSS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Cairo:wght@400;600;700;800&display=swap');

:root {
  --primary: #1a56db;
  --primary-dark: #1245b8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --nav-h: 68px;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-hover: 0 8px 32px rgba(0,0,0,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Outfit', sans-serif; background: var(--bg); color: var(--text); }
body.rtl { font-family: 'Cairo', sans-serif; }

/* ---- NAV ---- */
.catalog-nav {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}
.nav-inner {
  height: var(--nav-h); display: flex; align-items: center; gap: 16px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); font-weight: 800;
  font-size: 20px; white-space: nowrap;
}
.nav-logo {
  width: 38px; height: 38px; background: linear-gradient(135deg, #1a56db, #06b6d4);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 800;
  font-size: 14px; flex-shrink: 0;
}
.nav-search {
  flex: 1; max-width: 440px; display: flex;
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 50px;
  overflow: hidden; transition: border-color .2s, box-shadow .2s;
}
.nav-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.nav-search input {
  flex: 1; border: none; background: transparent; padding: 10px 16px;
  font-size: 14px; outline: none;
}
.nav-search button {
  background: var(--primary); border: none; padding: 0 18px; color: #fff; cursor: pointer;
}
.nav-search button:hover { background: var(--primary-dark); }
.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.rtl .nav-actions { margin-left: 0; margin-right: auto; }

.lang-switch {
  padding: 7px 14px; border: 1.5px solid var(--border); border-radius: 20px;
  font-size: 13px; font-weight: 600; text-decoration: none; color: var(--text);
  white-space: nowrap;
}
.lang-switch:hover { border-color: var(--primary); color: var(--primary); }

.btn-wa {
  display: flex; align-items: center; gap: 6px;
  background: #25d366; color: #fff; border-radius: 20px;
  padding: 8px 16px; text-decoration: none; font-size: 13px; font-weight: 600;
  white-space: nowrap;
}
.btn-wa:hover { background: #128c7e; color: #fff; }

.btn-special {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff;
  border-radius: 20px; padding: 8px 16px; text-decoration: none;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.btn-special:hover { opacity: .9; color: #fff; }

.btn-admin {
  width: 36px; height: 36px; border: 1.5px solid var(--border); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; color: var(--text-muted); font-size: 14px;
}
.btn-admin:hover { border-color: var(--primary); color: var(--primary); }

/* ---- HERO BANNERS ---- */
.catalog-hero { margin-top: 0; }
.hero-slide {
  height: 420px; background-size: cover; background-position: center;
  display: flex; align-items: flex-end; position: relative;
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, rgba(0,0,0,.1) 60%, transparent 100%);
}
.hero-content {
  position: relative; z-index: 2; padding: 40px;
  color: #fff;
}
.hero-content h2 { font-size: 36px; font-weight: 800; margin-bottom: 8px; text-shadow: 0 2px 8px rgba(0,0,0,.3); }
.hero-content p { font-size: 16px; opacity: .9; margin-bottom: 20px; }

.default-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  padding: 80px 20px; color: #fff;
}
.default-hero h1 { font-size: 48px; font-weight: 800; margin-bottom: 12px; }
.default-hero p { font-size: 18px; opacity: .8; margin-bottom: 28px; }

/* ---- CATEGORIES PILLS ---- */
.cat-pills {
  display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 0;
}
.cat-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 50px;
  background: var(--card); border: 1.5px solid var(--border);
  text-decoration: none; color: var(--text); font-size: 13px; font-weight: 500;
  white-space: nowrap; transition: all .2s;
}
.cat-pill:hover { border-color: var(--primary); color: var(--primary); }
.cat-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.cat-count { background: rgba(0,0,0,.08); padding: 1px 7px; border-radius: 10px; font-size: 11px; }
.cat-pill.active .cat-count { background: rgba(255,255,255,.25); }

/* ---- RESULTS BAR ---- */
.results-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.results-count { font-weight: 600; font-size: 14px; }

/* ---- PRODUCTS GRID ---- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.no-products { grid-column: 1/-1; text-align: center; padding: 60px 20px; }

/* ---- PRODUCT CARD ---- */
.product-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.product-link { text-decoration: none; color: inherit; flex: 1; }

.product-img {
  height: 200px; overflow: hidden; position: relative;
  background: #f1f5f9;
}
.product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.product-card:hover .product-img img { transform: scale(1.04); }
.product-img-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; color: #d1d5db;
}

.badge-featured {
  position: absolute; top: 10px; left: 10px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.rtl .badge-featured { left: auto; right: 10px; }

.badge-condition {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; color: #fff;
}
.rtl .badge-condition { right: auto; left: 10px; }

.product-body { padding: 14px; }
.product-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-weight: 600; }
.product-name {
  font-size: 15px; font-weight: 700; margin: 4px 0 10px; color: var(--text);
  line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.product-footer { display: flex; justify-content: space-between; align-items: center; }
.product-price { font-size: 18px; font-weight: 800; color: var(--primary); }
.product-stock { font-size: 12px; color: var(--success); font-weight: 600; }
.product-stock.low { color: var(--warning); }

.product-actions {
  padding: 12px 14px; border-top: 1px solid #f3f4f6;
  display: flex; gap: 8px;
}
.btn-reserve {
  flex: 1; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; padding: 9px; font-size: 13px;
  font-weight: 600; cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.btn-reserve:hover { background: var(--primary-dark); color: #fff; }

.btn-wa-small {
  width: 40px; height: 40px; background: #25d366; color: #fff;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; text-decoration: none; flex-shrink: 0;
  transition: background .2s;
}
.btn-wa-small:hover { background: #128c7e; color: #fff; }

/* ---- PRODUCT DETAIL ---- */
.product-detail-gallery .main-photo {
  border-radius: var(--radius); overflow: hidden; height: 400px; background: #f1f5f9;
}
.product-detail-gallery .main-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumbs { display: flex; gap: 8px; margin-top: 8px; }
.photo-thumbs .thumb {
  width: 72px; height: 72px; object-fit: cover; border-radius: 8px;
  cursor: pointer; border: 2px solid transparent; transition: border-color .2s;
}
.photo-thumbs .thumb.active, .photo-thumbs .thumb:hover { border-color: var(--primary); }

.product-detail-name { font-size: 26px; font-weight: 800; margin: 8px 0; }
.product-detail-price { font-size: 32px; font-weight: 800; color: var(--primary); margin: 12px 0; }
.product-detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.product-detail-desc { color: var(--text-muted); line-height: 1.7; margin-bottom: 16px; }
.product-specs { display: flex; gap: 12px; color: var(--text-muted); font-size: 14px; }
.product-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { background: #f1f5f9; color: var(--text-muted); padding: 4px 12px; border-radius: 20px; font-size: 12px; text-decoration: none; }
.tag:hover { background: #dbeafe; color: var(--primary); }
.product-cat-link { color: var(--primary); text-decoration: none; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.product-detail-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-reserve-lg {
  padding: 14px 28px; background: var(--primary); color: #fff;
  border-radius: 10px; font-size: 16px; font-weight: 700; text-decoration: none;
  display: flex; align-items: center; transition: background .2s;
}
.btn-reserve-lg:hover { background: var(--primary-dark); color: #fff; }
.btn-wa-lg {
  padding: 14px 24px; background: #25d366; color: #fff;
  border-radius: 10px; font-size: 16px; font-weight: 700; text-decoration: none;
  display: flex; align-items: center;
}
.btn-wa-lg:hover { background: #128c7e; color: #fff; }

/* ---- FOOTER ---- */
.catalog-footer { background: #0f172a; color: #94a3b8; padding: 48px 0 24px; margin-top: 60px; }
.footer-inner { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 32px; }
.footer-brand { display: flex; align-items: center; font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.footer-tagline { font-size: 13px; color: #64748b; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: #94a3b8; text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: #fff; }
.footer-social { display: flex; gap: 12px; align-items: flex-start; }
.footer-social a { width: 40px; height: 40px; background: rgba(255,255,255,.08); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.footer-social a:hover { background: var(--primary); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.06); padding-top: 20px; font-size: 13px; text-align: center; }

/* ---- WhatsApp FLOAT ---- */
.wa-float {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  width: 58px; height: 58px; background: #25d366; color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 28px; text-decoration: none; box-shadow: 0 4px 20px rgba(37,211,102,.5);
  animation: pulse 2.5s infinite;
}
.rtl .wa-float { right: auto; left: 24px; }
.wa-float:hover { background: #128c7e; color: #fff; animation: none; transform: scale(1.1); }
@keyframes pulse {
  0%,100% { box-shadow: 0 4px 20px rgba(37,211,102,.5); }
  50% { box-shadow: 0 4px 32px rgba(37,211,102,.8); }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .nav-actions .btn-special span,
  .nav-actions .btn-wa span { display: none; }
  .btn-special, .btn-wa { padding: 8px 10px; border-radius: 50%; }
  .hero-slide { height: 260px; }
  .hero-content { padding: 20px; }
  .hero-content h2 { font-size: 22px; }
  .default-hero h1 { font-size: 28px; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .nav-search { display: none; }
  .product-img { height: 160px; }
}
/* ---- FIX PRIX ARABE RTL ---- */
[dir="rtl"] .product-price,
[dir="rtl"] .product-detail-price {
  direction: ltr !important;
  unicode-bidi: embed !important;
  display: inline-block !important;
}
[dir="rtl"] .product-footer {
  flex-direction: row !important;
}
[dir="rtl"] .product-stock {
  direction: ltr !important;
  unicode-bidi: embed !important;
}
