/* ===================================
   Engadina Now - Bottom Navigation
   =================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--divider);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: var(--space-md) var(--space-lg) max(calc(env(safe-area-inset-bottom) + var(--space-md)), var(--space-lg));
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(76, 144, 164, 0.05);
}

/* ===== Nav Item ===== */
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  color: var(--text-secondary);
  transition: all var(--duration-normal) var(--ease-smooth);
  min-height: 44px;
  min-width: 44px;
  position: relative;
}

.nav-item:hover {
  color: var(--lake-blue);
  transform: translateY(-1px);
}

.nav-item.active {
  color: var(--lake-blue);
  transform: scale(1.05);
}

/* Active gradient background (Alpine Whisper style) */
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 60%;
  background: linear-gradient(
    to top,
    rgba(76, 144, 164, 0.12) 0%,
    rgba(76, 144, 164, 0.06) 50%,
    rgba(76, 144, 164, 0) 100%
  );
  border-radius: var(--radius-lg);
  z-index: -1;
  transition: all var(--duration-normal) var(--ease-smooth);
}

/* Active indicator line (top) */
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: linear-gradient(
    to right,
    rgba(76, 144, 164, 0) 0%,
    var(--lake-blue) 50%,
    rgba(76, 144, 164, 0) 100%
  );
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* ===== Nav Icon ===== */
.nav-icon {
  width: 28px;
  height: 28px;
  opacity: 0.8;
  transition: opacity var(--duration-normal) var(--ease-smooth),
              transform var(--duration-normal) var(--ease-smooth);
}

.nav-item.active .nav-icon {
  opacity: 1;
}

/* Icon fill behavior: outline when inactive, filled when active */
.nav-item .icon-outline {
  opacity: 1;
  transition: opacity var(--duration-normal) var(--ease-smooth);
}

.nav-item.active .icon-outline {
  opacity: 0.3; /* Reduce outline visibility when active */
}

.nav-item .icon-fill-area {
  fill: none;
  transition: fill var(--duration-normal) var(--ease-smooth);
}

.nav-item.active .icon-fill-area {
  fill: currentColor; /* Fill with lake-blue when active */
}

/* Micro-bounce animation on tap/click */
.nav-item:active .nav-icon {
  animation: nav-bounce 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes nav-bounce {
  0% { transform: scale(1); }
  50% { transform: scale(0.88); }
  100% { transform: scale(1); }
}

/* ===== Nav Label ===== */
.nav-label {
  display: none; /* Hidden - icons only navigation */
  font-size: var(--text-xsmall);
  font-weight: var(--weight-medium);
  line-height: 1;
  transition: all var(--duration-normal) var(--ease-smooth);
  opacity: 0.85;
}

.nav-item.active .nav-label {
  font-weight: var(--weight-semibold);
  opacity: 1;
  letter-spacing: 0.02em;
}

.nav-item:hover .nav-label {
  opacity: 1;
}

/* ===== Responsive - Desktop ===== */
@media (min-width: 1024px) {
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 20px rgba(76, 144, 164, 0.08);
  }

  .nav-item:hover {
    background: var(--bg-overlay);
  }
}

/* ===== Responsive - Small Phones ===== */
@media (max-width: 374px) {
  .nav-label {
    font-size: 10px;
  }

  .nav-icon {
    width: 20px;
    height: 20px;
  }
}

/* ===== Support for Landscape Mode ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .bottom-nav {
    height: calc(48px + env(safe-area-inset-bottom));
  }

  .nav-icon {
    width: 20px;
    height: 20px;
  }

  .nav-label {
    display: none; /* Hide labels in landscape to save space */
  }

  .nav-item {
    padding: var(--space-xs);
  }
}

/* ===== Accessibility - Keyboard Navigation ===== */
.nav-item:focus-visible {
  outline: 2px solid var(--lake-blue);
  outline-offset: 2px;
  background: var(--bg-overlay);
}

/* ===== Loading State ===== */
.nav-item.loading .nav-icon {
  animation: pulse-soft 1.5s ease-in-out infinite;
}
