/* css/mobile-responsive.css */
/* Optimisations mobiles spécifiques pour le site Zaytoon */

/* Variables pour cohérence */
:root {
  --mobile-breakpoint: 767px;
  --tablet-breakpoint: 991px;
  --touch-target-size: 44px;
  --mobile-padding: 15px;
  --mobile-border-radius: 12px;
}

/* Base responsive optimisations */
@media (max-width: 767px) {
  /* Typography améliorée pour mobile */
  body {
    font-size: 16px; /* Évite le zoom automatique iOS/Android */
    line-height: 1.5;
  }
  
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.4rem; }
  h4 { font-size: 1.2rem; }
  h5 { font-size: 1.1rem; }
  
  /* Containers responsive */
  .container,
  .container-fluid {
    padding-left: var(--mobile-padding);
    padding-right: var(--mobile-padding);
  }
  
  /* Navigation mobile optimisée */
  .navbar {
    padding: 0.5rem var(--mobile-padding);
  }
  
  .navbar-brand img {
    height: 50px;
    transition: height 0.3s ease;
  }
  
  .navbar-nav {
    margin-top: 1rem;
    text-align: center;
  }
  
  .navbar-nav .nav-link {
    padding: 12px 20px !important;
    font-size: 1.1rem;
    margin: 0.2rem 0;
    border-radius: var(--mobile-border-radius);
    min-height: var(--touch-target-size);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Boutons optimisés pour le tactile */
  .btn {
    min-height: var(--touch-target-size);
    padding: 12px 20px;
    font-size: 1rem;
    border-radius: var(--mobile-border-radius);
    font-weight: 500;
  }
  
  /* Panier mobile */
  #btn-cart {
    width: var(--touch-target-size);
    height: var(--touch-target-size);
    border-radius: 50%;
    font-size: 1.4rem;
  }
  
  /* Cartes produits responsive */
  .card {
    border-radius: var(--mobile-border-radius) !important;
    margin: 10px 5px 20px 5px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
  }
  
  .card-img-top {
    height: 200px;
    border-radius: var(--mobile-border-radius) var(--mobile-border-radius) 0 0;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  /* Carousels optimisés pour mobile */
  .carousel-control-prev,
  .carousel-control-next {
    width: 40px;
    height: 40px;
    background: rgba(112, 130, 56, 0.9);
    border-radius: 50%;
    opacity: 0.8;
    transition: all 0.3s ease;
  }
  
  .carousel-control-prev:hover,
  .carousel-control-next:hover {
    opacity: 1;
    transform: scale(1.1);
  }
  
  .carousel-indicators {
    bottom: -35px;
  }
  
  .carousel-indicators li {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 6px;
    background-color: rgba(112, 130, 56, 0.5);
  }
  
  .carousel-indicators .active {
    background-color: var(--primary-green);
  }
  
  /* Badges optimisés */
  .badge-flash,
  .badge-stock-left,
  .victime {
    font-size: 0.75rem !important;
    padding: 4px 8px !important;
    border-radius: 8px !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  
  /* Zone de contenu principal */
  #promo-text {
    font-size: 1rem;
    padding: 1rem;
    margin: 1rem 0 2rem 0;
    border-radius: var(--mobile-border-radius);
    line-height: 1.6;
  }
  
  /* Roulette mobile */
  .roulette-container {
    padding: 15px !important;
    margin: 10px 5px !important;
    border-radius: var(--mobile-border-radius) !important;
  }
  
  .roulette-wheel {
    width: 150px !important;
    height: 150px !important;
  }
}

/* Modal du panier mobile */
@media (max-width: 767px) {
  .mobile-cart {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 400px !important;
    max-height: 80vh !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4) !important;
    z-index: 10000 !important;
  }
  
  .mobile-cart .p-3 {
    padding: 1.5rem !important;
    max-height: calc(80vh - 3rem);
    overflow-y: auto;
  }
  
  /* Overlay pour mobile */
  #cart-overlay {
    backdrop-filter: blur(2px);
  }
  
  /* Bloquer le scroll du body seulement quand nécessaire */
  body.modal-open {
    overflow: hidden;
    padding-right: 17px; /* Éviter le saut de layout */
  }
}

/* Tablettes (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .card-img-top {
    height: 220px;
  }
  
  #cart-modal {
    width: 350px;
    right: 20px;
  }
  
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .navbar-nav .nav-link {
    padding: 10px 15px !important;
  }
}

/* Très petits écrans (moins de 480px) */
@media (max-width: 480px) {
  /* Masquer le nom de la marque */
  .navbar-brand span {
    display: none !important;
  }
  
  /* Réduire encore plus les images */
  .card-img-top {
    height: 180px;
  }
  
  /* Texte plus compact */
  #promo-text {
    font-size: 0.95rem;
    padding: 0.875rem;
  }
  
  h2.text-center {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  /* Roulette plus petite */
  .roulette-wheel {
    width: 120px !important;
    height: 120px !important;
  }
  
  /* Navigation encore plus compacte */
  .navbar {
    padding: 0.25rem 10px;
  }
  
  .navbar-brand img {
    height: 45px;
  }
  
  /* Cartes plus compactes */
  .card-body {
    padding: 0.75rem;
  }
  
  .card-title {
    font-size: 1rem;
  }
  
  /* Modal panier plus petit */
  .mobile-cart {
    width: 95vw !important;
    max-height: 85vh !important;
  }
}

/* Optimisations tactiles */
@media (hover: none) and (pointer: coarse) {
  /* Appareils tactiles uniquement */
  
  /* Augmenter les zones de toucher */
  .carousel-control-prev,
  .carousel-control-next {
    width: 50px;
    height: 50px;
  }
  
  /* Feedback tactile */
  .btn:active,
  .card:active,
  .nav-link:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  /* Supprimer les effets hover qui ne fonctionnent pas bien sur tactile */
  .card:hover {
    transform: none;
  }
  
  .btn:hover {
    transform: none;
  }
}

/* Mode paysage sur mobile */
@media (max-width: 767px) and (orientation: landscape) {
  .roulette-container {
    padding: 10px !important;
  }
  
  .roulette-wheel {
    width: 100px !important;
    height: 100px !important;
  }
  
  .mobile-cart {
    max-height: 90vh !important;
  }
  
  .navbar-brand img {
    height: 40px;
  }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mode sombre (si supporté) */
@media (prefers-color-scheme: dark) {
  /* Préparation pour le mode sombre futur */
  :root {
    --text-color-dark: #f5f5f5;
    --bg-color-dark: #1a1a1a;
    --card-bg-dark: #2d2d2d;
  }
}
