/* /mte/assets/css/header.css
   Apple-inspired header with glassmorphism and smooth interactions
*/

header.appbar {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-family: var(--font-sans);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

header.appbar.scrolled {
  background: rgba(255, 255, 255, 0.95);
  border-bottom-color: var(--border);
}

.appbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  height: 64px;
}

/* Brand Section */
.brand-section {
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text);
  transition: opacity 0.2s ease;
}

.brand:hover { opacity: 0.8; }

.logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 40px;
  border-radius: var(--radius-sm);
  padding: var(--space-2);
}

/* UPDATED: support <img class="logo-img"> used by header.php */
.logo-img,
.logo {
  height: 24px;
  width: auto;
  max-width: 100%;
  display: block;
  /* remove invert so colored logos render correctly */
  filter: none;
}

.brand-name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.brand-subtitle {
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1px;
}

/* Navigation */
.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.nav-link:hover { color: var(--text); background: rgba(0, 0, 0, 0.04); }
.nav-link.active { color: var(--brand-primary); background: rgba(15, 58, 138, 0.08); }

/* Right Side (Profile / Sign-in) */
.profile-section {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* NEW: Sign-in button for anonymous state */
.signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  background: linear-gradient(135deg, #ffffff, #fafafa);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.signin-btn:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
}

.signin-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 58, 138, 0.18);
}

/* Profile Trigger (signed-in) */
.profile-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.profile-trigger:hover { background: rgba(0, 0, 0, 0.04); }

.profile-trigger:focus-visible {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
}

.profile-trigger.active .chevron { transform: rotate(180deg); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: white;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.profile-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.profile-email {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

.chevron {
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* Profile Dropdown */
.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: none;
  z-index: 10000;
  overflow: hidden;
  transform: translateY(-8px) scale(0.95);
  opacity: 0;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-menu.menu-open {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Menu Header */
.menu-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: linear-gradient(135deg, rgba(15, 58, 138, 0.03) 0%, rgba(14, 165, 233, 0.03) 100%);
}

.menu-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: white;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.menu-user-info { flex: 1; }
.menu-user-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.menu-user-email { font-size: 13px; color: var(--muted); }

/* Menu Sections */
.menu-section { padding: var(--space-2); }

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.15s ease;
  position: relative;
}

.menu-item:hover { background: rgba(0, 0, 0, 0.04); color: var(--text); }

.menu-item--danger { color: var(--danger); }
.menu-item--danger:hover { background: rgba(185, 28, 28, 0.08); color: var(--danger); }

.menu-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}
.menu-item--danger .menu-icon { color: var(--danger); }

.menu-separator {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: var(--space-2) 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .appbar-inner { padding: 0 var(--space-4); height: 56px; }
  .main-nav { display: none; }
  .brand-subtitle { display: none; }
  .profile-info { display: none; }
  .profile-menu { width: 260px; right: -var(--space-2); }
}

@media (max-width: 480px) {
  .brand-name { display: none; }
  .profile-menu { width: calc(100vw - 32px); right: -var(--space-4); }
}

/* Vendor overrides */
.select2-container, .flatpickr-calendar { z-index: 1050; }
.select2-dropdown { z-index: 1060; }

/* Make buttons inside the profile menu look like links */
.profile-menu .menu-button {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-3);
  border: 0;
  background: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.15s ease;
}

.profile-menu .menu-button:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

/* Danger variant – mirrors .menu-item--danger */
.profile-menu .menu-button--danger {
  color: var(--danger);
}

.profile-menu .menu-button--danger:hover {
  background: rgba(185, 28, 28, 0.08);
  color: var(--danger);
}

/* Focus ring for keyboard users */
.profile-menu .menu-item:focus-visible,
.profile-menu .menu-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 58, 138, 0.18);
}

/* Keep icons colored in danger */
.profile-menu .menu-button--danger .menu-icon {
  color: var(--danger);
}

