/* =============================================================================
 * DIEZ.SN — Design System Mobile-First
 * Version 2.0 — Aligné sur les maquettes officielles
 * =============================================================================
 * PRINCIPE : Mobile-first STRICT
 * - Tous les styles de base ciblent mobile (320-414px)
 * - Media queries étendent vers tablette/desktop avec min-width
 * - Aucun max-width par défaut
 *
 * CIBLE PRIMAIRE : iPhone SE / Galaxy A (360-414px, ~92% trafic Sénégal)
 *
 * STRUCTURE :
 * 1. Tokens (custom properties)
 * 2. Reset + base
 * 3. Typography
 * 4. Layout
 * 5. Composants : badges, buttons, inputs, cards
 * 6. Section title (MAJUSCULES + tracking)
 * 7. Hero (bandeau or)
 * 8. Product card (composant signature)
 * 9. Top bar mobile
 * 10. Bottom navigation
 * 11. Footer noir
 * 12. Animations
 * 13. Media queries (extension desktop)
 * ============================================================================ */


/* =============================================================================
 * 1. TOKENS DESIGN
 * ============================================================================ */

:root {
  /* --- COULEURS DE MARQUE --- */

  /* Or chaud : hero, header de cards, accents premium */
  --color-primary:       #C9941E;
  --color-primary-dark:  #A37815;
  --color-primary-light: #E5B848;

  /* Vert vif : CTA "Acheter", "Voir les offres", boutons play */
  --color-accent:        #16A34A;
  --color-accent-dark:   #128439;
  --color-accent-light:  #22C55E;

  /* Rouge bordeaux : badges réduction -%, alerts */
  --color-discount:      #9B2C2C;
  --color-discount-dark: #7F1D1D;
  --color-discount-light:#B83A3A;

  /* --- COULEURS NEUTRES --- */
  --color-bg:            #FAFAF7;          /* Fond app */
  --color-surface:       #FFFFFF;          /* Cards */
  --color-surface-alt:   #F5F5F5;          /* Footer cards, bandeaux secondaires */

  --color-ink:           #000000;          /* Noir pur (logo, titres) */
  --color-ink-2:         #1C1917;          /* Texte principal */
  --color-ink-3:         #44403C;          /* Texte secondaire */
  --color-ink-dim:       #78716C;          /* Placeholders, mentions */
  --color-line:          #E7E5E4;          /* Borders */

  /* Footer noir */
  --color-footer:        #1C1917;
  --color-footer-ink:    #E7E5E4;
  --color-footer-dim:    #A8A29E;

  /* --- TYPOGRAPHIE --- */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body:    'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* font-size base : 16px (CRITIQUE pour empêcher zoom iOS sur inputs) */
  --fs-xs:    0.75rem;    /* 12px */
  --fs-sm:    0.875rem;   /* 14px */
  --fs-base:  1rem;       /* 16px */
  --fs-lg:    1.125rem;   /* 18px */
  --fs-xl:    1.25rem;    /* 20px */
  --fs-2xl:   1.5rem;     /* 24px */
  --fs-3xl:   2rem;       /* 32px */
  --fs-4xl:   2.5rem;     /* 40px */

  --lh-tight:  1.2;
  --lh-normal: 1.5;
  --lh-loose:  1.75;

  /* --- ESPACEMENTS (système 4px) --- */
  --space-1:  0.25rem;    /*  4px */
  --space-2:  0.5rem;     /*  8px */
  --space-3:  0.75rem;    /* 12px */
  --space-4:  1rem;       /* 16px */
  --space-5:  1.25rem;    /* 20px */
  --space-6:  1.5rem;     /* 24px */
  --space-8:  2rem;       /* 32px */
  --space-10: 2.5rem;     /* 40px */
  --space-12: 3rem;       /* 48px */
  --space-16: 4rem;       /* 64px */

  /* --- BORDERS & RADIUS --- */
  --radius-sm:    6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* --- TOUCH TARGETS (norme HIG/Material) --- */
  --tap-target: 44px;

  /* --- SHADOWS --- */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);

  /* --- Z-INDEX --- */
  --z-base:       1;
  --z-dropdown:   10;
  --z-sticky:     20;
  --z-modal:      30;
  --z-toast:      40;
  --z-bottom-nav: 50;

  /* --- BOTTOM NAV --- */
  --bottom-nav-h: 64px;

  /* --- TRANSITIONS --- */
  --transition-fast:   150ms ease-out;
  --transition-normal: 250ms ease-out;
  --transition-slow:   400ms ease-out;
}


