/* index-mobile.css
   Dedicated mobile/responsive rules for index.html
   This file is only for the home page and loads after global responsive.css
*/

/* Hide mobile toggle by default on desktop; only show it inside the navbar at small widths */
.mobile-nav-toggle,
.mobile-toggle {
  display: none !important;
}

/* ── Mobile overlay: cacher le bouton "Voir" (œil), garder uniquement panier + like ── */
@media (max-width: 900px) {
  .card-overlay .overlay-btn[aria-label="Voir"] {
    display: none !important;
  }
}


/* Tighten carousel and hero for small devices */
@media (max-width: 900px) {
  .slides {
    height: 42vh !important;
  }

  .slide-content {
    margin-left: 6% !important;
    max-width: 86% !important;
  }

  .slide-title {
    font-size: 1.8rem !important;
    line-height: 1.05 !important;
  }

  .slide-subtitle {
    font-size: 1rem !important;
  }

  .hero {
    padding: 24px 12px 8px 12px !important;
  }

  .hero-img img {
    max-width: 380px !important;
    transform: rotate(-12deg);
  }
}

@media (max-width: 480px) {
  .slides {
    height: 34vh !important;
  }

  .slide-title {
    font-size: 1.4rem !important;
  }

  .slide-subtitle {
    font-size: 0.95rem !important;
  }

  .carousel-control {
    width: 36px;
    height: 36px;
  }

  .carousel-control.prev {
    left: 8px;
  }

  .carousel-control.next {
    right: 8px;
  }

  /* show promotions two per row on mobile */
  .promotions-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding-bottom: 8px;
  }

  .promo-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    padding-bottom: 10px !important;
  }

  .promo-img {
    height: 130px !important;
    flex-shrink: 0 !important;
  }

  .promo-card .promo-img img {
    height: 100%;
    object-fit: cover;
  }

  .new-products .product-card {
    min-height: 0 !important;
    padding-bottom: 12px !important;
    overflow: visible !important;
  }

  .new-products .product-img {
    height: 160px !important;
    aspect-ratio: unset !important;
    border-radius: 12px 12px 0 0 !important;
    flex-shrink: 0 !important;
  }

  /* Best sellers & new products: two cards per row */
  .best-sellers-list,
  .new-products .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
  }

  /* CTA button centered and full width */
  .cta-btn {
    width: 86%;
    max-width: 420px;
    margin: 12px auto !important;
    display: block;
  }

  /* Footer stacking */
  .footer-top {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    padding: 14px 12px;
  }

  /* center language row and social icons, increase tappable size and spacing */
  .footer-location {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
  }

  .footer-socials {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 8px 0;
  }

  .footer-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border-radius: 6px;
  }

  .footer-icon svg {
    width: 20px !important;
    height: 20px !important;
    display: block;
    fill: currentColor;
  }

  /* increase separation between icons block and columns for better breathing room */
  .footer-sep {
    margin: 18px 0 16px 0 !important;
  }

  .footer-columns {
    padding: 0 18px !important;
  }

  .footer-bottom {
    padding: 12px 0 22px 0 !important;
  }

  /* stack footer columns on very small screens to avoid horizontal clipping */
  .footer-columns {
    display: flex !important;
    flex-direction: column;
    gap: 18px;
    align-items: stretch;
  }

  .footer-col {
    width: 100% !important;
    min-width: 0 !important;
  }

  .footer-col ul {
    display: block;
    text-align: center;
  }

  .footer-col ul li {
    display: block;
  }

  .footer-col ul li a {
    display: inline-block;
    white-space: normal;
    word-break: break-word;
  }
}

