/* Optionnel: Cairo désactivé pour tester sans la police Cairo */
/* @import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap'); */

/* ==========================================================================
   SovereignPay Mauritanie — Design System & Production Stylesheet
   Plateforme Nationale Numérique & Switch Interbancaire MRU
   ========================================================================== */

:root {
  --color-surface: #faf8ff;
  --color-surface-dim: #d2d9f4;
  --color-surface-bright: #faf8ff;
  --color-surface-container-lowest: #ffffff;
  --color-surface-container-low: #f2f3ff;
  --color-surface-container: #eaedff;
  --color-surface-container-high: #e2e7ff;
  --color-surface-container-highest: #dae2fd;
  --color-on-surface: #131b2e;
  --color-on-surface-variant: #404944;
  --color-outline: #707974;
  --color-outline-variant: #bfc9c3;
  --color-primary: #003527;
  --color-on-primary: #ffffff;
  --color-primary-container: #064e3b;
  --color-on-primary-container: #80bea6;
  --color-secondary: #006c4e;
  --color-on-secondary: #ffffff;
  --color-secondary-container: #97f5cc;
  --color-on-secondary-container: #007353;
  --color-secondary-fixed: #97f5cc;
  --color-on-secondary-fixed: #002115;
  --color-tertiary: #4a2400;
  --color-tertiary-container: #6a3700;
  --color-tertiary-fixed: #ffdcc3;
  --color-error: #ba1a1a;
  --color-error-container: #ffdad6;
}

