/* ===== GELATO Site Header (desktop + shared) ===== */

.main-header {
  background: var(--gradient-hero);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky, 1020);
}

.main-header .container {
  position: relative;
}

.header-content {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) 0;
}

.header-bar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 48px;
  height: 48px;
  gap: var(--space-2);
}

.logo {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  align-self: center;
  height: 100%;
}

.logo a {
  text-decoration: none;
  color: var(--text-white);
  display: flex;
  align-items: center;
  height: 100%;
  line-height: 0;
}

.logo img {
  height: clamp(36px, 10vw, 52px);
  width: auto;
  display: block;
}

.logo h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin: 0;
  color: var(--text-white);
}

.logo span {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.main-nav a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  font-weight: 500;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--text-white) !important;
  background: rgba(255, 255, 255, 0.15);
}

.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.lang-switcher .lang-btn {
  padding: 4px 10px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.lang-switcher .lang-sep {
  color: rgba(255, 255, 255, 0.5);
}

.lang-switcher .lang-btn.active {
  background: rgba(255, 255, 255, 0.25);
  color: var(--text-white);
}

.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-white);
}

.user-menu:hover,
.user-menu.is-open {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: var(--shadow-sm);
}

.user-menu span {
  color: var(--text-white);
}

.user-menu .user-avatar-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.user-menu .user-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-light);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-2);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
  z-index: var(--z-dropdown, 1000);
}

.user-menu:hover .dropdown-menu,
.user-menu.is-open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--gelato-red, #ef4444);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  font-size: var(--text-sm);
  font-weight: 500;
}

.dropdown-menu a:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--gelato-red, #ef4444);
}

.main-header .auth-buttons {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.main-header .btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
}

.main-header .btn-primary {
  background: var(--gradient-primary);
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
}

.main-header .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.main-header .btn-outline {
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.main-header .btn-outline:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-white);
  border-color: rgba(255, 255, 255, 0.8);
}

.mobile-menu-toggle {
  display: none;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin-left: auto;
  order: 2;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: #fff;
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-toggle .burger-line {
  display: block;
  width: 22px;
  height: 2px;
  margin: 3px 0;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-menu-toggle .mobile-menu-icon {
  display: none;
}

.mobile-menu-toggle[aria-expanded="true"] .burger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .burger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .burger-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
}

.mobile-menu-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.25);
}

/* Desktop: nav in one row with logo */
@media (min-width: 769px) {
  .header-content {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) 0;
  }

  .header-bar {
    width: auto;
    flex: 0 0 auto;
    min-height: auto;
  }

  .main-nav {
    flex: 1;
    justify-content: flex-end;
  }

  .mobile-menu-toggle {
    display: none !important;
  }

  .main-nav .main-nav-primary {
    display: contents;
  }

  .main-nav .nav-admin-panel-link {
    display: none !important;
  }

  .main-nav .nav-admin-mobile-menu {
    display: none !important;
  }
}
