/* Bottom Navigation Bar for Mobile App */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 0 8px 0;
  z-index: 1000;
  min-height: 65px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  transition: all 0.3s ease;
  padding: 4px 2px 6px 2px;
  position: relative;
  cursor: pointer;
  min-height: 55px;
}

.bottom-nav-item:hover {
  color: #ffffff;
  transform: translateY(-2px);
}

.bottom-nav-item.active {
  color: #ffffff;
}

.bottom-nav-item.active .bottom-nav-label {
  opacity: 1;
  font-weight: 800;
}

.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: #ffffff;
  border-radius: 0 0 3px 3px;
}

.bottom-nav-icon {
  font-size: 22px;
  margin-bottom: 2px;
  transition: all 0.3s ease;
  line-height: 1;
  filter: brightness(1.1);
}

.bottom-nav-item.active .bottom-nav-icon {
  transform: scale(1.1);
}

.bottom-nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: capitalize;
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  line-height: 1.3;
  min-height: 16px;
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  opacity: 0.95;
}

/* Hide on desktop */
@media (min-width: 769px) {
  .bottom-nav {
    display: none;
  }
}

/* Add padding to body to prevent content from being hidden */
body.has-bottom-nav {
  padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
}

/* PWA Install Banner Styles */
.pwa-install-banner {
  position: fixed;
  bottom: -200px;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 9999;
  border-radius: 20px 20px 0 0;
}

.pwa-install-banner.show {
  bottom: 65px; /* sit above the bottom nav bar */
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.pwa-banner-icon {
  flex-shrink: 0;
}

.pwa-banner-icon img {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: white;
  padding: 5px;
}

.pwa-banner-text {
  flex: 1;
}

.pwa-banner-text h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
}

.pwa-banner-text p {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
}

.pwa-banner-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pwa-install-btn {
  background: white;
  color: #667eea;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pwa-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pwa-dismiss-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.pwa-dismiss-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Success Message */
.pwa-success-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #4CAF50;
  color: white;
  padding: 15px 25px;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  font-weight: 500;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.pwa-success-message.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Adjust for apps running in standalone mode */
@media (display-mode: standalone) {
  .pwa-install-banner {
    display: none;
  }
  
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
  }
  
  /* Hide desktop navigation on mobile */
  header nav ul {
    display: none;
  }
  
  /* Make sure content doesn't hide under bottom nav */
  main,
  .dashboard-content,
  .page-container,
  .learning-container {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Ripple effect on tap */
.bottom-nav-item::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.bottom-nav-item:active::after {
  width: 100px;
  height: 100px;
}
