/* ========================================
   BASE NAVBAR STYLES
   Uses --navbar-height from globals.css
   ======================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  height: var(--navbar-height);
  min-height: var(--navbar-height);
  max-height: var(--navbar-height);
  border-bottom: 1px solid #e0e0e0;
}

.navbar-brand {
  min-height: var(--navbar-height);
}

.navbar-brand .navbar-item {
  padding-top: 0;
  padding-bottom: 0;
}

/* Remove right padding from logo so collapser sits close to it */
.navbar-brand .logo-link {
  padding-right: 0;
}

.navbar-brand .navbar-item img,
.navbar-brand .navbar-item svg.logo {
  max-height: 3.0rem;
  height: 3.0rem;
}

/* ========================================
   MOBILE SIDEBAR TOGGLE (hamburger - mobile only)
   ======================================== */

.mobile-sidebar-toggle {
  display: flex;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.75rem;
  color: #4a4a4a;
  font-size: 1.25rem;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
}

.mobile-sidebar-toggle:hover {
  color: #363636;
}

[data-theme="dark"] .mobile-sidebar-toggle {
  color: #b0b0b0;
}

[data-theme="dark"] .mobile-sidebar-toggle:hover {
  color: #e0e0e0;
}

/* Hide on desktop */
@media screen and (min-width: 1024px) {
  .mobile-sidebar-toggle {
    display: none;
  }
}

/* Hide logo on mobile - it appears in sidebar instead */
@media screen and (max-width: 1023px) {
  .navbar-brand .logo-link {
    display: none;
  }
}

/* ========================================
   SIDEBAR COLLAPSE BUTTON (desktop only)
   ======================================== */

.sidebar-collapse-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: #7a7a7a;
  align-items: center;
  justify-content: center;
  margin-left: -0.5rem;
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.sidebar-collapse-btn:hover {
  color: #363636;
  background-color: rgba(0, 0, 0, 0.05);
}

.sidebar-collapse-btn .collapse-icon {
  transition: transform 0.2s ease;
}

/* Flip icon when collapsed */
body.sidebar-collapsed .sidebar-collapse-btn .collapse-icon {
  transform: rotate(180deg);
}

[data-theme="dark"] .sidebar-collapse-btn {
  color: #9a9a9a;
}

[data-theme="dark"] .sidebar-collapse-btn:hover {
  color: #e0e0e0;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Show only on desktop */
@media screen and (min-width: 1024px) {
  .sidebar-collapse-btn {
    display: flex;
  }
}

/* ========================================
   LOGO SWITCHING (COLLAPSED STATE)
   ======================================== */

.logo-link .logo-mini {
  display: none;
  height: 2.5rem;
  max-height: 2.5rem;
}

body.sidebar-collapsed .logo-link .logo {
  display: none;
}

body.sidebar-collapsed .logo-link .logo-mini {
  display: block;
}

body.sidebar-collapsed .logo-link .logo-mini svg text {
  text-anchor: middle;
}

/* When sidebar is collapsed, size the logo link to match sidebar width for alignment */
@media screen and (min-width: 1024px) {
  body.sidebar-collapsed .logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--sidebar-width-collapsed);
    padding-left: 0;
    padding-right: 0;
  }
}

/* Prevent background change on logo hover/active/focus - needs !important to override Bulma */
.navbar-brand > a.navbar-item:is(:hover, :focus, :active),
[data-theme="dark"] .navbar-brand > a.navbar-item:is(:hover, :focus, :active) {
  background-color: transparent !important;
}

/* Container for theme toggle and hamburger on mobile */
.navbar-brand-end {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* Prevent background change on hamburger menu */
.navbar-burger:is(:hover, :focus, :active) {
  background-color: transparent !important;
}

/* ========================================
   NAVBAR BUTTONS (LIGHT THEME)
   ======================================== */

.navbar.is-light .button.is-primary {
  background-color: #3b82f6;
  border: none;
  color: white;
}

.navbar.is-light .button.is-primary:hover {
  background-color: #2563eb;
}

.navbar.is-light .button.is-light {
  border: 1px solid #e5e7eb;
}

.navbar.is-light .button.is-light:hover {
  background-color: #f3f4f6;
}


/* ========================================
   THEME TOGGLE BUTTON (auth pages)
   ======================================== */

/* Responsive visibility for auth pages */
.theme-toggle-mobile {
  display: flex;
}

.theme-toggle-desktop {
  display: none;
}

@media screen and (min-width: 1024px) {
  .theme-toggle-mobile {
    display: none;
  }

  .theme-toggle-desktop {
    display: flex;
  }
}

/* Button styling */
.theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* No background on hover - keep transparent */
.theme-toggle:is(:hover, :focus, :active) {
  background-color: transparent;
}

/* Icon styling - consolidated for both sun and moon */
.theme-toggle .fa-sun,
.theme-toggle .fa-moon {
  font-size: 1.25rem;
  transition: filter 0.2s ease;
}

.theme-toggle .fa-sun {
  color: #fbbf24;
}

.theme-toggle .fa-moon {
  color: #8b5cf6;
}

.theme-toggle:hover .fa-sun,
.theme-toggle:hover .fa-moon {
  filter: brightness(1.2);
}

/* Prevent navbar-item hover/active/focus effect on theme toggle container - needs !important to override Bulma */
.navbar-item:has(.theme-toggle):is(:hover, :focus, :active),
[data-theme="dark"] .navbar-item:has(.theme-toggle):is(:hover, :focus, :active) {
  background-color: transparent !important;
}

/* ========================================
   PROFILE DROPDOWN
   ======================================== */

/* Responsive visibility - mobile shows in brand, desktop shows in navbar-end */
.navbar-brand .profile-dropdown-container {
  display: flex;
}

.navbar-menu .profile-dropdown-container {
  display: none;
}

@media screen and (min-width: 1024px) {
  .navbar-brand .profile-dropdown-container {
    display: none;
  }

  .navbar-menu .profile-dropdown-container {
    display: flex;
  }

  /* Shift dropdown slightly left so it doesn't touch browser edge */
  .navbar-menu .profile-dropdown-menu {
    right: 0.5rem;
  }
}

.profile-dropdown-container {
  position: relative;
}

/* Prevent navbar hover background on profile dropdown container */
.navbar-item.profile-dropdown-container:is(:hover, :focus, :active),
[data-theme="dark"] .navbar-item.profile-dropdown-container:is(:hover, :focus, :active) {
  background-color: transparent !important;
}

.profile-dropdown-trigger {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s ease;
}

.profile-dropdown-trigger:hover {
  box-shadow: 0 0 0 3px rgba(0, 209, 178, 0.3);
}

.profile-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
}

