/**
 * Menú smartphone — panel a ancho completo bajo cabecera fija (Figma 11764:22739).
 * Debe cargarse después de los estilos en línea de cada página.
 */

.mobile-header-bar {
  display: none;
}

@media (max-width: 768px) {
  :root {
    --mobile-header-height: 56px;
    /* Misma superficie que el panel del menú (cabecera al abrir) */
    --mobile-menu-surface: #ffffff;
  }

  .mobile-menu-backdrop {
    z-index: 1000 !important;
  }

  .mobile-menu {
    top: var(--mobile-header-height) !important;
    left: 0 !important;
    right: auto !important;
    width: 100% !important;
    height: calc(100dvh - var(--mobile-header-height)) !important;
    max-height: calc(100vh - var(--mobile-header-height)) !important;
    padding: 20px 0 28px !important;
    transform: translateX(100%);
    transition: transform 0.3s ease !important;
    box-shadow: none !important;
    background-color: var(--mobile-menu-surface) !important;
    border-top: 1px solid #e8e8e8;
    z-index: 1001 !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  .mobile-menu.active {
    transform: translateX(0) !important;
  }

  header {
    position: sticky;
    top: 0;
    z-index: 1002;
    transition: background-color 0.25s ease;
  }

  /* Cabecera alineada visualmente con el panel cuando el menú está abierto */
  body:has(.mobile-menu.active) header {
    background-color: var(--mobile-menu-surface) !important;
  }

  .mobile-menu-nav {
    padding-left: 16px !important;
    padding-right: 16px !important;
    margin-bottom: 16px !important;
  }

  .mobile-menu-actions {
    padding-left: 16px !important;
    padding-right: 16px !important;
    align-items: flex-start !important;
  }

  /* Selector idioma/país: alineado a la izquierda (no centrado en el panel) */
  .mobile-menu .mobile-country-selector {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    width: 100%;
    margin-bottom: 4px !important;
  }

  .mobile-menu .mobile-country-selector-button {
    justify-content: flex-start !important;
    align-self: flex-start !important;
    width: auto !important;
    max-width: 100%;
  }

  /* En cabecera ya hay acceso y perfil; ocultar duplicados en el panel */
  .mobile-menu-actions .mobile-user-icon-link,
  .mobile-menu-actions > a.btn-find-formula-ghost {
    display: none !important;
  }

  /* CTA “Craft / Crea…” en sólido negro, ancho con márgenes laterales */
  .mobile-menu .mobile-menu-actions a.btn.btn-primary {
    width: calc(100% - 32px);
    max-width: none;
    margin: 20px 16px 0 !important;
    margin-left: 16px !important;
    margin-right: 16px !important;
    box-sizing: border-box;
    align-self: center;
    justify-content: center;
    background: #1a1a1a !important;
    background-image: none !important;
    box-shadow: none !important;
    color: #fff !important;
    border: none !important;
    min-height: 48px;
    border-radius: 999px !important;
    font-weight: 500 !important;
  }

  /* ——— index (header-shell) ——— */
  .header-shell .header-inner {
    gap: 10px !important;
  }

  .header-shell .header-brand-nav {
    flex: 0 0 auto !important;
    min-width: 0;
  }

  .header-shell .header-right {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
  }

  .header-shell .header-profile-cta {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-left: 0 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    justify-content: flex-end !important;
  }

  .header-shell .header-profile-cta .user-icon-link {
    display: flex !important;
    order: 2;
    flex-shrink: 0;
  }

  /* Solo el botón “Access my fragrance” (cabecera móvil): caja pegada al texto */
  .header-shell .header-profile-cta .btn-find-formula-ghost {
    /* Sobreescribe .header-right .btn-find-formula-ghost { display: none } del CSS en línea */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    order: 1;
    /* Sin flex-grow: el botón no se estira; el borde queda junto al texto */
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: calc(100vw - 150px) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    min-height: 0 !important;
    height: auto !important;
    line-height: 1.15 !important;
    padding: 5px 8px !important;
    font-size: 14px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-shell .mobile-menu-toggle {
    flex-shrink: 0;
    order: 3;
  }

  /* ——— find_formula ——— */
  .container.container--find-formula header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    min-height: var(--mobile-header-height) !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .container.container--find-formula .header-left {
    flex: 0 0 auto !important;
    min-width: 0;
  }

  .container.container--find-formula .find-formula-mobile-nav-bar {
    /* flex-shrink: 0 vía flex: 1 0 auto — evita que la barra colapse a 0 y desaparezca el CTA */
    flex: 1 0 auto !important;
    justify-content: flex-end !important;
    gap: 6px !important;
  }

  .container.container--find-formula .find-formula-mobile-nav-ghost {
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: calc(100vw - 150px) !important;
    min-width: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 0 !important;
    height: auto !important;
    line-height: 1.15 !important;
    padding: 5px 8px !important;
    font-size: 14px !important;
  }

  /* ——— about_us (barra móvil con acceso / perfil / menú) ——— */
  .mobile-header-bar {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .container > header .mobile-header-bar .btn-find-formula-ghost {
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: calc(100vw - 150px) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 0 !important;
    height: auto !important;
    line-height: 1.15 !important;
    padding: 5px 8px !important;
    font-size: 14px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid #ccc !important;
    border-radius: 100px !important;
    background: transparent !important;
    color: #1a1a1a !important;
  }

  .container > header .mobile-header-bar .btn-find-formula-ghost:hover {
    border-color: #1a1a1a !important;
    color: #000 !important;
  }

  .container > header .mobile-header-bar .profile-btn {
    flex-shrink: 0;
  }

  .container > header .header-left {
    flex: 0 0 auto !important;
  }

  .container > header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
  }

  .container > header .header-right {
    display: none !important;
  }

  .container > header .mobile-actions {
    display: none !important;
  }

  /* ——— design-hubs ——— */
  header.design-hubs-top-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
    padding: 10px 16px !important;
    min-height: var(--mobile-header-height) !important;
    box-sizing: border-box;
    background: #f1f1f1 !important;
    border-bottom: 1px solid #eee;
  }

  header.design-hubs-top-header .logo {
    flex: 0 0 auto;
  }

  header.design-hubs-top-header .design-hubs-mobile-header-tools {
    flex: 1 1 auto;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
  }

  header.design-hubs-top-header .design-hubs-mobile-header-tools .btn-find-formula-ghost {
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: calc(100vw - 150px) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 0 !important;
    height: auto !important;
    line-height: 1.15 !important;
    padding: 5px 8px !important;
    font-size: 14px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  header.design-hubs-top-header .user-actions {
    display: none !important;
  }
}
