/* ============================================================
   i18n.css — Design System + RTL/LTR + Animations
   ============================================================ */

/* --- Fonts --- */
@font-face {
  font-family: 'Hacen Tunisia LT';
  src: url('../fonts/Hacen Tunisia Lt Regular/Hacen Tunisia Lt Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Cairo:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
  --primary: #0A7E8C;
  --primary-light: #E8F4F5;
  --primary-dark: #005F6B;
  --primary-50: #F0F9FA;
  --primary-100: #E8F4F5;
  --primary-200: #B8E0E4;
  --primary-400: #4EAEB8;
  --primary-600: #0A7E8C;
  --primary-700: #005F6B;
  --accent: #83C5BE;
  --accent-light: #E8F8F6;
  --surface: #F8F9FA;
  --surface-alt: #EDF6F9;
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-arabic: 'Hacen Tunisia LT', 'Cairo', 'Tajawal', sans-serif;
}

/* --- Base --- */
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); color: var(--text-primary); background: var(--surface); }

/* --- Arabic --- */
html[lang="ar"] { font-family: var(--font-arabic); line-height: 1.75; }
html[lang="ar"] body { font-family: var(--font-arabic); }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { line-height: 1.4; font-weight: 700; }

/* --- RTL Logical Properties --- */
html[dir="rtl"] .flex-row { flex-direction: row-reverse; }
html[dir="rtl"] .space-x-1 > * + * { margin-inline-start: 0.25rem; margin-inline-end: 0; }
html[dir="rtl"] .space-x-2 > * + * { margin-inline-start: 0.5rem; margin-inline-end: 0; }
html[dir="rtl"] .space-x-3 > * + * { margin-inline-start: 0.75rem; margin-inline-end: 0; }
html[dir="rtl"] .space-x-4 > * + * { margin-inline-start: 1rem; margin-inline-end: 0; }
html[dir="rtl"] .space-x-6 > * + * { margin-inline-start: 1.5rem; margin-inline-end: 0; }

/* --- Modern Card --- */
.modern-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  transition: all 0.3s ease;
}
.modern-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  transform: translateY(-2px);
}

/* --- Animations --- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 300px; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes badgePulse { 0% { transform: scale(1); } 50% { transform: scale(1.4); } 100% { transform: scale(1); } }

.anim-fade-in-up { animation: fadeInUp 0.4s ease-out; }
.anim-fade-in { animation: fadeIn 0.3s ease-out; }
.anim-pulse { animation: pulse 2s infinite; }

/* --- Spinner --- */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid transparent; border-top-color: currentColor; border-radius: 50%; animation: spin 0.6s linear infinite; }
.spinner-sm { width: 12px; height: 12px; border-width: 1.5px; }

/* --- Badge Pulse --- */
.badge-pulse { animation: badgePulse 0.35s ease-out; }

/* --- Toast Notification --- */
.toast-notification {
  position: fixed; top: 5rem; z-index: 999;
  padding: 0.75rem 1.25rem; border-radius: 12px;
  font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  transition: all 0.3s ease;
  pointer-events: none;
}
html[dir="ltr"] .toast-notification { right: 1rem; }
html[dir="rtl"] .toast-notification { left: 1rem; }

/* --- Button Base --- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border-radius: 12px; font-weight: 600; font-size: 0.875rem;
  background: var(--primary); color: #fff; border: none;
  transition: all 0.25s ease; cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(10,126,140,0.3); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border-radius: 12px; font-weight: 600; font-size: 0.875rem;
  background: var(--primary-light); color: var(--primary); border: none;
  transition: all 0.25s ease; cursor: pointer;
}
.btn-secondary:hover { background: var(--primary-200); }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border-radius: 12px; font-weight: 600; font-size: 0.875rem;
  background: transparent; color: var(--text-secondary); border: 1.5px solid var(--border);
  transition: all 0.25s ease; cursor: pointer;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }

/* --- Input --- */
.input-modern {
  width: 100%; padding: 0.75rem 1rem; border-radius: 12px; font-size: 0.875rem;
  border: 1.5px solid var(--border); background: #fff;
  transition: all 0.2s ease; outline: none;
}
.input-modern:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,126,140,0.1); }

/* --- Section Title --- */
.section-title {
  font-size: 1.5rem; font-weight: 700; color: var(--text-primary);
  position: relative; padding-bottom: 0.25rem; margin: 1.5rem 0;
}
.section-title::after {
  content: ''; position: absolute; bottom: 0; inset-inline-start: 0;
  width: 40px; height: 3px; background: var(--primary); border-radius: 2px;
}