@media (max-width: 360px) {

  .promotions-list,
  .best-sellers-list,
  .new-products .products-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Increase touch targets on narrower viewports */
@media (max-width: 740px) {

  .nav-icons .search-btn,
  .nav-icons .fav-btn,
  .nav-icons .cart-btn {
    width: 48px;
    height: 48px;
  }

  .nav-icons {
    gap: 10px;
    margin-right: 8px;
  }
}

/* Very small screens — avoid logo overlap */
@media (max-width: 360px) {
  .navbar .logo {
    font-size: 1.2rem !important;
  }

  .navbar {
    padding-left: 56px !important;
  }

  .nav-icons {
    margin-right: 6px;
  }
}

/* Enforce left-aligned logo and right hamburger up to 900px
   This is a robust site-wide mobile/tablet override to beat
   per-page centering rules (e.g. acceuil.css) */
@media (max-width: 900px) {
  .navbar {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 12px !important;
    height: 64px !important;
    z-index: 9999 !important;
    background: #000 !important;
  }

  .navbar .nav-links,
  .navbar .nav-links-container {
    display: none !important;
  }

  .navbar .nav-icons {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
    align-items: center;
    z-index: 11;
    white-space: nowrap;
  }

  .navbar .mobile-toggle,
  .navbar .mobile-nav-toggle {
    position: absolute;
    right: 12px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 12;
  }

  .navbar .logo {
    margin: 0;
    margin-left: 12px;
    position: relative;
    left: auto;
    transform: none;
    z-index: 10;
  }

  .navbar {
    padding-right: 72px !important;
  }
}

/* Mobile navbar layout: hamburger left, logo centered, icons right */
@media (max-width: 740px) {
  .navbar {
    /* override centering from acceuil.css on small screens */
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    /* logo left, icons/toggle right */
    padding: 8px 12px !important;
    height: 64px !important;
    z-index: 9999 !important;
    background: #000 !important;
  }

  /* Ensure the navbar has a solid black background over the hero */
  .navbar {
    background: #000 !important;
    z-index: 9999;
  }

  /* hide desktop nav links inside the navbar on small screens (we use the mobile panel)
    keep the mobile panel's .nav-links (appended to body) visible when opened */
  .navbar .nav-links,
  .navbar .nav-links-container {
    display: none !important;
  }

  /* ensure nav-icons are reachable and don't wrap */
  /* tighten spacing and nudge icons a bit more to the right for index header */
  .navbar .nav-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 11;
    white-space: nowrap;
  }

  /* make icon buttons inline-flex so they don't expand height and cause wrapping */
  .navbar .nav-icons button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: transparent;
    border: none;
    line-height: 1;
  }

  /* ensure SVGs render as block inside buttons and don't introduce extra baseline spacing */
  .navbar .nav-icons button svg {
    display: block;
    width: 22px;
    height: 22px;
  }

  /* hamburger / mobile toggle placed at the right edge
     Support both .mobile-toggle (older) and .mobile-nav-toggle (current script) */
  .navbar .mobile-toggle,
  .navbar .mobile-nav-toggle {
    position: absolute;
    right: 12px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    z-index: 12;
    padding: 6px;
  }

  /* simple hamburger visual when no SVG is present */
  .navbar .mobile-toggle .hamburger-icon,
  .navbar .mobile-nav-toggle .hamburger-icon {
    width: 20px;
    height: 2px;
    background: #fff;
    box-shadow: 0 6px 0 #fff, 0 -6px 0 #fff;
    display: block;
    border-radius: 2px;
  }

  /* style the inline SVG injected by the script so lines are white */
  .navbar .mobile-nav-toggle svg {
    width: 20px;
    height: 18px;
    display: block;
  }

  .navbar .mobile-nav-toggle svg path {
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  /* ensure the logo remains on the left and above other elements */
  .navbar .logo {
    margin: 0;
    margin-left: 12px;
    position: relative;
    left: auto;
    transform: none;
    z-index: 10;
  }

  /* icons (search / fav / cart) anchored to the right */
  .navbar .nav-icons {
    position: absolute;
    right: 60px;
    /* slightly left of the toggle */
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
    align-items: center;
    z-index: 11;
  }

  /* Reserve extra right padding so the centered logo never overlaps the icons */
  .navbar {
    padding-right: 72px !important;
  }

  /* Mobile menu styling for index: dark background to match header */
  .mobile-nav-panel {
    background: #000 !important;
    color: #fff !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  }

  .mobile-nav-panel .nav-links a {
    color: #fff !important;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .mobile-nav-panel .mobile-nav-inner {
    max-width: 600px;
  }

  /* Mobile menu styling for index: vertical centered list (white background) — show as a half-height panel */
  .mobile-nav-panel {
    background: #fff !important;
    color: #231c17 !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    /* make panel a half-screen modal pinned to the top */
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    /* pinned to the very top */
    height: 50vh !important;
    /* occupy the top half of the viewport */
    z-index: 100000 !important;
    /* safe-area padding so content isn't obscured by notches */
    padding-top: env(safe-area-inset-top, 12px) !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    box-sizing: border-box !important;
    /* rounded only on the bottom so the panel feels glued to the top */
    border-radius: 0 0 8px 8px !important;
    overflow: hidden !important;
  }

  /* Make links large, centered and stacked vertically */
  .mobile-nav-panel .nav-links {
    display: flex !important;
    flex-direction: column !important;
    gap: 18px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .mobile-nav-panel .nav-links a {
    color: #231c17 !important;
    padding: 12px 8px !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    display: block !important;
  }

  .mobile-nav-panel .mobile-nav-inner {
    width: 100%;
    max-width: 520px;
  }

  /* make inner container fill panel so centering works reliably */
  .mobile-nav-panel .mobile-nav-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* while mobile menu is open, prevent background scrolling */
  body.mobile-open {
    overflow: hidden !important;
  }

  /* tweak for very small widths to avoid overlap */
  @media (max-width: 360px) {
    .navbar {
      height: 56px;
    }

    .navbar .mobile-toggle {
      right: 8px;
      left: auto;
    }

    .navbar .nav-icons {
      right: 48px;
      gap: 8px;
    }

    .navbar .logo {
      font-size: 1.1rem !important;
    }
  }
}

/* Homepage-specific: pin navbar to top and force logo left + hamburger right
   These rules move the inline/homepage fixes into `index-mobile.css` so
   the layout is controlled by CSS instead of inline attributes. */
@media (max-width: 900px) {
  .navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 12px !important;
    height: 64px !important;
    z-index: 99999 !important;
    background: #000 !important;
    border-radius: 0 !important;
  }

  /* Hide desktop nav links on the homepage mobile view */
  .navbar .nav-links,
  .navbar .nav-links-container {
    display: none !important;
  }

  /* Logo fixed/anchored to the left and vertically centered */
  .navbar .logo,
  #site-logo {
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    z-index: 100001 !important;
  }

  /* Icons anchored to the right (slightly left of the toggle) */
  .navbar .nav-icons {
    position: absolute !important;
    right: 60px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
    z-index: 11 !important;
    white-space: nowrap !important;
  }

  /* Hamburger / mobile toggle at the far right */
  .navbar .mobile-toggle,
  .navbar .mobile-nav-toggle {
    position: absolute !important;
    right: 12px !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 12 !important;
  }

  /* Prevent the page content from sliding under the fixed navbar on the homepage */
  body {
    padding-top: 64px !important;
  }
}

