/* ==========================================================================
   Navigation Bar (iOS Style)
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--ios-z-sticky);
  /* z-index: 9999; */
  width: 100%;
  height: var(--navbar-height);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;

  padding-inline: clamp(0.75rem, 2vw, 1.5rem);

  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  border-bottom: 1px solid var(--ios-border-secondary);
  overflow: visible;
}

/* Transparent option */
.navbar-transparent {
  background-color: rgba(255, 255, 255, 0.8);
  border-bottom-color: transparent;
}

/* ===============================
   BRAND / LOGO
================================ */
.navbar-brand {
  flex: 0 0 auto;

  display: flex;
  align-items: center;
  gap: 0.75rem;

  height: 100%;
  min-width: 0;

  font-size: clamp(1rem, 1.5vw, 1.2rem);
  font-weight: 600;
  color: var(--ios-secondary);
  text-decoration: none;
  white-space: nowrap;
}

.navbar-brand img {
  height: clamp(40px, 7vw, 55px);
  max-height: calc(var(--navbar-height) - 8px);
  width: auto;
  flex-shrink: 0;
}

.navbar-brand i,
.nav-brand i {
  font-size: 1.2rem;
}

/* ===============================
   TITLE
================================ */
.navbar-title {
  min-width: 0;

  font-size: clamp(1rem, 1.8vw, 1.125rem);
  font-weight: 600;
  color: var(--ios-text-primary);

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===============================
   MENU
================================ */
.navbar-menu {
  flex: 1 1 auto;
  min-width: 0;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.navbar-menu::-webkit-scrollbar {
  display: none;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;

  list-style: none;
  margin: 0;
  padding: 0;

  height: 100%;
  white-space: nowrap;
}

.nav-item {
  position: relative;

  display: flex;
  align-items: center;

  height: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;

  height: calc(var(--navbar-height) - 16px);
  padding-inline: clamp(0.5rem, 1.2vw, 1.2rem);

  color: var(--ios-primary-dark);
  font-weight: 500;
  text-decoration: none;

  border-radius: var(--ios-radius-md);
  transition: var(--ios-transition-medium);
}

.nav-link:hover,
.navbar-item:hover {
  background-color: var(--ios-gray-6);
}
.nav-link.active {
    color: var(--ios-gray-6);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--ios-secondary);
}

/* ===============================
   NAVBAR SEARCH
================================ */
.navbar-search {
  flex: 0 1 420px;
  min-width: 180px;

  display: flex;
  align-items: center;
  gap: 0.5rem;

  margin-left: auto;
  margin-right: 1rem;
}

.navbar-search-input {
  width: 100%;
  min-width: 0;

  padding: 0.45rem 0.75rem;

  border: 1px solid var(--ios-border-secondary, #ccc);
  border-radius: var(--ios-radius-sm);

  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.navbar-search-input:focus {
  border-color: var(--ios-primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
  outline: none;
}

.navbar-search-btn {
  flex: 0 0 auto;

  padding: 0.45rem 0.9rem;

  background-color: var(--ios-secondary);
  color: #fff;

  border: none;
  border-radius: var(--ios-radius-sm);

  cursor: pointer;
  font-size: 0.9rem;

  transition: background-color 0.2s;
}

.navbar-search-btn:hover {
  background-color: var(--ios-primary);
}

/* ===============================
   NAVBAR DROPDOWN
================================ */
.dropdown {
  position: relative;

  display: flex;
  align-items: center;

  height: 100%;
}

.dropdown-toggle::after {
  content: "▼";
  font-size: 0.6rem;
  margin-left: 0.35rem;
  line-height: 1;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% - 4px);
  left: 0;
  z-index: calc(var(--ios-z-sticky) + 1);
  /* z-index: 10000; */
  display: none;

  min-width: 220px;
  padding: 0.5rem 0;
  margin: 0;

  list-style: none;

  font-size: 0.95rem;
  color: var(--ios-primary-dark);
  text-align: left;

  background-color: #fff;
  border: 1px solid var(--ios-border-secondary, rgba(0, 0, 0, 0.15));
  border-radius: var(--ios-radius-sm);
  box-shadow: var(--ios-shadow-medium);
}

.dropdown-menu.dropdown-menu-end {
  left: auto;
  right: 0;
}

.dropdown-item {
  display: block;
  width: 100%;

  padding: 0.6rem 1.25rem;

  font-weight: 400;
  color: var(--ios-primary-dark);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;

  background-color: transparent;
  border: 0;

  transition: var(--ios-transition-medium);
}

.dropdown-item:hover {
  background-color: var(--ios-gray-6);
  color: var(--ios-green);
}

/* Desktop hover */
@media (hover: hover) and (pointer: fine) {
  .dropdown:hover > .dropdown-menu {
    display: block;
  }
}

/* Keyboard accessibility */
.dropdown:focus-within > .dropdown-menu {
  display: block;
}
.navbar-menu,
.navbar-nav,
.nav-item,
.dropdown {
  overflow: visible;
}

/* Mobile menu toggle (hidden by default) */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
}

.navbar-toggle span {
    height: 3px;
    width: 100%;
    background-color: var(--ios-primary);
    border-radius: 3px;
    transition: var(--ios-transition-medium);
}

/* Main content adjustment for horizontal navbar */
.container-fluid {
    margin-top: 0;
}

.main-content {
    padding: 2rem 0;
}

/* ===============================
   MOBILE TOGGLE BUTTON
================================ */
.navbar-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;

  width: 30px;
  height: 22px;

  padding: 0;
  border: 0;
  background: transparent;

  cursor: pointer;
  flex-shrink: 0;
}

.navbar-toggle span {
  height: 3px;
  width: 100%;

  background-color: var(--ios-primary);
  border-radius: 3px;

  transition: var(--ios-transition-medium);
}

/* Active hamburger animation */
.navbar-toggle.active span:nth-child(1) {
  transform: translateY(9.5px) rotate(45deg);
}

.navbar-toggle.active span:nth-child(2) {
  opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
  transform: translateY(-9.5px) rotate(-45deg);
}

/* ===============================
   MOBILE SIDEBAR
================================ */
.mobile-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10001;

  width: min(85vw, 320px);
  height: 100dvh;

  background: var(--ios-bg-primary, #fff);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);

  transform: translateX(100%);
  transition: transform 0.25s ease;

  display: flex;
  flex-direction: column;
}

.mobile-sidebar.open {
  transform: translateX(0);
}

.mobile-sidebar-header {
  height: var(--navbar-height, 64px);

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding-inline: 1rem;

  border-bottom: 1px solid var(--ios-border-secondary, #ddd);
}

.mobile-sidebar-close {
  border: 0;
  background: transparent;

  font-size: 2rem;
  line-height: 1;

  color: var(--ios-primary-dark, #333);
  cursor: pointer;
}

.mobile-sidebar-nav {
  display: flex;
  flex-direction: column;

  padding: 0.75rem;
  overflow-y: auto;
}

.mobile-sidebar-nav a {
  display: flex;
  align-items: center;

  min-height: 44px;
  padding: 0.75rem 1rem;

  color: var(--ios-primary-dark, #333);
  text-decoration: none;
  font-weight: 500;

  border-radius: var(--ios-radius-md, 8px);
}

.mobile-sidebar-nav a:hover {
  background: var(--ios-gray-6, #f2f2f7);
  color: var(--ios-primary);
}

/* ===============================
   OVERLAY
================================ */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;

  background: rgba(0, 0, 0, 0.35);

  opacity: 0;
  visibility: hidden;

  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-menu-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Prevent body scrolling when menu is open */
body.mobile-menu-open {
  overflow: hidden;
}

/* ===============================
   RESPONSIVE RULES
================================ */
/* @media (min-width: 768px) {
  .mobile-sidebar,
  .mobile-menu-overlay {
    display: none;
  }
} */

/* Responsive design for horizontal navbar */
@media (max-width: 992px) {
  /* .navbar-container {
    height: auto;
    padding: 1rem;
  } */
    
  .navbar-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background-color: #fff;
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: var(--ios-z-sticky);
  }
  
  .navbar-menu.active {
    right: 0;
  }
  
  .navbar-nav {
    flex-direction: column;
    width: 100%;
    height: auto;
  }
  
  .nav-item {
    width: 100%;
    height: auto;
    margin-bottom: 0.5rem;
  }
  
  .nav-link {
    padding: 1rem;
    height: auto;
  }
  
  .nav-link.active::after {
    display: none;
  }
  
  .dropdown {
    width: 100%;
    height: auto;
  }
  
  .dropdown-menu {
    position: static;
    display: none;
    width: 100%;
    box-shadow: none;
    border: none;
    padding-left: 1rem;
  }
  
  .dropdown.active .dropdown-menu {
    display: block;
  }
  
  .navbar-toggle {
    display: flex;
    z-index: var(--ios-z-sticky);
  }
  
  .navbar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .navbar-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .navbar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
  
  .navbar-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    margin-top: 1rem;
  }
  
  .navbar-action-btn {
    width: 100%;
    text-align: center;
  }
  
  .user-dropdown-menu {
    position: static;
    display: none;
    width: 100%;
    box-shadow: none;
    border: none;
  }
  
  .user-dropdown.active .user-dropdown-menu {
    display: block;
  }
}

@media (max-width: 768px) {
  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .navbar-brand img {
    height: 35px;
  }
  .navbar-menu {
    display: none;
  }

  .navbar-toggle {
    display: flex;
  }
}