/**
 * OPTIMISATIONS MOBILE PREMIUM - BRAZECO
 * Améliorations visuelles et UX pour mobile
 */

/* ===================================
   OPTIMISATIONS GÉNÉRALES MOBILE
   =================================== */

/* Amélioration du rendu des polices */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
}

/* Scroll fluide et naturel */
* {
  -webkit-overflow-scrolling: touch;
}

/* Suppression du highlight au tap sur mobile */
* {
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

/* Touch-friendly links et buttons */
a, button, .btn, .clickable {
  min-height: 44px; /* Taille recommandée pour le touch */
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Police visible pendant chargement (FOUT meilleur que FOIT) */
@font-face {
  font-display: swap;
}

/* ===================================
   ANIMATIONS OPTIMISÉES MOBILE
   =================================== */

@media (max-width: 768px) {
  
  /* Animation douce désactivée par défaut pour éviter les problèmes */
  .animate-on-scroll {
    /* Visible par défaut */
    opacity: 1;
    transform: translateY(0);
  }
  
  .animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
  }
  
  /* Hover states transformés en active pour mobile */
  .card:active,
  .product-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .btn:active {
    transform: scale(0.95);
  }
  
  /* Amélioration des transitions */
  .btn, .card, a {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
}

/* ===================================
   HERO SECTION MOBILE PREMIUM
   =================================== */

@media (max-width: 576px) {
  
  /* Optimisation de l'image de fond hero */
  .hero-bg-image {
    object-position: center center !important;
    filter: brightness(0.7);
  }
  
  /* Amélioration du contraste texte */
  .hero-overlay {
    background: rgba(0, 0, 0, 0.5) !important;
  }
  
  .hero-gradient {
    background: linear-gradient(180deg, 
      rgba(0, 0, 0, 0.3) 0%, 
      rgba(139, 69, 19, 0.4) 50%,
      rgba(0, 0, 0, 0.6) 100%) !important;
  }
  
  /* Espacements optimisés */
  .hero-content {
    text-align: left;
  }
  
  .hero-title {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  
  .hero-subtitle {
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  }
  
  /* Boutons pleine largeur avec icônes bien espacées */
  .btn-cta {
    gap: 8px;
  }
  
  .btn-cta i,
  .btn-cta svg {
    flex-shrink: 0;
  }
}

/* ===================================
   CARTES PRODUITS MOBILE PREMIUM
   =================================== */

@media (max-width: 768px) {
  
  .product-card {
    background: #fff;
    position: relative;
    overflow: hidden;
  }
  
  /* Effet de survol mobile (au tap) */
  .product-card:active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.05);
    z-index: 1;
  }
  
  /* Images optimisées */
  .product-card img {
    transition: transform 0.3s ease;
    will-change: transform;
  }
  
  .product-card:active img {
    transform: scale(1.05);
  }
  
  /* Badge "Nouveau" ou "Promo" optimisé */
  .product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #FF9800 0%, #FF5722 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
    z-index: 2;
  }
  
  /* Prix mis en valeur */
  .product-price {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #FF9800 0%, #FF5722 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  /* Bouton ajouter au panier optimisé */
  .btn-add-cart {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #FF9800 0%, #FF8C42 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
    transition: all 0.3s ease;
  }
  
  .btn-add-cart:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
  }
}

/* ===================================
   NAVIGATION MOBILE AMÉLIORÉE
   =================================== */

