/* Floating macOS Dock Navigation Styles */

/* Overflow Bottom Blur Backdrop */
.overflow-blur {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 106px;
  z-index: 99;
  pointer-events: none;
  user-select: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  mask-image: linear-gradient(
    to top,
    rgb(0 0 0 / 1) 0%,
    rgb(0 0 0 / 0.989) 6.7%,
    rgb(0 0 0 / 0.957) 13.3%,
    rgb(0 0 0 / 0.905) 20%,
    rgb(0 0 0 / 0.835) 26.7%,
    rgb(0 0 0 / 0.75) 33.3%,
    rgb(0 0 0 / 0.655) 40%,
    rgb(0 0 0 / 0.552) 46.7%,
    rgb(0 0 0 / 0.448) 53.3%,
    rgb(0 0 0 / 0.345) 60%,
    rgb(0 0 0 / 0.25) 66.7%,
    rgb(0 0 0 / 0.165) 73.3%,
    rgb(0 0 0 / 0.095) 80%,
    rgb(0 0 0 / 0.043) 86.7%,
    rgb(0 0 0 / 0.011) 93.3%,
    rgb(0 0 0 / 0) 100%
  );
  -webkit-mask-image: linear-gradient(
    to top,
    rgb(0 0 0 / 1) 0%,
    rgb(0 0 0 / 0.989) 6.7%,
    rgb(0 0 0 / 0.957) 13.3%,
    rgb(0 0 0 / 0.905) 20%,
    rgb(0 0 0 / 0.835) 26.7%,
    rgb(0 0 0 / 0.75) 33.3%,
    rgb(0 0 0 / 0.655) 40%,
    rgb(0 0 0 / 0.552) 46.7%,
    rgb(0 0 0 / 0.448) 53.3%,
    rgb(0 0 0 / 0.345) 60%,
    rgb(0 0 0 / 0.25) 66.7%,
    rgb(0 0 0 / 0.165) 73.3%,
    rgb(0 0 0 / 0.095) 80%,
    rgb(0 0 0 / 0.043) 86.7%,
    rgb(0 0 0 / 0.011) 93.3%,
    rgb(0 0 0 / 0) 100%
  );
}

/* Native View Transitions API support */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.2s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

::view-transition-old(persistent-dock),
::view-transition-new(persistent-dock) {
  animation: none;
  mix-blend-mode: normal;
}

/* Navbar Dock Parent */
.navbar-parent-container {
  view-transition-name: persistent-dock;
  z-index: 1000;
  opacity: 1;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 106px;
  padding: 24px;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  transform: translateY(0%);
  pointer-events: none;
  overflow: visible !important;
}

.navbar-parent-container-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(150%);
}

.navbar-nav-container {
  pointer-events: auto;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-rounded, 9999px);
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  height: 58px;
  padding: 8px 8px 0;
  animation: 0.45s cubic-bezier(0.16, 1, 0.3, 1) navbarEntrance;
  display: flex;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.14);
  position: relative;
  overflow: visible !important;
}

[data-theme="dark"] .navbar-nav-container {
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.38);
}

@keyframes navbarEntrance {
  0% {
    opacity: 0;
    transform: translateY(140%) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateY(0%) scale(1);
  }
}

.navbar-nav-end-container {
  align-items: flex-end;
  gap: 8px;
  padding-bottom: 8px;
  display: flex;
  overflow: visible !important;
}

.navbar-icon-parent-container {
  border-radius: var(--radius-rounded, 9999px);
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: visible !important;
}

.navbar-icon-container {
  border-radius: var(--radius-rounded, 9999px);
  background: var(--bg-tertiary);
  justify-content: center;
  align-items: center;
  display: flex;
  position: relative;
  width: 40px;
  height: 40px;
  transform-origin: bottom center;
  transition: width 0.16s cubic-bezier(0.2, 0, 0, 1), height 0.16s cubic-bezier(0.2, 0, 0, 1), background-color 0.2s ease;
  will-change: width, height, transform;
  overflow: visible !important;
}

