/* ========================================
   MOBILE TOUCH ENHANCEMENTS
   Améliorations pour l'expérience tactile
   ======================================== */

/* Éviter le double-tap sur les liens */
a, button {
  -ms-touch-action: manipulation;
  touch-action: manipulation;
}

/* Améliorer le scroll sur mobile */
body {
  -webkit-overflow-scrolling: touch;
}

/* Éviter le zoom sur les inputs iOS */
@media screen and (max-width: 767px) {
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Menu mobile amélioré */
@media (max-width: 959px) {
  .menu-mobile {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  .menu-mobile.active:after {
    content: "\f068";
  }
  
  .menu > ul {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }
  
  .menu > ul.show {
    display: block !important;
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
  }
  
  /* Sous-menus mobiles */
  .menu > ul > li > ul {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }
  
  .menu > ul > li > ul.show {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
  }
  
  /* Indicateur de sous-menu */
  .menu > ul > li > a {
    position: relative;
  }
  
  .menu > ul > li.has-submenu > a:after {
    content: "\f107";
    font-family: "FontAwesome";
    position: absolute;
    right: 15px;
    transition: transform 0.3s ease;
  }
  
  .menu > ul > li.has-submenu.active > a:after {
    transform: rotate(180deg);
  }
}

/* Amélioration du panier mobile */
@media (max-width: 767px) {
  .header .right ul li {
    position: relative;
  }
  
  .header .right ul li .badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    padding: 3px 6px;
    font-size: 10px;
    font-weight: bold;
  }
}

/* Amélioration des formulaires tactiles */
@media (max-width: 767px) {
  /* Augmenter l'espace des checkboxes et radio buttons */
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
  }
  
  /* Labels cliquables plus larges */
  label {
    display: block;
    padding: 10px 0;
    cursor: pointer;
  }
  
  /* Améliorer les select */
  select {
    padding: 12px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
  }
}

/* Amélioration des boutons d'action */
@media (max-width: 767px) {
  .product .btn,
  .cart-buttons .btn,
  .checkout-buttons .btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 14px;
    white-space: normal;
  }
}

/* Amélioration de la recherche mobile */
@media (max-width: 767px) {
  .header .search-area {
    padding: 10px;
  }
  
  .header .search-area form {
    display: flex;
    flex-direction: column;
  }
  
  .header .search-area .form-group {
    width: 100%;
    margin-bottom: 10px;
  }
  
  .header .search-area button {
    width: 100%;
    padding: 12px;
  }
}

/* Amélioration des images produits */
@media (max-width: 767px) {
  .product-photo {
    position: relative;
    overflow: hidden;
  }
  
  .product-photo img {
    width: 100%;
    height: auto;
    display: block;
  }
  
  /* Zoom touch friendly */
  .product-single .photo-main img {
    cursor: zoom-in;
  }
}

/* Amélioration du panier mobile */
@media (max-width: 767px) {
  .cart-table-mobile {
    display: block;
  }
  
  .cart-table-mobile tr {
    display: block;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
  }
  
  .cart-table-mobile td {
    display: block;
    text-align: left !important;
    padding: 8px 0;
    border: none;
  }
  
  .cart-table-mobile td:before {
    content: attr(data-label);
    font-weight: bold;
    display: inline-block;
    width: 100px;
  }
}

/* Amélioration des modales mobiles */
@media (max-width: 767px) {
  .modal {
    padding: 0 !important;
  }
  
  .modal-dialog {
    width: 100%;
    margin: 0;
    height: 100vh;
  }
  
  .modal-content {
    height: 100%;
    border: none;
    border-radius: 0;
  }
  
  .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Swipe gestures pour les sliders */
@media (max-width: 767px) {
  .slider-container {
    touch-action: pan-y pinch-zoom;
  }
  
  .bxslider {
    touch-action: pan-y pinch-zoom;
  }
}

/* Amélioration de la navigation par onglets */
@media (max-width: 767px) {
  .nav-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: none;
  }
  
  .nav-tabs > li {
    flex: 1 1 auto;
    margin-bottom: 5px;
  }
  
  .nav-tabs > li > a {
    text-align: center;
    border-radius: 4px;
    margin-right: 5px;
  }
}

/* Amélioration des alertes mobiles */
@media (max-width: 767px) {
  .alert {
    padding: 12px;
    font-size: 14px;
    border-radius: 4px;
  }
  
  .alert-dismissible .close {
    padding: 12px;
    font-size: 20px;
  }
}

/* Sticky header mobile */
@media (max-width: 767px) {
  .header-sticky {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  }
}

/* Amélioration du footer mobile */
@media (max-width: 767px) {
  .footer-links {
    text-align: center;
  }
  
  .footer-links a {
    display: block;
    padding: 10px;
    font-size: 14px;
  }
  
  .footer-social {
    text-align: center;
    margin-top: 15px;
  }
  
  .footer-social a {
    display: inline-block;
    margin: 0 10px;
    font-size: 24px;
  }
}

/* Loading spinner mobile */
@media (max-width: 767px) {
  .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8c844f;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
}

/* Amélioration des tooltips mobiles */
@media (max-width: 767px) {
  .tooltip-inner {
    font-size: 14px;
    padding: 8px 12px;
  }
}

/* Scroll to top button mobile */
@media (max-width: 767px) {
  .scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: #8c844f;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
  }
  
  .scroll-to-top:hover {
    background: #333;
    transform: translateY(-5px);
  }
}