/* --- Skeleton --- */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px;
}

/* --- Price --- */
.price-primary { font-size: 1.25rem; font-weight: 800; color: var(--primary); }
.price-old { font-size: 0.875rem; color: var(--text-muted); text-decoration: line-through; }

/* --- Custom Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* --- KWD Price --- */
.price-kwd { direction: ltr; display: inline-flex; align-items: baseline; }
html[dir="rtl"] .price-kwd { direction: rtl; }

/* --- WhatsApp Float: EN always RIGHT, AR always LEFT.
   inset-inline-end already resolves to "right" in ltr and "left" in rtl
   natively, so one unconditional rule covers both languages. !important is
   needed because Tailwind's own `start-4`/`md:end-6` utility classes share
   the same specificity and are injected by the CDN script AFTER this
   stylesheet, so they'd otherwise win the tie (and setting both left+right
   with an explicit width is an over-constrained box the browser resolves
   unpredictably) — explicitly cancel `start-4`'s inset-inline-start here. */
.wa-float { inset-inline-start: auto !important; inset-inline-end: 1rem !important; }
@media (min-width: 768px) {
  .wa-float { inset-inline-end: 1.5rem !important; }
}

/* --- Progress Bar --- */
.progress-step { display: flex; align-items: center; gap: 0.5rem; }
.progress-dot { width: 10px; height: 10px; border-radius: 50%; background: #e5e7eb; flex-shrink: 0; transition: all 0.4s ease; }
.progress-dot.completed { background: var(--primary); box-shadow: 0 0 0 3px rgba(10,126,140,0.15); }
.progress-dot.current { background: var(--primary-dark); box-shadow: 0 0 0 4px rgba(10,126,140,0.2); animation: pulse 2s infinite; }
.progress-dot.rejected { background: var(--error); box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }
.progress-line { flex: 1; height: 2px; background: #e5e7eb; min-width: 16px; transition: background 0.4s ease; }
.progress-line.completed { background: var(--primary); }



/* --- Carousel Scroll --- */
.carousel-scroll { display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 0.5rem; }
.carousel-scroll > * { scroll-snap-align: start; flex-shrink: 0; }
.cursor-grab { cursor: grab; }
.cursor-grabbing { cursor: grabbing; }

/* --- Filter Sidebar --- */
@media (max-width: 1023px) {
  #filter-sidebar.block { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.3); overflow-y: auto; padding: 1rem; }
  #filter-sidebar.block > form { max-width: 320px; margin-left: auto; margin-right: auto; max-height: 90vh; overflow-y: auto; }
}

/* ============================================================
   MEGA MENU (cascata)
   ============================================================ */
.mega-panel {
  position: absolute; top: 100%; inset-inline-start: 0; inset-inline-end: 0;
  margin-inline: auto; z-index: 50;
  background: #fff; border-radius: 0 0 16px 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  min-width: 640px; max-width: 1200px; width: calc(100% - 2rem);
  opacity: 0; visibility: hidden;
  transform: translateY(8px); transition: all 0.2s ease;
  padding: 1.5rem;
}
.mega-panel.open {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.mega-column { min-width: 160px; }
.mega-column h4 {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--primary); margin-bottom: 0.75rem;
}
.mega-column a {
  display: block; font-size: 0.8125rem; color: var(--text-secondary);
  padding: 0.3rem 0; transition: color 0.15s;
}
.mega-column a:hover { color: var(--primary); }

.mega-cascade .mega-cat-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 0.6rem; border-radius: 10px;
  font-size: 0.8125rem; font-weight: 600; color: var(--text);
  transition: background 0.15s, color 0.15s;
}
.mega-cascade .mega-cat-item:hover { background: var(--primary-50, #e0f2f4); color: var(--primary); }
.mega-cascade .mega-cat-item.active {
  background: var(--primary-50, #e0f2f4); color: var(--primary);
}
.mega-cascade .mega-cat-item .mega-cat-chevron {
  opacity: 0; transform: translateX(-4px); transition: all 0.15s;
}
[dir="rtl"] .mega-cascade .mega-cat-item .mega-cat-chevron { transform: scaleX(-1) translateX(4px); }
.mega-cascade .mega-cat-item.active .mega-cat-chevron,
.mega-cascade .mega-cat-item:hover .mega-cat-chevron { opacity: 1; transform: none; }
[dir="rtl"] .mega-cascade .mega-cat-item.active .mega-cat-chevron,
[dir="rtl"] .mega-cascade .mega-cat-item:hover .mega-cat-chevron { opacity: 1; transform: scaleX(-1); }

.mega-cat-block { display: none; }
.mega-cat-block.active { display: block; }

.mega-cascade .mega-view-all {
  font-weight: 700; color: var(--primary) !important; font-size: 0.8125rem;
}
.mega-cascade .mega-offer-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--primary); color: #fff !important;
  font-weight: 700; font-size: 0.8125rem;
  padding: 0.45rem 0.9rem; border-radius: 999px;
  transition: opacity 0.15s;
}
.mega-cascade .mega-offer-link:hover { opacity: 0.85; color: #fff !important; }

/* ============================================================
   MOBILE ACCORDION MENU
   ============================================================ */
.accordion-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; cursor: pointer; user-select: none;
}
.accordion-body { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.accordion-body.open { max-height: 500px; }
.accordion-icon { transition: transform 0.3s ease; }
.accordion-header.open .accordion-icon { transform: rotate(180deg); }

/* ============================================================
   BANNER SLIDER
   ============================================================ */
.banner-wrapper {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-top: -1.5rem;
  position: relative;
}
[dir="rtl"] .banner-wrapper {
  margin-left: auto;
  margin-right: calc(-50vw + 50%);
}

.fullbleed {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}
[dir="rtl"] .fullbleed {
  margin-left: auto;
  margin-right: calc(-50vw + 50%);
}

.banner-slider {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 60vh;
  background: #f3f4f6;
}
@media (max-width: 767px) {
  .banner-slider {
    height: 30vh;
  }
}

.banner-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  transition: transform 0.5s ease-in-out;
  will-change: transform;
}

.banner-slide {
  flex: 0 0 100%;
  position: relative;
  overflow: hidden;
}

.banner-slide > a {
  display: block;
  width: 100%;
  height: 100%;
}

.banner-slide picture,
.banner-slide img {
  width: 100%;
  height: 100%;
  display: block;
}
.banner-slide img { object-fit: cover; }

/* Dots */
.banner-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 5;
}
.banner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all 0.3s;
}
.banner-dot.active {
  background: #fff;
  transform: scale(1.3);
}
.banner-dot:hover { background: rgba(255,255,255,0.7); }