/* =============================================================================
 * 2. RESET + BASE
 * ============================================================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--color-ink-2);
  background: var(--color-bg);
  padding-bottom: var(--bottom-nav-h);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: var(--color-ink);
  text-decoration: none;
}


/* =============================================================================
 * 3. TYPOGRAPHIE
 * ============================================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  font-weight: 700;
  color: var(--color-ink);
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }


/* =============================================================================
 * 4. LAYOUT
 * ============================================================================ */

.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.stack > * + * {
  margin-top: var(--space-3);
}


/* =============================================================================
 * 5. COMPOSANTS — BUTTONS
 * ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap-target);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast), background var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--color-primary);
  color: var(--color-ink);
  font-weight: 700;
}

.btn-accent {
  background: var(--color-accent);
  color: white;
}

.btn-accent:hover {
  background: var(--color-accent-dark);
}

.btn-dark {
  background: var(--color-ink);
  color: white;
}

.btn-block {
  width: 100%;
}


/* =============================================================================
 * 5bis. COMPOSANTS — BADGES (-20%, 24H, 7J, etc.)
 * ============================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

/* Badge réduction rouge bordeaux (-20%, -30%) */
.badge-discount {
  background: var(--color-discount);
  color: white;
}

/* Badge durée or (24H, 7J) */
.badge-duration {
  background: var(--color-primary);
  color: var(--color-ink);
}

/* Badge "Flash" avec pulse animation */
.badge-flash {
  background: var(--color-discount);
  color: white;
  animation: pulse 2s ease-in-out infinite;
}


/* =============================================================================
 * 5ter. COMPOSANTS — INPUTS
 * ============================================================================ */

.input,
.textarea,
.select {
  width: 100%;
  min-height: var(--tap-target);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-base);
  color: var(--color-ink-2);
  background: var(--color-surface);
  border: 2px solid var(--color-line);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--color-primary);
}


/* =============================================================================
 * 6. SECTION TITLE (MAJUSCULES + LETTRAGE ESPACÉ)
 * ============================================================================
 * Style signature de la maquette : "SÉLECTION PREMIUM DU MOIS", "24H CHRONO"
 * ============================================================================ */

.section-title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--color-ink);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--space-8) 0 var(--space-6) 0;
  padding: 0 var(--space-4);
  line-height: var(--lh-tight);
}

.section-title__icon {
  display: inline-block;
  margin: 0 var(--space-2);
}


/* =============================================================================
 * 7. HERO (BANDEAU OR COMPACT)
 * ============================================================================
 * Style maquette : bandeau or avec gros titre + sous-titre + CTA vert
 * ============================================================================ */

.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  padding: var(--space-8) var(--space-4);
  margin: var(--space-4) calc(var(--space-4) * -1) var(--space-6);
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--color-ink);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-2);
}

.hero__subtitle {
  font-size: var(--fs-base);
  color: var(--color-ink-2);
  margin-bottom: var(--space-5);
  opacity: 0.9;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: var(--color-accent);
  color: white;
  font-weight: 700;
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  min-height: var(--tap-target);
}

.hero__cta:hover {
  background: var(--color-accent-dark);
}


/* =============================================================================
 * 8. PRODUCT CARD (composant signature DIEZ.SN)
 * ============================================================================
 * Inspiré directement de la maquette image 1 :
 * - Header or avec badge -% (gauche) et badge durée (droite)
 * - Image produit centrale (fond doux)
 * - Footer gris pâle avec titre + prix + bouton play vert
 * ============================================================================ */

.product-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.product-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
}

/* --- Header coloré or avec badges --- */
.product-card__header {
  background: var(--color-primary);
  padding: var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
}

