/**
 * Lin Teas - Responsive Mobile Optimisé
 * Phase 2.7: Optimisations spécifiques mobile
 * 
 * Breakpoints:
 * - Desktop: > 1024px
 * - Tablet: 768px - 1024px
 * - Mobile: < 768px
 */

/* ==========================================================================
   Navigation Mobile - Hamburger Menu
   ========================================================================== */

@media (max-width: 1024px) {
  /* Header shop adapté */
  .header-shop .site-branding {
    flex: 1;
  }

  .header-shop .main-navigation {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background: var(--color-white, #FEFEFE);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 2rem 0;
  }

  .header-shop .main-navigation.active {
    right: 0;
  }

  /* Hamburger button */
  .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10000;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text, #2C3E50);
    transition: all 0.3s ease;
    position: relative;
  }

  .mobile-menu-toggle span:not(:last-child) {
    margin-bottom: 5px;
  }

  .mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(7px);
  }

  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-7px);
  }

  /* Overlay */
  .mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Menu items mobile */
  .header-shop .main-navigation .menu {
    flex-direction: column;
    padding: 0 1.5rem;
  }

  .header-shop .main-navigation .menu > li {
    width: 100%;
    border-bottom: 1px solid rgba(127, 179, 163, 0.2);
  }

  .header-shop .main-navigation .menu > li > a {
    padding: 1rem 0;
    display: block;
  }

  /* Dropdown devient accordion */
  .header-shop .mega-menu {
    position: static;
    width: 100%;
    max-width: none;
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
    background: rgba(127, 179, 163, 0.05);
  }

  .header-shop .mega-menu-content {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 1rem;
  }

  .header-shop .mega-menu-section {
    border-bottom: 1px solid rgba(127, 179, 163, 0.1);
    padding: 0.75rem 0;
  }

  .header-shop .mega-menu-section:last-child {
    border-bottom: none;
  }
}

/* ==========================================================================
   Filtres Mobile - Bottom Sheet
   ========================================================================== */

@media (max-width: 768px) {
  .advanced-filters-section {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: var(--color-white, #FEFEFE);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9997;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
  }

  .advanced-filters-section.active {
    bottom: 0;
  }

  /* Bouton pour ouvrir les filtres */
  .filters-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary, #7FB3A3);
    color: var(--color-white, #FFFFFF);
    border: none;
    box-shadow: 0 4px 12px rgba(127, 179, 163, 0.4);
    cursor: pointer;
    z-index: 9996;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
  }

  .filters-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(127, 179, 163, 0.5);
  }

  .filters-toggle-btn.active {
    background: var(--color-accent, #B85450);
  }

  /* Overlay pour filtres */
  .filters-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9996;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .filters-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Handle pour glisser */
  .advanced-filters-section::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(127, 179, 163, 0.3);
    border-radius: 2px;
  }
}

/* ==========================================================================
   Touch Targets - Min 44px
   ========================================================================== */

@media (max-width: 768px) {
  /* Boutons */
  button,
  .btn,
  .button,
  a.button {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1.25rem;
  }

  /* Tags et badges */
  .feature-tag,
  .badge,
  .tag {
    min-height: 32px;
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
  }

  /* Icônes cliquables */
  .quick-actions button,
  .card-actions button {
    min-width: 44px;
    min-height: 44px;
  }

  /* Format selector */
  .format-option {
    min-height: 40px;
    padding: 0.5rem 0.875rem;
  }
}

/* ==========================================================================
   Images Optimisées - srcset
   ========================================================================== */

@media (max-width: 768px) {
  .product-card .card-image-wrapper img {
    /* Les images utilisent déjà srcset via WooCommerce */
    /* Forcer le chargement de la taille appropriée */
    object-fit: cover;
    width: 100%;
    height: 100%;
  }
}

/* ==========================================================================
   Typography Mobile
   ========================================================================== */

@media (max-width: 768px) {
  /* Titres */
  h1, .h1 { font-size: 1.75rem; }
  h2, .h2 { font-size: 1.5rem; }
  h3, .h3 { font-size: 1.25rem; }
  h4, .h4 { font-size: 1.1rem; }

  /* Cartes produits */
  .product-card .card-title {
    font-size: 1rem;
    line-height: 1.3;
  }

  .product-card .card-subtitle {
    font-size: 0.8rem;
  }

  .product-card .card-price {
    font-size: 1.1rem;
  }

  /* Navigation */
  .header-shop .site-title {
    font-size: 1.25rem;
  }
}

/* ==========================================================================
   Spacing Mobile
   ========================================================================== */

@media (max-width: 768px) {
  /* Container padding */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Sections */
  section {
    padding: 1.5rem 0;
  }

  /* Grilles */
  .products-grid {
    gap: 1rem;
  }

  /* Cartes */
  .product-card {
    padding: 0.875rem;
  }

  /* Filtres */
  .filter-group {
    padding: 1rem;
  }
}

/* ==========================================================================
   Performance Mobile
   ========================================================================== */

@media (max-width: 768px) {
  /* Réduire les animations pour performance */
  * {
    animation-duration: 0.2s !important;
    transition-duration: 0.2s !important;
  }

  /* Désactiver certains effets coûteux */
  .product-card:hover {
    transform: none;
  }

  .product-card .card-image-wrapper img {
    transition: none;
  }

  /* Simplifier les ombres */
  .product-card,
  .filter-group,
  .view-switcher-controls {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
}

/* ==========================================================================
   Landscape Mobile
   ========================================================================== */

@media (max-width: 768px) and (orientation: landscape) {
  /* Réduire les hauteurs en mode paysage */
  .header-shop {
    padding: 0.5rem 0;
  }

  .advanced-filters-section {
    max-height: 60vh;
  }

  .product-card .card-image-wrapper {
    aspect-ratio: 1 / 1;
  }
}

/* ==========================================================================
   Accessibilité Mobile
   ========================================================================== */

@media (max-width: 768px) {
  /* Focus visible */
  *:focus-visible {
    outline: 3px solid var(--color-primary, #7FB3A3);
    outline-offset: 2px;
  }

  /* Skip to content */
  .skip-to-content {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary, #7FB3A3);
    color: var(--color-white, #FFFFFF);
    padding: 1rem 2rem;
    border-radius: 0 0 8px 8px;
    z-index: 10001;
    transition: top 0.3s ease;
  }

  .skip-to-content:focus {
    top: 0;
  }
}