/* Hide navbar on scroll (mobile): move it out of the viewport smoothly */
@media (max-width: 900px) {
  .navbar {
    transition: transform 260ms cubic-bezier(.2, .9, .2, 1), opacity 220ms ease;
    will-change: transform;
  }

  .navbar.navbar-hidden {
    transform: translateY(-120%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Ensure the to-top button sits above other UI and is visible on mobile */
  .to-top-btn {
    right: 14px !important;
    bottom: 14px !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 22px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22) !important;
  }
}

/* Hide promotions carousel arrows on mobile to reduce clutter */
@media (max-width: 900px) {
  .promo-slider-arrow {
    display: none !important;
  }
}

/* Checkout modal styles - polished */
.checkout-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200000;
  font-family: 'Montserrat', Arial, sans-serif;
}

.checkout-modal.open {
  display: flex;
}

.checkout-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}

.checkout-panel {
  position: relative;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  width: 92%;
  max-width: 680px;
  padding: 24px;
  z-index: 2;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.checkout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.checkout-header h2 {
  margin: 0;
  font-size: 1.35rem;
  font-family: 'Playfair Display', serif;
  color: var(--text, #231c17);
}

.checkout-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--muted, #6b6360);
}

.checkout-close:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text, #231c17);
}

.checkout-form {
  display: block;
}

.checkout-form .form-row {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
}

.checkout-form label {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--muted, #6b6360);
  font-size: 0.95rem;
}

.checkout-form input,
.checkout-form textarea {
  border: 1px solid #e9e5e2;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.98rem;
  outline: none;
  transition: box-shadow .14s, border-color .14s, transform .14s;
  background: #fff;
}

.checkout-form input:focus,
.checkout-form textarea:focus {
  box-shadow: 0 8px 24px rgba(188, 169, 138, 0.14);
  border-color: #bca98a;
  transform: translateY(-1px);
}

.checkout-form .two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width:520px) {
  .checkout-form .two-cols {
    grid-template-columns: 1fr;
  }
}

.checkout-form .form-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}

.hero-btn {
  background: var(--text, #231c17);
  color: #f5e8d6;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(35, 28, 23, 0.12);
}

.hero-btn.secondary {
  background: transparent;
  color: var(--text, #231c17);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: none;
}

.form-message {
  color: var(--muted, #6b6360);
  margin-top: 8px;
}

.checkout-panel .order-summary {
  margin-top: 12px;
  border-top: 1px dashed rgba(0, 0, 0, 0.06);
  padding-top: 12px;
  font-size: 0.95rem;
  color: var(--muted, #6b6360);
}

.checkout-modal[aria-hidden="true"] {
  display: none !important;
}