/* Tap / Click Bounce Animation - High Spring Jump */
@keyframes dockTapBounce {
  0% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
  40% {
    transform: translateY(-26px);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  68% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
  84% {
    transform: translateY(-6px);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  100% {
    transform: translateY(0);
  }
}

.navbar-icon-parent-container.is-bouncing {
  z-index: 50 !important;
}

.navbar-icon-parent-container.is-bouncing .navbar-icon-container {
  animation: dockTapBounce 0.62s cubic-bezier(0.25, 1, 0.4, 1) forwards !important;
  z-index: 50 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .navbar-icon-parent-container.is-bouncing .navbar-icon-container {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.navbar-icon-parent-container:active .navbar-icon-container {
  transform: scale(0.92);
  transition: transform 0.08s ease;
}

/* Tooltip Display */
.navbar-icon-parent-container:hover .navbar-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -4px);
}

.navbar-tooltip {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  font: var(--type-s);
  border-radius: var(--radius-rounded, 9999px);
  white-space: nowrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  display: flex;
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translate(-50%, 4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  z-index: 1010;
  user-select: none;
}

[data-theme="dark"] .navbar-tooltip {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.navbar-tooltip-key {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-rounded, 9999px);
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: var(--fw-semibold, 600);
  text-transform: uppercase;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  display: flex;
  color: var(--text-secondary);
}

.navbar-icon {
  justify-content: center;
  align-items: center;
  display: flex;
  width: 20px;
  height: 20px;
  transition: width 0.16s cubic-bezier(0.2, 0, 0, 1), height 0.16s cubic-bezier(0.2, 0, 0, 1);
}

.navbar-pure-icon {
  width: 100%;
  height: 100%;
  display: block;
}

/* Active Indicator - Anchored to dock, stays grounded while icon jumps */
.navbar-indicator {
  border-radius: var(--radius-rounded, 9999px);
  background: var(--text-primary);
  width: 4px;
  height: 4px;
  position: absolute;
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.85;
  pointer-events: none;
  animation: indicatorPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: opacity 0.2s ease;
}

@keyframes indicatorPop {
  0% {
    transform: translateX(-50%) scale(0);
    opacity: 0;
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.85;
  }
}

@keyframes indicatorPop {
  0% {
    transform: translateX(-50%) scale(0);
    opacity: 0;
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.85;
  }
}

[data-theme="dark"] .navbar-icon-container {
  --gray-8: #505050;
  --gray-10: #9e9e9e;
}

[data-theme="light"] .navbar-icon-container {
  --gray-8: #c7c7c7;
  --gray-10: #757575;
}

/* ============================================================
   Smartphone / Mobile Optimization (<= 688px)
   ============================================================ */
@media screen and (max-width: 688px) {
  .overflow-blur {
    height: 88px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .navbar-tooltip {
    display: none !important;
  }

  .navbar-parent-container {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 84px;
    padding: 12px 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.25s ease;
  }

  .navbar-nav-container {
    height: 56px;
    padding: 6px 8px;
    border-radius: 9999px;
    max-width: calc(100vw - 20px);
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
    overflow: visible !important;
    pointer-events: auto;
    animation: navbarEntranceMobile 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes navbarEntranceMobile {
    0% {
      opacity: 0;
      transform: translateY(180%) scale(0.92);
    }
    100% {
      opacity: 1;
      transform: translateY(0%) scale(1);
    }
  }

  .navbar-nav-end-container {
    gap: 6px;
    align-items: center;
    padding-bottom: 0;
    flex-wrap: nowrap;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }

  .navbar-nav-end-container::-webkit-scrollbar {
    display: none;
  }

  .navbar-icon-parent-container {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
    align-items: center;
  }

  .navbar-icon-container {
    width: 40px !important;
    height: 40px !important;
  }

  .navbar-icon {
    width: 20px !important;
    height: 20px !important;
  }

  .navbar-indicator {
    top: auto;
    bottom: 3px;
    width: 3.5px;
    height: 3.5px;
  }
}

/* Very narrow smartphones (< 360px) */
@media screen and (max-width: 360px) {
  .navbar-nav-container {
    padding: 4px 6px;
    height: 52px;
  }

  .navbar-nav-end-container {
    gap: 4px;
  }

  .navbar-icon-parent-container {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .navbar-icon-container {
    width: 36px !important;
    height: 36px !important;
  }

  .navbar-icon {
    width: 18px !important;
    height: 18px !important;
  }
}
