/**
 * MOBILE RESPONSIVE - BRESLEV BOOKS
 * Corrections complètes pour affichage mobile
 * Version: 1.0 - 25 Nov 2025
 */

/* ============================================
   MENU HAMBURGER - Mobile Navigation
   ============================================ */

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 10001;
}

.mobile-menu-toggle span {
  display: block;
  width: 25px;
  height: 3px;
  background: #1E3A8A;
  margin: 5px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
}

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

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

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

/* ============================================
   MOBILE STYLES (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {

  /* Show hamburger menu */
  .mobile-menu-toggle {
    display: block;
  }

  /* Navbar container */
  .navbar__container {
    flex-wrap: nowrap;
    justify-content: space-between;
    padding: 0 1rem;
  }

  /* Logo smaller on mobile */
  .navbar__logo {
    font-size: 1rem;
    white-space: nowrap;
  }

  .navbar__logo i {
    font-size: 1.2rem;
  }

  /* Hide nav by default on mobile */
  .navbar__nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: flex-start;
    padding: 5rem 2rem 2rem;
    gap: 0;
    transition: left 0.3s ease;
    z-index: 10000;
    border-right: 2px solid rgba(196, 160, 82, 0.3);
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.15);
  }

  .navbar__nav.active {
    left: 0;
  }

  .navbar__nav-link {
    display: block;
    padding: 1rem 0;
    font-size: 1rem;
    border-bottom: 1px solid rgba(196, 160, 82, 0.2);
    width: 100%;
    color: #2c3e50 !important;
  }

  .navbar__nav-link:last-child {
    border-bottom: none;
  }

  /* Cart icon always visible */
  .navbar__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* Overlay when menu open */
  .menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
  }

  .menu-overlay.active {
    display: block;
  }

  /* Hero Section Mobile */
  .hero-section {
    height: auto;
    min-height: 100vh;
    padding: 6rem 1rem 3rem;
  }

  .hero-content {
    padding: 1.5rem;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  .hero-title {
    font-size: 1.8rem !important;
    line-height: 1.2;
  }

  .hero-content p {
    font-size: 1rem !important;
    margin-bottom: 1.5rem !important;
  }

  .hero-content .btn {
    width: 100%;
    text-align: center;
    padding: 1rem;
  }

  /* Product Grid Mobile */
  .grid-products {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1rem 0;
  }

  .book-card {
    border-radius: 8px;
  }

  .book-cover-container {
    height: 200px;
  }

  .book-info {
    padding: 0.75rem;
  }

  .book-title {
    font-size: 0.9rem !important;
    line-height: 1.3;
    margin-bottom: 0.25rem !important;
  }

  .book-author {
    font-size: 0.7rem !important;
    margin-bottom: 0.5rem !important;
  }

  .book-price {
    font-size: 1.1rem !important;
  }

  /* Add to cart button mobile */
  .btn-add-to-cart {
    padding: 0.6rem !important;
    font-size: 0.75rem !important;
  }

  .btn-add-to-cart i {
    display: none; /* Hide icon on mobile to save space */
  }

  /* Container padding */
  .container {
    padding: 0 1rem;
  }

  /* Section margins */
  .mt-12, .mb-12 {
    margin-top: 3rem;
    margin-bottom: 3rem;
  }

  /* Section title */
  h2 {
    font-size: 1.5rem;
    text-align: center;
    display: block;
    border-bottom: none;
  }

  h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--color-gold);
    margin: 0.5rem auto 0;
  }

  /* Footer Mobile */
  .footer {
    padding: 2rem 0 1rem;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .footer h4 {
    margin-bottom: 1rem;
  }

  .footer__bottom {
    padding-top: 1rem;
    font-size: 0.75rem;
  }
}

/* ============================================
   SMALL PHONES (max-width: 480px)
   ============================================ */

@media (max-width: 360px) {

  .navbar__logo {
    font-size: 0.8rem;
  }

  .grid-products {
    grid-template-columns: 1fr; /* Single column only on very small screens ≤360px */
    gap: 1.5rem;
  }

  .book-cover-container {
    height: 280px;
  }

  .book-info {
    padding: 1rem;
  }

  .book-title {
    font-size: 1rem !important;
  }

  .book-author {
    font-size: 0.8rem !important;
  }

  .btn-add-to-cart {
    padding: 0.8rem !important;
    font-size: 0.85rem !important;
  }

  .btn-add-to-cart i {
    display: inline; /* Show icon on single column */
  }

  .hero-title {
    font-size: 1.5rem !important;
  }
}

/* ============================================
   TABLET (769px - 1024px)
   ============================================ */

@media (min-width: 769px) and (max-width: 1024px) {

  .navbar__nav {
    gap: 1.5rem;
  }

  .navbar__nav-link {
    font-size: 0.85rem;
  }

  .grid-products {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  .book-cover-container {
    height: 350px;
  }
}

/* ============================================
   TABLET NAV OVERFLOW FIX (769px - 1100px)
   ============================================ */

@media (min-width: 769px) and (max-width: 1100px) {
  .navbar__nav { gap: 0.4rem; }
  .navbar__nav-link { font-size: 0.72rem; white-space: nowrap; }
  .navbar__container { padding: 0 0.8rem; gap: 0.8rem; }
  .navbar__logo { font-size: 1rem; }
}
@media (max-width: 900px) {
  .mobile-menu-toggle { display: block; }
  .navbar__nav { display: none; }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {

  .hero-section {
    min-height: auto;
    padding: 5rem 1rem 2rem;
  }

  .hero-content {
    padding: 1rem;
  }

  .grid-products {
    grid-template-columns: repeat(3, 1fr);
  }

  .book-cover-container {
    height: 150px;
  }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {

  /* Larger touch targets */
  .btn,
  .navbar__nav-link,
  .btn-add-to-cart {
    min-height: 44px;
    min-width: 44px;
  }

  /* Disable hover effects on touch */
  .book-card:hover {
    transform: none;
  }

  .book-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* ============================================
   SAFE AREA (iPhone X+ notch)
   ============================================ */

@supports (padding: max(0px)) {
  .navbar {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .footer {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}