@media (max-width: 576px) {
  
  /* Menu hamburger stylisé */
  .navbar-toggler {
    border: none;
    padding: 8px;
    border-radius: 8px;
    background: rgba(139, 69, 19, 0.1);
  }
  
  .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.2);
    outline: none;
  }
  
  /* Menu déroulant stylisé */
  .navbar-collapse {
    animation: slideDown 0.3s ease;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  /* Items de navigation avec effet */
  .navbar-nav .nav-item {
    transform-origin: top;
    animation: menuItemFade 0.3s ease forwards;
  }
  
  .navbar-nav .nav-item:nth-child(1) { animation-delay: 0.05s; }
  .navbar-nav .nav-item:nth-child(2) { animation-delay: 0.1s; }
  .navbar-nav .nav-item:nth-child(3) { animation-delay: 0.15s; }
  .navbar-nav .nav-item:nth-child(4) { animation-delay: 0.2s; }
  .navbar-nav .nav-item:nth-child(5) { animation-delay: 0.25s; }
  
  @keyframes menuItemFade {
    from {
      opacity: 0;
      transform: translateX(-10px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  /* Badge panier mobile */
  .cart-badge,
  .header-cart-badge {
    position: absolute !important;
    top: -6px !important;
    right: -6px !important;
    background: linear-gradient(135deg, #FF5722 0%, #FF9800 100%) !important;
    color: white !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    padding: 3px 6px !important;
    border-radius: 10px !important;
    min-width: 20px !important;
    text-align: center !important;
    box-shadow: 0 2px 6px rgba(255, 87, 34, 0.4) !important;
  }
}

/* ===================================
   FORMULAIRES MOBILE OPTIMISÉS
   =================================== */

@media (max-width: 576px) {
  
  .form-control {
    height: 48px;
    font-size: 1rem;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    padding: 12px 16px;
    transition: all 0.3s ease;
  }
  
  .form-control:focus {
    border-color: #FF9800;
    box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.1);
    outline: none;
  }
  
  textarea.form-control {
    min-height: 120px;
    resize: vertical;
  }
  
  /* Labels flottants */
  .form-floating label {
    font-size: 0.95rem;
    color: #666;
  }
  
  /* Messages d'erreur */
  .invalid-feedback {
    font-size: 0.85rem;
    color: #FF5722;
    margin-top: 6px;
  }
}

/* ===================================
   MODALS MOBILE OPTIMISÉS
   =================================== */

@media (max-width: 576px) {
  
  .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100vh;
  }
  
  .modal-content {
    height: 100%;
    border-radius: 0;
    border: none;
  }
  
  .modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
  }
  
  .modal-body {
    padding: 24px;
    overflow-y: auto;
  }
  
  .modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
  }
  
  /* Bouton fermeture modal */
  .modal-header .btn-close {
    padding: 12px;
    margin: -12px;
    opacity: 0.7;
  }
}

/* ===================================
   FOOTER MOBILE AMÉLIORÉ
   =================================== */

