/* =============================================
 * AME Custom Theme - header-mobile.css
 * Mobile header: burger, slide-in menu, bottom
 * bar, FAB call button.
 *
 * @package AME_Custom
 * @version 1.0.0
 * ============================================= */

/* =============================================
 * BURGER BUTTON (visible on tablet + mobile)
 * ============================================= */
@media (max-width: 1023px) {
  .burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    cursor: pointer;
    gap: 5px;
    padding: 0;
    z-index: 1100;
    -webkit-tap-highlight-color: transparent;
  }

  .burger__line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ame-bleu-nuit);
    border-radius: 2px;
    transition:
      transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
      opacity 0.25s ease;
    transform-origin: center;
  }

  /* X animation when open */
  .burger.is-active .burger__line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .burger.is-active .burger__line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .burger.is-active .burger__line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* Hide burger on desktop */
@media (min-width: 1024px) {
  .burger {
    display: none !important;
  }
}


/* =============================================
 * MOBILE SPECIFIC (max-width: 767px)
 * ============================================= */
@media (max-width: 767px) {

  /* -- Header adjustments -- */
  .site-header {
    height: 56px;
  }

  .header__inner {
    padding: 0 16px;
  }

  .header__logo img {
    height: 32px;
  }

  /* Hide desktop-only elements */
  .header__nav,
  .header__phone {
    display: none !important;
  }

  /* Hide devis button on mobile (using bottom bar instead) */
  .header__cta {
    display: none !important;
  }

  /* Adjust body padding for smaller header */
  body {
    padding-top: calc(var(--topbar-height) + 56px);
    padding-bottom: 64px; /* space for bottom bar */
  }

  body.topbar-closed {
    padding-top: 56px;
  }
}


/* =============================================
 * MOBILE MENU — Slide-in Panel
 * ============================================= */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  z-index: 1050;
  background: var(--ame-blanc);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  will-change: transform;
}

.mobile-menu.is-open {
  transform: translateX(0);
}

/* Mobile menu overlay */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1049;
  background: rgba(28, 33, 67, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
  pointer-events: none;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

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

/* Body scroll lock */
body.menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}


/* -- Mobile Menu Header -- */
.mm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ame-border);
  position: sticky;
  top: 0;
  background: var(--ame-blanc);
  z-index: 2;
}

.mm-logo {
  display: flex;
  align-items: center;
}

.mm-logo img {
  height: 32px;
  width: auto;
}

.mm-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ame-fond-card);
  border: 1px solid var(--ame-border);
  cursor: pointer;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mm-close:hover,
.mm-close:active {
  background: #eee;
}

.mm-close svg {
  width: 16px;
  height: 16px;
  stroke: var(--ame-bleu-nuit);
  stroke-width: 2.5;
  fill: none;
}


/* -- Accordion Items -- */
.mm-accordion {
  padding: 8px 0;
}

.mm-item {
  border-bottom: 1px solid var(--ame-border);
}

.mm-item__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #1C2143;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease;
}

.mm-item__trigger:active {
  background: rgba(212, 194, 252, 0.1);
}

.mm-item__chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mm-item__chevron svg {
  width: 16px;
  height: 16px;
  stroke: #998FC7;
  stroke-width: 2.5;
  fill: none;
}

.mm-item.is-open .mm-item__chevron {
  transform: rotate(90deg);
}


/* -- Sub-menus -- */
.mm-sub {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  background: #fafaf8;
}

.mm-item.is-open .mm-sub {
  max-height: 2000px;
}

.mm-sub__inner {
  padding: 8px 16px 16px;
}

.mm-sub__category {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #998FC7;
  padding: 12px 4px 8px;
  margin-top: 4px;
}

.mm-sub__category:first-child {
  margin-top: 0;
  padding-top: 4px;
}

.mm-sub__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mm-sub__link:active {
  background: rgba(212, 194, 252, 0.15);
}

.mm-sub__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f0f0ec, #e8e8e4);
  font-size: 18px;
  flex-shrink: 0;
}

.mm-sub__label {
  font-size: 14px;
  font-weight: 600;
  color: #1C2143;
  line-height: 1.3;
}

.mm-sub__desc {
  font-size: 12px;
  color: #888;
  line-height: 1.3;
}

.mm-sub__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}


/* -- Google Badge -- */
.mm-google {
  margin: 16px 20px 0;
  padding: 14px 16px;
  background: #fafaf8;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
}

.mm-google__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.mm-google__logo svg {
  width: 24px;
  height: 24px;
}

.mm-google__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mm-google__rating {
  font-size: 14px;
  font-weight: 700;
  color: #1C2143;
}

.mm-google__stars {
  color: #FBBF24;
  font-size: 13px;
  letter-spacing: 1px;
}

.mm-google__count {
  font-size: 12px;
  color: #888;
}


/* -- Agence Card -- */
.mm-agence {
  margin: 16px 20px 0;
  padding: 20px;
  background: linear-gradient(135deg, #D4C2FC 0%, #998FC7 100%);
  border-radius: var(--radius-md);
  color: var(--ame-blanc);
}

.mm-agence__title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  opacity: 0.95;
}

