/* Mobile bottom navigation — visível apenas abaixo de 1024px */
:root {
  --mobile-nav-height: 4.25rem;
  --mobile-nav-accent: #8ec5ff;
  --mobile-nav-accent-dim: rgba(142, 197, 255, 0.14);
}

@media (min-width: 1024px) {
  .mobile-bottom-nav,
  .mobile-bottom-nav__sheet,
  .mobile-bottom-nav__backdrop {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  body.has-mobile-bottom-nav {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px)) !important;
  }

  .mobile-bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 45;
    pointer-events: none;
  }

  .mobile-bottom-nav__shell {
    pointer-events: auto;
    position: relative;
    background: rgb(var(--background) / 0.96);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav__track {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    gap: 0;
    min-height: var(--mobile-nav-height);
    padding: 0.35rem 0.25rem 0.5rem;
  }

  .mobile-bottom-nav__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.28rem;
    min-height: 3.25rem;
    padding: 0.35rem 0.15rem 0.15rem;
    border: none;
    background: transparent;
    color: rgba(228, 228, 231, 0.72);
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color 0.24s ease;
  }

  .mobile-bottom-nav__item:active {
    color: var(--mobile-nav-accent);
  }

  .mobile-bottom-nav__item.is-active {
    color: var(--mobile-nav-accent);
  }

  .mobile-bottom-nav__icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
  }

  .mobile-bottom-nav__icon-wrap svg,
  .mobile-bottom-nav__icon-wrap i {
    position: relative;
    z-index: 1;
  }

  .mobile-bottom-nav__icon-wrap svg {
    width: 1.35rem;
    height: 1.35rem;
    stroke-width: 1.75;
  }

  .mobile-bottom-nav__indicator {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--mobile-nav-accent-dim);
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
  }

  .mobile-bottom-nav__item.is-active .mobile-bottom-nav__indicator,
  .mobile-bottom-nav__item:active .mobile-bottom-nav__indicator {
    opacity: 1;
  }

  .mobile-bottom-nav__label {
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.1;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bottom-nav__fab-slot {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.15rem;
  }

  .mobile-bottom-nav__fab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    margin-top: -1.35rem;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    color: #0a0a0b;
    background: linear-gradient(145deg, #b8dcff 0%, var(--mobile-nav-accent) 45%, #6eb3ff 100%);
    box-shadow:
      0 0 0 3px rgb(var(--background)),
      0 8px 24px rgba(142, 197, 255, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.45);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition:
      opacity 0.24s ease,
      transform 0.2s ease,
      box-shadow 0.24s ease;
  }

  .mobile-bottom-nav__fab > * {
    position: relative;
    z-index: 1;
  }

  .mobile-bottom-nav__fab svg {
    width: 1.35rem;
    height: 1.35rem;
    stroke-width: 2.25;
  }

  .mobile-bottom-nav__fab:active {
    opacity: 0.88;
    transform: scale(0.96);
    box-shadow:
      0 0 0 3px rgb(var(--background)),
      0 4px 14px rgba(142, 197, 255, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .mobile-bottom-nav__fab.is-active {
    box-shadow:
      0 0 0 3px rgb(var(--background)),
      0 0 0 6px var(--mobile-nav-accent-dim),
      0 10px 28px rgba(142, 197, 255, 0.42),
      inset 0 1px 0 rgba(255, 255, 255, 0.5);
  }

  .mobile-bottom-nav__fab-ring {
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 1px solid rgba(142, 197, 255, 0.35);
    opacity: 0.7;
    pointer-events: none;
  }

  /* Sheets & backdrop */
  .mobile-bottom-nav__backdrop {
    position: fixed;
    inset: 0;
    z-index: 54;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    transition: background 0.32s ease;
  }

  .mobile-bottom-nav__backdrop.is-visible {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }

  .mobile-bottom-nav__sheet {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 55;
    display: flex;
    flex-direction: column;
    max-height: min(78vh, 32rem);
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px));
    background: rgb(var(--background) / 0.98);
    border-top: 1px solid rgba(142, 197, 255, 0.18);
    border-radius: 1.25rem 1.25rem 0 0;
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.55);
    transform: translate3d(0, 100%, 0);
    visibility: hidden;
    pointer-events: none;
    will-change: transform;
    transition:
      transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0.42s;
  }

  .mobile-bottom-nav__sheet.is-open {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
    transition:
      transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0s;
  }

  .mobile-bottom-nav__sheet-handle {
    flex-shrink: 0;
    width: 2.5rem;
    height: 0.25rem;
    margin: 0.65rem auto 0.35rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.16);
  }

  .mobile-bottom-nav__sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .mobile-bottom-nav__sheet-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fafafa;
  }

  .mobile-bottom-nav__sheet-title svg {
    width: 1.125rem;
    height: 1.125rem;
    color: var(--mobile-nav-accent);
  }

  .mobile-bottom-nav__sheet-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(228, 228, 231, 0.85);
    cursor: pointer;
    transition: background 0.18s ease;
  }

  .mobile-bottom-nav__sheet-close:active {
    background: rgba(255, 255, 255, 0.1);
  }

  .mobile-bottom-nav__sheet-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 1rem 1rem;
  }

  .mobile-bottom-nav__search-field {
    position: relative;
    margin-bottom: 0.75rem;
    display: block;
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-bottom-nav__search-field .site-header-search-field {
    position: relative;
    z-index: 1;
    width: 100%;
  }

  .mobile-bottom-nav__sheet--search.is-keyboard-open {
    bottom: var(--mobile-keyboard-offset, 0px);
    max-height: min(
      calc(100dvh - var(--mobile-keyboard-offset, 0px) - 0.75rem),
      28rem
    );
    padding-bottom: 0.75rem;
    transition:
      transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
      bottom 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      max-height 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0.4s;
  }

  .mobile-bottom-nav__sheet--search.is-keyboard-open.is-open {
    transition:
      transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
      bottom 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      max-height 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0s;
  }

  .mobile-bottom-nav__search-field:not(.has-search-value) .site-header-search-input {
    caret-color: transparent;
  }

  .mobile-bottom-nav__search-field.has-search-value .site-header-search-fake-ph {
    opacity: 0;
    visibility: hidden;
  }

  .mobile-bottom-nav__search-field.has-search-value .site-header-search-input {
    caret-color: #f4f4f5;
  }

  .mobile-bottom-nav__search-results {
    border-radius: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    max-height: min(42vh, 16rem);
    overflow-y: auto;
  }

  .mobile-bottom-nav__search-results.hidden {
    display: none;
  }

  .mobile-bottom-nav__cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 0.85rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.02);
    color: #e4e4e7;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition:
      background 0.18s ease,
      border-color 0.18s ease,
      color 0.18s ease;
  }

  .mobile-bottom-nav__cat-link + .mobile-bottom-nav__cat-link,
  .mobile-bottom-nav__cat-group + .mobile-bottom-nav__cat-link,
  .mobile-bottom-nav__cat-link + .mobile-bottom-nav__cat-group {
    margin-top: 0.35rem;
  }

  .mobile-bottom-nav__cat-link:active,
  .mobile-bottom-nav__cat-toggle:active {
    background: rgba(142, 197, 255, 0.1);
    border-color: rgba(142, 197, 255, 0.22);
  }

  .mobile-bottom-nav__cat-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 0.85rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.02);
    color: #e4e4e7;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
  }

  .mobile-bottom-nav__cat-toggle[data-state='open'] svg[data-lucide='chevron-down'] {
    transform: rotate(180deg);
  }

  .mobile-bottom-nav__cat-sub {
    display: none;
    padding: 0.25rem 0 0.25rem 0.65rem;
  }

  .mobile-bottom-nav__cat-sub[data-state='open'] {
    display: block;
  }

  .mobile-bottom-nav__cat-sub .mobile-bottom-nav__cat-link {
    font-size: 0.8125rem;
    padding: 0.55rem 0.75rem;
  }

  .mobile-bottom-nav__support-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    color: #e4e4e7;
    text-decoration: none;
    transition: background 0.18s ease;
  }

  .mobile-bottom-nav__support-link + .mobile-bottom-nav__support-link {
    margin-top: 0.45rem;
  }

  .mobile-bottom-nav__support-link:active {
    background: rgba(142, 197, 255, 0.08);
  }

  .mobile-bottom-nav__support-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.65rem;
    background: rgba(142, 197, 255, 0.1);
    flex-shrink: 0;
  }

  .mobile-bottom-nav__support-meta {
    flex: 1;
    min-width: 0;
  }

  .mobile-bottom-nav__support-name {
    font-size: 0.875rem;
    font-weight: 600;
  }

  .mobile-bottom-nav__support-desc {
    font-size: 0.6875rem;
    color: rgba(161, 161, 170, 0.95);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.mobile-bottom-nav-sheet-open {
    overflow: hidden;
  }

  .mobile-bottom-nav.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  }
}

@media (max-width: 1023px) and (prefers-reduced-motion: reduce) {
  .mobile-bottom-nav__item,
  .mobile-bottom-nav__fab,
  .mobile-bottom-nav__sheet,
  .mobile-bottom-nav__backdrop,
  .mobile-bottom-nav__indicator {
    transition: none !important;
  }

  .mobile-bottom-nav__sheet.is-open {
    transform: none !important;
  }

  .mobile-bottom-nav__fab:active {
    transform: none;
    opacity: 1;
  }
}