@media (max-width: 576px) {
  
  footer {
    background: linear-gradient(180deg, #1a1a1a 0%, #2c2c2c 100%) !important;
    display: block !important;
    visibility: visible !important;
    padding: 35px 0 20px !important;
  }
  
  footer .container {
    display: block !important;
    visibility: visible !important;
    padding: 0 20px !important;
  }
  
  footer .row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }
  
  /* Section Logo et Contact */
  footer .col-md-4 {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    margin-bottom: 30px !important;
    text-align: center !important;
    padding-bottom: 25px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  }
  
  footer .col-md-4 img {
    display: block !important;
    margin: 0 auto 18px !important;
    max-width: 140px !important;
    filter: brightness(1.1) !important;
  }
  
  footer .col-md-4 p {
    display: block !important;
    color: rgba(255, 255, 255, 0.75) !important;
    font-size: 0.85rem !important;
    line-height: 1.6 !important;
    margin-bottom: 8px !important;
    padding: 0 10px !important;
  }
  
  footer .col-md-4 strong {
    color: #FF9800 !important;
    font-weight: 600 !important;
  }
  
  /* Section Menus */
  footer .col-md-5 {
    display: block !important;
    width: 100% !important;
    margin-bottom: 25px !important;
  }
  
  footer .col-md-5 .row {
    display: flex !important;
    flex-direction: row !important;
    gap: 0 !important;
  }
  
  footer .col-md-5 .col-6 {
    display: block !important;
    width: 50% !important;
    padding: 0 10px !important;
    text-align: left !important;
  }
  
  footer h5 {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    margin-bottom: 15px !important;
    color: #fff !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    position: relative !important;
    padding-bottom: 10px !important;
  }
  
  footer h5::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 30px !important;
    height: 2px !important;
    background: linear-gradient(90deg, #FF9800 0%, #FF5722 100%) !important;
    border-radius: 2px !important;
  }
  
  footer ul {
    display: block !important;
    visibility: visible !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  footer ul li {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-bottom: 10px !important;
  }
  
  footer .footer-link {
    display: inline-block !important;
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 4px 0 !important;
    font-size: 0.85rem !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    position: relative !important;
  }
  
  footer .footer-link::before {
    content: '→' !important;
    position: absolute !important;
    left: -18px !important;
    opacity: 0 !important;
    transition: all 0.3s ease !important;
    color: #FF9800 !important;
  }
  
  footer .footer-link:hover,
  footer .footer-link:active {
    color: #FF9800 !important;
    padding-left: 18px !important;
  }
  
  footer .footer-link:hover::before,
  footer .footer-link:active::before {
    opacity: 1 !important;
    left: 0 !important;
  }
  
  /* Section Mon Compte - Style special */
  footer .col-md-5 .col-6:last-child ul li small {
    display: block !important;
    background: rgba(255, 152, 0, 0.1) !important;
    border: 1px solid rgba(255, 152, 0, 0.3) !important;
    padding: 10px 15px !important;
    border-radius: 8px !important;
    margin-bottom: 15px !important;
    color: #FFD699 !important;
    font-size: 0.85rem !important;
  }
  
  footer .text-danger {
    color: #FF5722 !important;
    background: rgba(255, 87, 34, 0.1) !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    display: inline-block !important;
    font-weight: 600 !important;
  }
  
  /* Copyright section */
  footer .footer-copyright {
    margin-top: 25px !important;
    padding-top: 20px !important;
  }
  
  footer .footer-copyright p,
  footer .footer-copyright a {
    font-size: 0.8rem !important;
    margin-bottom: 8px !important;
  }
}

/* ===================================
   CHARGEMENT ET PERFORMANCE
   =================================== */

/* Skeleton loading pour images (optionnel) */
@media (max-width: 768px) {
  
  .img-loading {
    background: linear-gradient(
      90deg,
      #f0f0f0 25%,
      #e0e0e0 50%,
      #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
  }
  
  @keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
  
  /* Lazy loading images - Animation fade-in douce */
  img[loading="lazy"] {
    transition: opacity 0.3s ease;
  }
  
  img[loading="lazy"].loaded {
    opacity: 1;
  }
}

/* ===================================
   ACCESSIBILITÉ MOBILE
   =================================== */

@media (max-width: 576px) {
  
  /* Focus visible pour navigation clavier */
  a:focus-visible,
  button:focus-visible,
  .btn:focus-visible {
    outline: 3px solid #FF9800;
    outline-offset: 2px;
  }
  
  /* Taille de texte minimum pour lisibilité */
  body {
    font-size: 16px; /* Évite le zoom automatique iOS */
  }
  
  /* Contraste amélioré */
  .text-muted {
    color: #666 !important;
  }
}

/* ===================================
   UTILITAIRES MOBILE
   =================================== */

@media (max-width: 576px) {
  
  /* Espacements responsifs */
  .mobile-px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
  .mobile-py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
  .mobile-mb-3 { margin-bottom: 1rem !important; }
  .mobile-mt-4 { margin-top: 1.5rem !important; }
  
  /* Texte mobile */
  .mobile-text-center { text-align: center !important; }
  .mobile-text-left { text-align: left !important; }
  
  /* Display mobile */
  .mobile-d-none { display: none !important; }
  .mobile-d-block { display: block !important; }
  .mobile-d-flex { display: flex !important; }
  
  /* Width mobile */
  .mobile-w-100 { width: 100% !important; }
}
