/* ============================================
   Ambika4u - Navbar Styles
   ============================================ */

.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
  transition: var(--transition);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 68px;
  gap: 20px;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo img {
  height: 36px;
  width: auto;
}

.logo-accent { color: var(--primary); }

/* Menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  margin: 0;
  padding: 0;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  background: rgba(108, 99, 255, 0.1);
  color: var(--primary);
}

.premium-link {
  color: #e67e22 !important;
}

.premium-link:hover {
  background: rgba(246, 211, 101, 0.15) !important;
  color: #e67e22 !important;
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.dropdown-toggle i {
  font-size: 0.7rem;
  transition: transform 0.3s;
}

.nav-dropdown:hover .dropdown-toggle i {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  min-width: 220px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 100;
}

.nav-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  transition: var(--transition);
}

.dropdown-menu li a:hover {
  background: rgba(108, 99, 255, 0.08);
  color: var(--primary);
}

.dropdown-menu li a i {
  width: 18px;
  text-align: center;
}

/* Right Side */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Dark Toggle */
.dark-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: var(--transition);
}

.dark-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108, 99, 255, 0.1);
}

/* User Menu */
.user-menu { position: relative; }

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 30px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
}

.user-btn:hover {
  border-color: var(--primary);
  background: rgba(108, 99, 255, 0.05);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  min-width: 220px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 100;
}

.user-menu:hover .user-dropdown,
.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-info {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-info strong {
  font-size: 0.9rem;
  color: var(--text);
}

.user-info small {
  font-size: 0.78rem;
  color: var(--text-light);
}

.user-dropdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0;
}

.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  transition: var(--transition);
}

.user-dropdown a:hover {
  background: rgba(108, 99, 255, 0.08);
  color: var(--primary);
}

.user-dropdown a i { width: 16px; text-align: center; }

.admin-link { color: var(--primary) !important; font-weight: 500; }
.logout-link { color: var(--danger) !important; }
.logout-link:hover { background: rgba(250, 112, 154, 0.08) !important; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ============================================
   RESPONSIVE NAVBAR
   ============================================ */

/* Tablet (600px - 900px): hamburger menu, no bottom nav */
@media (max-width: 900px) {
  .hamburger { display: flex; }

  .nav-menu {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 4px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    max-height: calc(100vh - 68px);
    overflow-y: auto;
  }

  .nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-link { padding: 12px 16px; }

  .nav-dropdown .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: rgba(108, 99, 255, 0.05);
    border-radius: var(--radius-sm);
    margin-top: 4px;
    display: none;
  }

  .nav-dropdown.open .dropdown-menu { display: block; }
  .nav-right .btn { display: none; }
}

/* Hide mobile elements by default (desktop/tablet) */
.mobile-topbar     { display: none; }
.mobile-bottom-nav { display: none; }

/* Mobile (< 600px): hide desktop navbar, show mobile top + bottom nav */
@media (max-width: 600px) {
  .navbar { display: none !important; }
  .mobile-topbar { display: flex; }
  .mobile-bottom-nav { display: flex; }
  body { padding-bottom: 70px; }
}

@media (max-width: 480px) {
  .nav-container { padding: 0 16px; }
  .user-btn span { display: none; }
}

/* ============================================
   MOBILE TOP BAR
   ============================================ */
.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 56px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ============================================
   MOBILE BOTTOM NAVIGATION
   ============================================ */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  height: 64px;
  align-items: stretch;
  justify-content: space-around;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.10);
  padding: 0 4px;
  /* Safe area for iPhone home indicator */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Each nav item */
.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.62rem;
  font-weight: 500;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
  min-width: 0;
}

.mob-nav-item:hover,
.mob-nav-item.mob-active {
  color: var(--primary);
}

/* Icon wrapper */
.mob-nav-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
  position: relative;
}

.mob-nav-item.mob-active .mob-nav-icon {
  color: var(--primary);
}

/* Active indicator dot above icon */
.mob-nav-item.mob-active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
}

/* Center Premium button — elevated pill */
.mob-nav-center-btn {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--primary), #764ba2);
  border-radius: 50%;
  color: #fff !important;
  font-size: 1.1rem;
  box-shadow: 0 4px 16px rgba(108,99,255,0.45);
  margin-top: -14px;
  border: 3px solid var(--bg-card);
}

.mob-nav-premium { color: var(--text-light); }
.mob-nav-premium.mob-active { color: var(--primary); }
.mob-nav-premium .mob-nav-center-btn { background: linear-gradient(135deg, #f6d365, #fda085); }

/* Profile avatar in bottom nav */
.mob-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  transition: var(--transition);
}

.mob-nav-item.mob-active .mob-avatar {
  border-color: var(--primary);
}

/* Label text */
.mob-nav-item span {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}


/* ============================================
   NOTIFICATION BELL
   ============================================ */
.notif-bell-wrap {
  position: relative;
}

.notif-bell-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
}

.notif-bell-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108, 99, 255, 0.08);
}

/* Unread badge */
.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #fa709a;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-card);
  line-height: 1;
  animation: badgePop 0.3s ease;
}

@keyframes badgePop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Notification Dropdown */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  overflow: hidden;
}

.notif-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.notif-dropdown-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-dropdown-title i { color: var(--primary); }

.notif-mark-read {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

.notif-mark-read:hover {
  background: rgba(108, 99, 255, 0.1);
}

.notif-dropdown-body {
  max-height: 360px;
  overflow-y: auto;
}

.notif-dropdown-body::-webkit-scrollbar { width: 4px; }
.notif-dropdown-body::-webkit-scrollbar-track { background: transparent; }
.notif-dropdown-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Individual notification item */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  cursor: default;
}

.notif-item:last-child { border-bottom: none; }

.notif-item:hover { background: rgba(108, 99, 255, 0.04); }

.notif-item.notif-unread {
  background: rgba(108, 99, 255, 0.05);
}

.notif-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-item-body { flex: 1; min-width: 0; }

.notif-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item-msg {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item-time {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 4px;
  opacity: 0.7;
}

/* Unread blue dot */
.notif-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

/* Empty state */
.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-light);
}

.notif-empty i {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
  opacity: 0.4;
}

.notif-empty p { font-size: 0.85rem; }

/* Mobile: full width dropdown — JS positions it via fixed */
@media (max-width: 600px) {
  .notif-dropdown {
    position: fixed !important;
    right: 8px !important;
    left: auto !important;
    width: calc(100vw - 16px) !important;
    max-width: 400px !important;
    top: 68px; /* fallback — JS overrides this dynamically */
    z-index: 9999 !important;
  }
}

/* ============================================
   MOBILE FIXES — Navbar dropdown, safe area
   ============================================ */

/* Dropdown — don't overflow viewport */
@media (max-width: 900px) {
  .dropdown-menu {
    min-width: auto;
    max-width: calc(100vw - 20px);
  }

  .user-dropdown {
    min-width: auto;
    max-width: calc(100vw - 20px);
    right: 0;
  }
}

/* Mobile bottom nav — safe area for iPhone */
@media (max-width: 600px) {
  .mobile-bottom-nav {
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
}