.profile-avatar .avatar-initials {
  font-size: 0.875rem;
  text-transform: uppercase;
}

.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 240px;
  background-color: #fff;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.profile-dropdown-container.is-active .profile-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

[data-theme="dark"] .profile-dropdown-menu {
  background-color: #2a2a2a;
  border-color: #4a4a4a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}


.profile-dropdown-header {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.profile-dropdown-header strong {
  font-size: 0.9375rem;
  color: #363636;
}

.profile-dropdown-header span {
  font-size: 0.8125rem;
  color: #7a7a7a;
}

[data-theme="dark"] .profile-dropdown-header strong {
  color: #f5f5f5;
}

[data-theme="dark"] .profile-dropdown-header span {
  color: #b5b5b5;
}

.profile-dropdown-menu .dropdown-divider {
  margin: 0;
  background-color: #e0e0e0;
}

[data-theme="dark"] .profile-dropdown-menu .dropdown-divider {
  background-color: #4a4a4a;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.625rem 1rem;
  border: none;
  background: none;
  font-size: 0.9375rem;
  color: #363636;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.profile-dropdown-item:hover {
  background-color: #f5f5f5;
}

[data-theme="dark"] .profile-dropdown-item {
  color: #f5f5f5;
}

[data-theme="dark"] .profile-dropdown-item:hover {
  background-color: #363636;
}

.profile-dropdown-item .icon {
  width: 1.25rem;
  text-align: center;
  color: #7a7a7a;
}

[data-theme="dark"] .profile-dropdown-item .icon {
  color: #b5b5b5;
}

.profile-dropdown-item.is-danger {
  color: #f14668;
}

.profile-dropdown-item.is-danger:hover {
  background-color: #fef5f7;
  color: #cc0f35;
}

[data-theme="dark"] .profile-dropdown-item.is-danger {
  color: #ff5370;
}

[data-theme="dark"] .profile-dropdown-item.is-danger:hover {
  background-color: #2d1a1e;
  color: #ff7a92;
}

.profile-dropdown-item.is-danger .icon {
  color: inherit;
}

/* Theme toggle icon colors in dropdown */
.profile-dropdown-item.profile-theme-toggle .icon .fa-moon {
  color: #8b5cf6;
}

.profile-dropdown-item.profile-theme-toggle .icon .fa-sun {
  color: #fbbf24;
}

/* ========================================
   DARK THEME OVERRIDES
   ======================================== */

[data-theme="dark"] .navbar.is-light {
  background-color: #1f2937;
  border-bottom: 1px solid #374151;
}

/* Navbar items */
[data-theme="dark"] .navbar.is-light .navbar-item {
  color: #f9fafb;
}

/* Make "Networks" text white in dark mode logo */
[data-theme="dark"] .navbar-brand .navbar-item svg .logo-networks {
  fill: #ffffff;
}

/* Prevent background change on navbar items in dark mode - needs !important to override Bulma */
[data-theme="dark"] .navbar.is-light .navbar-item:is(:hover, :not(.navbar-burger)),
[data-theme="dark"] .navbar.is-light .navbar-menu .navbar-item:hover {
  background-color: transparent !important;
}

/* Navbar burger */
[data-theme="dark"] .navbar.is-light .navbar-burger span {
  background-color: #f9fafb;
}

/* Navbar dropdown menu */
[data-theme="dark"] .navbar.is-light .navbar-menu {
  background-color: #1f2937;
}

/* Button styling */
[data-theme="dark"] .navbar.is-light .button.is-light {
  background-color: #374151;
  color: #f9fafb;
  border-color: #4b5563;
}

[data-theme="dark"] .navbar.is-light .button.is-light:hover {
  background-color: #4b5563;
}