/* --- Image produit (fond doux pastel) --- */
.product-card__image-wrap {
  background: linear-gradient(180deg, #E8E4F5 0%, #F0EBF5 100%);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Footer gris pâle avec infos produit --- */
.product-card__body {
  background: var(--color-surface-alt);
  padding: var(--space-3) var(--space-3) var(--space-2);
}

.product-card__title {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--color-primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-2);

  /* Limite 2 lignes */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.product-card__price-current {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: 800;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}

.product-card__price-original {
  font-size: var(--fs-xs);
  color: var(--color-ink-dim);
  text-decoration: line-through;
}

/* --- Footer bouton play vert (CTA) --- */
.product-card__cta {
  background: var(--color-surface-alt);
  padding: var(--space-2) var(--space-3) var(--space-3);
  display: flex;
  justify-content: center;
}

.product-card__cta-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: white;
  border: 2px solid var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.product-card__cta-btn:hover {
  background: var(--color-accent);
  color: white;
}

.product-card__cta-btn svg {
  width: 14px;
  height: 14px;
  color: var(--color-accent);
}

.product-card__cta-btn:hover svg {
  color: white;
}


/* =============================================================================
 * 9. TOP BAR MOBILE
 * ============================================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: 56px;
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-line);
  padding-top: env(safe-area-inset-top);
}

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

.topbar__brand img {
  height: 28px;
  width: auto;
  display: block;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar__action {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-ink-2);
}

.topbar__action svg {
  width: 22px;
  height: 22px;
}


/* =============================================================================
 * 10. BOTTOM NAVIGATION
 * ============================================================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-bottom-nav);
  display: flex;
  justify-content: space-around;
  height: var(--bottom-nav-h);
  background: var(--color-surface);
  border-top: 1px solid var(--color-line);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-height: var(--tap-target);
  color: var(--color-ink-dim);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-decoration: none;
}

.bottom-nav__item.is-active {
  color: var(--color-primary-dark);
}

.bottom-nav__icon {
  width: 24px;
  height: 24px;
}


/* =============================================================================
 * 11. FOOTER NOIR
 * ============================================================================ */

.footer {
  background: var(--color-footer);
  color: var(--color-footer-ink);
  padding: var(--space-8) var(--space-4) var(--space-6);
  margin-top: var(--space-12);
}

.footer__brand {
  margin-bottom: var(--space-5);
}

.footer__brand img {
  height: 32px;
  width: auto;
  /* Le logo est noir → on l'inverse en blanc pour fond noir */
  filter: invert(1);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-6);
  margin-bottom: var(--space-6);
  list-style: none;
}

.footer__links a {
  color: var(--color-footer-ink);
  font-size: var(--fs-sm);
}

.footer__links a:hover {
  color: var(--color-primary-light);
}

.footer__social {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.footer__social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.08);
  color: var(--color-footer-ink);
}

.footer__social-link svg {
  width: 18px;
  height: 18px;
}

.footer__newsletter {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.footer__newsletter input {
  flex: 1;
  padding: var(--space-3);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  color: white;
  font-size: var(--fs-sm);
}

.footer__newsletter input::placeholder {
  color: var(--color-footer-dim);
}

.footer__newsletter button {
  width: var(--tap-target);
  height: var(--tap-target);
  background: var(--color-accent);
  border-radius: var(--radius-md);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer__copyright {
  font-size: var(--fs-xs);
  color: var(--color-footer-dim);
  text-align: center;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.1);
}


/* =============================================================================
 * 12. ANIMATIONS
 * ============================================================================ */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.7; }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Respect prefers-reduced-motion (accessibilité) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* =============================================================================
 * 13. UTILITY CLASSES
 * ============================================================================ */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.text-center { text-align: center; }
.hidden { display: none !important; }


/* =============================================================================
 * 14. MEDIA QUERIES (extension vers desktop)
 * ============================================================================ */

@media (min-width: 768px) {
  .container { max-width: 720px; padding: 0 var(--space-6); }

  .grid-2 { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: repeat(4, 1fr); }

  .hero { padding: var(--space-10) var(--space-6); }
  .hero__title { font-size: var(--fs-3xl); }
}

@media (min-width: 1024px) {
  .container { max-width: 1100px; }

  .grid-2 { grid-template-columns: repeat(4, 1fr); }
  .grid-3 { grid-template-columns: repeat(5, 1fr); }

  .hero { padding: var(--space-12) var(--space-8); border-radius: var(--radius-lg); margin: var(--space-4) 0; }
  .hero__title { font-size: var(--fs-4xl); }

  .section-title { font-size: var(--fs-3xl); }

  /* Sur desktop : bottom-nav cachée au profit d'une top-nav */
  .bottom-nav { display: none; }
  body { padding-bottom: 0; }
}