/* Reset & Ergonomie de base */
html {
  scroll-behavior: smooth;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  /* overflow-y intentionally unset – let the viewport scroll natively;
     overflow-x:clip does NOT force overflow-y:auto (unlike hidden). */
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Fluid media & containers */
img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

/* Large display container width set to 100rem (1600px) */
.max-w-7xl,
.max-w-\[1280px\],
.max-w-\[100rem\] {
  max-width: 100rem !important;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  color: var(--color-on-surface);
  position: relative;
  overflow-x: clip;
}

main {
  width: 100%;
  max-width: 100%;
  flex: 1 0 auto;
}

/* Smooth momentum scrolling on mobile for tables and carousels */
.overflow-x-auto,
[class*="overflow-x-"] {
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-x: contain;
}

/* Responsive typography & word wrap */
h1, h2, h3, h4, h5, h6, p, span, a, code, pre {
  overflow-wrap: break-word;
}

pre, code {
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Safe areas for mobile notches and modern home bars */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Prevent unwanted iOS Safari auto-zoom on inputs */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Scrollbar Utility */
.scrollbar-none::-webkit-scrollbar {
  display: none !important;
}
.scrollbar-none {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

/* Mobile tap target comfort */
@media (max-width: 640px) {
  .wallet-option-btn,
  .sim-service-btn,
  .tab-btn {
    touch-action: manipulation;
  }
}

/* Scrollbar fluide & esthétique */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f2f3ff;
}
::-webkit-scrollbar-thumb {
  background: #064e3b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #003527;
}

/* Animations Marquee Infinie - 100% Fluid & Seamless GPU-Accelerated */
@keyframes marquee-infinite {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

.animate-marquee {
  display: flex;
  width: max-content;
  animation: marquee-infinite 35s linear infinite;
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

.animate-marquee:hover {
  animation-play-state: paused;
}

.marquee-content {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Hero Background Subtle Ambient Zoom */
@keyframes heroZoom {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

.hero-bg-zoom {
  animation: heroZoom 28s ease-in-out infinite alternate;
  will-change: transform;
}

/* Scanner Laser Animation pour le QR Code Switch */
@keyframes scanLaser {
  0% { transform: translateY(0%); opacity: 0.2; }
  50% { transform: translateY(100%); opacity: 0.9; }
  100% { transform: translateY(0%); opacity: 0.2; }
}

.animate-scan {
  animation: scanLaser 2.4s ease-in-out infinite;
}

/* Navigation Links State */
.nav-link {
  position: relative;
  transition: all 0.2s ease-in-out;
}

.nav-link.active {
  background-color: var(--color-surface-container-high);
  color: var(--color-primary);
  font-weight: 700;
  border-radius: 0.5rem;
}

/* Drawer Mobile Menu */
#mobile-menu-drawer {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s ease;
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

#mobile-menu-drawer.closed {
  transform: translateX(100%);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

#mobile-menu-drawer.open {
  transform: translateX(0%);
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

/* Toast Notification */
#toast-notification {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

/* Impression Rapport / Quittance */
@media print {
  header, footer, nav, button, .no-print {
    display: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
}

/* ==========================================================================
   Internationalisation (i18n) & RTL (العربية) Support
   Full Right-To-Left layout when Arabic is active
   ========================================================================== */

/* --- Material Symbols: always LTR ligatures --- */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined' !important;
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr !important;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

/* --- Arabic Typography (Sans police Cairo : polices système natives & modernes) --- */
:root {
  --font-arabic-stack: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
}

html[lang="ar"],
html[lang="ar"] body,
[dir="rtl"],
[dir="rtl"] body {
  font-family: var(--font-arabic-stack);
}

.font-arabic,
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] p,
[dir="rtl"] span:not(.material-symbols-outlined),
[dir="rtl"] a,
[dir="rtl"] button,
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea {
  font-family: var(--font-arabic-stack);
}

/* --- RTL Text Alignment --- */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .text-left {
  text-align: right;
}

[dir="rtl"] .text-right {
  text-align: left;
}

/* --- Protect numbers, prices & phone numbers from RTL reversal --- */
[dir="rtl"] .ltr-num,
[dir="rtl"] [data-ltr],
[dir="rtl"] .price-tag,
[dir="rtl"] .phone-number {
  direction: ltr !important;
  unicode-bidi: isolate;
  display: inline-block;
}

/* --- Flip directional icons in RTL --- */
[dir="rtl"] .material-symbols-outlined[data-icon="arrow_forward"],
[dir="rtl"] .material-symbols-outlined[data-icon="chevron_right"],
[dir="rtl"] .material-symbols-outlined[data-icon="arrow_back"],
[dir="rtl"] .material-symbols-outlined[data-icon="chevron_left"] {
  transform: scaleX(-1);
}

/* --- Marquee reversal in RTL --- */
[dir="rtl"] .animate-marquee {
  animation-direction: reverse;
  direction: ltr !important;
}

[dir="rtl"] .marquee-content {
  direction: ltr !important;
}

/* Marquee parent containers must stay LTR to position correctly */
[dir="rtl"] .animate-marquee-wrapper,
[dir="rtl"] .overflow-hidden:has(> .animate-marquee) {
  direction: ltr !important;
}

/* --- Horizontal sliders / scroll containers: always LTR scroll axis --- */
[dir="rtl"] .overflow-x-auto,
[dir="rtl"] .scrollbar-none,
[dir="rtl"] [class*="overflow-x-"],
[dir="rtl"] [class*="snap-x"],
[dir="rtl"] .animate-marquee {
  direction: ltr !important;
}

/* Keep text inside slider items RTL (Arabic) */
[dir="rtl"] .overflow-x-auto > *,
[dir="rtl"] .scrollbar-none > *,
[dir="rtl"] [class*="overflow-x-"] > *,
[dir="rtl"] [class*="snap-x"] > * {
  direction: rtl;
}

/* --- Mobile Drawer in RTL: slides from LEFT --- */
[dir="rtl"] #mobile-menu-drawer {
  right: auto;
  left: 0;
  padding-right: 1.5rem;
  padding-left: max(1.5rem, env(safe-area-inset-left));
}

[dir="rtl"] #mobile-menu-drawer.closed {
  transform: translateX(-100%);
}

[dir="rtl"] #mobile-menu-drawer.open {
  transform: translateX(0%);
}

/* --- Flex row reversal in RTL (justify-between stays correct with dir) --- */
[dir="rtl"] .flex-row-reverse {
  flex-direction: row;
}

/* --- Protect specific inline elements that must stay LTR --- */
[dir="rtl"] code,
[dir="rtl"] pre,
[dir="rtl"] .font-mono {
  direction: ltr !important;
  unicode-bidi: isolate;
  text-align: left;
}