.mm-agence__detail {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
  opacity: 0.9;
}

.mm-agence__detail svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  stroke: currentColor;
  fill: none;
}

.mm-agence__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ame-blanc);
  margin-top: 8px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.mm-agence__link:active {
  opacity: 0.7;
}

.mm-agence__link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
}


/* -- Bottom CTAs -- */
.mm-ctas {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mm-cta--devis {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  background: var(--ame-lime);
  color: var(--ame-bleu-nuit);
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.25s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.mm-cta--devis:active {
  background: #b0ee60;
}

.mm-cta--phone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  background: transparent;
  color: var(--ame-bleu-nuit);
  font-size: 15px;
  font-weight: 600;
  border: 1.5px solid var(--ame-lavande);
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.mm-cta--phone:active {
  background: var(--ame-lavande-clair);
  border-color: var(--ame-lavande-clair);
}


/* -- Trust Dots -- */
.mm-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 20px 8px;
}

.mm-trust__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #888;
  white-space: nowrap;
}

.mm-trust__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ame-lime);
  flex-shrink: 0;
}


/* =============================================
 * BOTTOM BAR — Sticky Navigation
 * ============================================= */
.bottom-bar {
  display: none;
}

@media (max-width: 767px) {
  .bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    height: 64px;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--ame-border);
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .bottom-bar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    padding: 8px 4px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    border: none;
    background: none;
  }

  .bottom-bar__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
  }

  .bottom-bar__icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
    fill: none;
  }

  /* Devis icon - lime accent */
  .bottom-bar__item--devis .bottom-bar__icon svg {
    stroke: #5a8a1a;
  }

  /* Appeler icon - lavande accent */
  .bottom-bar__item--appeler .bottom-bar__icon svg {
    stroke: #998FC7;
  }

  /* Agence icon - grey */
  .bottom-bar__item--agence .bottom-bar__icon svg {
    stroke: #888;
  }

  /* Menu icon - grey */
  .bottom-bar__item--menu .bottom-bar__icon svg {
    stroke: #888;
  }

  .bottom-bar__label {
    font-size: 10px;
    font-weight: 600;
    color: #888;
    line-height: 1;
  }

  .bottom-bar__item--devis .bottom-bar__label {
    color: #5a8a1a;
  }

  .bottom-bar__item--appeler .bottom-bar__label {
    color: #998FC7;
  }

  .bottom-bar__item:active {
    transform: scale(0.92);
  }

  .bottom-bar__item {
    transition: transform 0.15s ease;
  }
}


/* =============================================
 * FAB — Floating Action Button (Call)
 * ============================================= */
.fab-call {
  display: none;
}

@media (max-width: 767px) {
  .fab-call {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 1045;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ame-lime);
    color: var(--ame-bleu-nuit);
    box-shadow:
      0 4px 16px rgba(193, 255, 114, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    animation: fab-pulse 2s ease-in-out infinite;
    transition: transform 0.25s var(--ease-out);
  }

  .fab-call:active {
    transform: scale(0.9);
  }

  .fab-call svg {
    width: 24px;
    height: 24px;
    stroke: var(--ame-bleu-nuit);
    stroke-width: 2;
    fill: none;
  }

  @keyframes fab-pulse {
    0%, 100% {
      box-shadow:
        0 4px 16px rgba(193, 255, 114, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
      box-shadow:
        0 4px 24px rgba(193, 255, 114, 0.7),
        0 2px 12px rgba(0, 0, 0, 0.15),
        0 0 0 8px rgba(193, 255, 114, 0.15);
    }
  }

  /* Respect prefers-reduced-motion */
  @media (prefers-reduced-motion: reduce) {
    .fab-call {
      animation: none;
    }
  }
}


/* =============================================
 * TABLET ADJUSTMENTS (768px - 1023px)
 * ============================================= */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Mobile menu still slides in but wider */
  .mobile-menu {
    max-width: 480px;
  }

  /* Bottom bar and FAB are hidden on tablet */
  .bottom-bar,
  .fab-call {
    display: none !important;
  }

  /* Burger is visible via the 1023px rule above */

  /* Header keeps full height on tablet */
  .header__logo img {
    height: 40px;
  }

  /* Hide desktop nav on tablet */
  .header__nav,
  .header__phone {
    display: none !important;
  }
}


/* =============================================
 * SWIPE TRANSITION STATES
 * Used by mobile-menu.js during touch swipe
 * ============================================= */
.mobile-menu.is-swiping {
  transition: none;
}

.mobile-menu-overlay.is-swiping {
  transition: none;
}


/* =============================================
 * HIDE MOBILE ELEMENTS ON DESKTOP
 * ============================================= */
@media (min-width: 1024px) {
  .mobile-menu,
  .mobile-menu-overlay,
  .bottom-bar,
  .fab-call {
    display: none !important;
  }
}
