/* ===============================
   Base & Variables
==================================*/
:root{
  --bg: #0f172a;            /* slate-900 */
  --panel: #111827;         /* gray-900 */
  --muted: #94a3b8;         /* slate-400 */
  --text: #e5e7eb;          /* gray-200 */
  --accent: #38bdf8;        /* sky-400 */
  --accent-2: #22d3ee;      /* cyan-400 */
  --ring: rgba(56,189,248,0.45);
  --card: #0b1220;          /* dark card */
  --border: #1f2937;        /* gray-800 */
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(56,189,248,.15), transparent 60%),
              radial-gradient(1000px 500px at 120% 10%, rgba(34,211,238,.12), transparent 60%),
              var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

/* A11y helpers */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===============================
   Layout
==================================*/
.site-header, .site-footer{
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px clamp(16px, 3vw, 28px);
}
.site-header h1{
  font-size: clamp(20px, 2.5vw, 28px);
  margin: 0;
  letter-spacing: .5px;
}

.layout{
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px clamp(16px, 3vw, 28px) 32px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* Desktop: deux cadres côte à côte */
@media (min-width: 980px){
  .layout{
    grid-template-columns: 360px 1fr; /* Cadre gauche + produits */
    align-items: start;
  }
}

.panel{
  background: linear-gradient(180deg, var(--panel), #0a0f1d);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.6vw, 24px);
}

.panel h2{
  margin: 0 0 16px;
  font-size: clamp(18px, 2.2vw, 22px);
}

/* ===============================
   Login form + mini-cards
==================================*/
.login-form{
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.field{
  display: grid;
  gap: 6px;
}
label{ font-size: 14px; color: var(--muted); }
input{
  appearance: none;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s, transform .03s ease-in-out;
}
input:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--ring);
}
input:active{ transform: translateY(0.5px); }

.btn{
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
  transition: transform .05s ease, box-shadow .2s, background .2s, border-color .2s;
}
.btn:active{ transform: translateY(1px); }

.btn--primary{
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #031525;
  box-shadow: 0 8px 20px rgba(34,211,238,.25);
}
.btn--primary:hover{ filter: brightness(1.05); }

.btn--ghost{
  background: #0b1220;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover{ border-color: var(--accent); }

.helper{
  margin-top: 6px;
  font-size: 14px;
}
.helper a{
  color: var(--muted);
  text-decoration: none;
}
.helper a:hover{ color: var(--accent); text-decoration: underline; }

.mini-cards{
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 10px;
}
@media (min-width: 520px){
  .mini-cards{ grid-template-columns: repeat(1, 1fr); }
}
.mini-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;                /* ✅ on passe en flex */
  align-items: center;          /* centre verticalement texte + image */
  gap: 8px;                     /* petit espace entre texte et image */
  font-weight: bold;
  font-size: 15px;
}

.mini-card .img-a {
  width: 54px;                  /* adapte la taille de l’icône */
  height: auto;
}


/* ===============================
   Product grid
==================================*/
.panel--products{ overflow: hidden; }

.product-grid{
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr)); /* Mobile: 1 */
  gap: 14px;
}

/* ≥640px : 2 colonnes */
@media (min-width: 640px){
  .product-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ≥900px : 3 colonnes (utile si panneau produits s’affiche seul en mobile paysage) */
@media (min-width: 900px){
  .product-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* ≥1200px : 4 colonnes (objectif demandé) */
@media (min-width: 1200px){
  .product-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}



.product-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 10px;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
}
.product-card:hover{
  transform: translateY(-2px);
  border-color: rgba(56,189,248,.45);
  box-shadow: 0 14px 36px rgba(2,8,23,.55);
}

.product-thumb {
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  display: flex;            
  align-items: center;
  justify-content: center;
  height: 220px;             
}

.product-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;        /* affiche l’image entière */
  display: block;
}


.product-title{
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}
.product-price{
  margin: -2px 0 2px;
  font-weight: 700;
  letter-spacing: .2px;
}

/* ===============================
   Footer
==================================*/
.site-footer{
  opacity: .8;
  text-align: center;
  border-top: 1px solid var(--border);
}
/* cache les cartes non encore affichées */
.is-hidden{ display:none; }

/* ===============================
   Reduced motion
==================================*/
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}
/* ===============================
   MOBILE UNIQUEMENT (≤700px)
   - Login à gauche, produit à droite
   - Carrousel 1 carte (scroll-snap)
==================================*/
@media (max-width: 700px){

  /* ---- Layout : 2 colonnes égales ---- */
  .layout{
    grid-template-columns: 1fr 1fr;      /* gauche = auth, droite = produits */
    gap: 10px;
    align-items: start;
  }

  .site-header h1{ font-size: 16px; }
  .panel h2{ font-size: 14px; margin-bottom: 8px; }
  .panel{ padding: 12px; }

  /* On compresse un peu le formulaire pour gagner de la place */
  .login-form{ gap: 10px; margin-bottom: 12px; }
  .field{ gap: 4px; }
  label{ font-size: 12px; }
  input{ padding: 10px 12px; border-radius: 10px; }
  .btn{ padding: 10px 12px; }

  /* Mini-cards : 1 colonne compacte */
  .mini-cards{
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .mini-card{ padding: 10px; font-size: 14px; }
  .mini-card .img-a{ width: 46px; }

  /* ---- Panel produits : carrousel ---- */
  .panel--products{ overflow: hidden; }

  /* La "grille" devient une piste horizontale */
  .product-grid{
    display: flex;                /* piste */
    gap: 0;                       /* aucune marge entre slides */
    overflow-x: auto;             /* scroll horizontal tactile */
    overflow-y: hidden;
    scroll-snap-type: x mandatory;/* carrousel CSS */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    border-radius: 12px;
  }

  /* 1 carte = 100% de la largeur du panneau de droite */
  .product-grid .product-card{
    flex: 0 0 100%;
    min-width: 100%;
    scroll-snap-align: start;
    border-radius: 12px;
    /* un peu d’air à l’intérieur déjà prévu par .product-card */
  }

  /* Vignette produit bien contenue */
  .product-thumb{
    height: 190px;                /* un peu plus compact en mobile */
  }
  .product-thumb img{
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
  }

  /* Titre/prix un poil plus compacts */
  .product-title{ font-size: 14px; }
  .product-price{ margin: -2px 0 4px; }

  /* Le bouton "Voir plus" n'est pas utile en carrousel mobile */
  #loadMore{ display: none !important; }

  /* Option visuelle : masque pour suggérer le scroll (peut être retiré) */
  .product-grid{
    mask-image: linear-gradient( to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient( to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  }

  /* Accessibilité focus visible */
  .btn:focus-visible,
  input:focus-visible{
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}