/* Arrows - sempre visíveis */
.banner-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-size: 1.2rem;
  color: #374151;
  opacity: 1;
  visibility: visible;
}
.banner-arrow:hover {
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  transform: translateY(-50%) scale(1.05);
}
.banner-arrow.prev { inset-inline-start: 16px; }
[dir="rtl"] .banner-arrow { transform: translateY(-50%) scaleX(-1); }
[dir="rtl"] .banner-arrow:hover { transform: translateY(-50%) scaleX(-1) scale(1.05); }
.banner-arrow.next { inset-inline-end: 16px; }
@media (max-width: 767px) {
  .banner-arrow { width: 36px; height: 36px; font-size: 1rem; }
  .banner-arrow.prev { inset-inline-start: 8px; }
  .banner-arrow.next { inset-inline-end: 8px; }
}

/* ============================================================
   PROMO SHORTCUT CARDS
   ============================================================ */
.promo-card {
  border-radius: 16px; padding: 1.25rem;
  transition: all 0.3s ease; cursor: pointer;
  display: flex; align-items: center; gap: 1rem;
}
.promo-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

/* ============================================================
   COUNTDOWN TIMER
   ============================================================ */
.countdown-box {
  background: rgba(255,255,255,0.15); backdrop-filter: blur(4px);
  border-radius: 10px; padding: 0.5rem 0.75rem;
  text-align: center; min-width: 55px;
}
.countdown-box .num { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.countdown-box .label { font-size: 0.65rem; text-transform: uppercase; opacity: 0.7; }

/* ============================================================
   TRUST BAR
   ============================================================ */
.trust-bar { background: var(--primary-50); border-radius: 16px; }

/* ============================================================
   FOOTER ACCORDION (mobile)
   ============================================================ */
@media (max-width: 1023px) {
  .footer-col .footer-col-title { cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: space-between; }
  .footer-col .footer-col-body { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
  .footer-col .footer-col-body.open { max-height: 500px; }
  .footer-col .footer-col-icon { transition: transform 0.3s ease; }
  .footer-col .footer-col-title.open .footer-col-icon { transform: rotate(180deg); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .section-title { font-size: 1.25rem; }
  .btn-primary, .btn-secondary, .btn-outline { padding: 0.625rem 1.25rem; font-size: 0.8125rem; }
}
