/* ═══════════════════════════════════════════════════════════════
   header.css — Site header, navigation, search box, icon group
   ═══════════════════════════════════════════════════════════════ */

/* ===== Header layout ===== */
.site-header {
  position: fixed;
  top: 0;
  width: 100%;
  height: 80px;
  background: var(--bg-surface);
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
}

.header-center {
  max-width: 1300px;
  margin: auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: bold;
}

.site-logo img {
  height: 40px;
}

.header-nav {
  display: none; /* Hidden on desktop, we use inline pills instead */
  gap: 18px;
}

.header-nav a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-nav a:hover {
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* ── Search ── */
.search-box {
  display: flex;
  align-items: center;
  height: 40px; /* Slightly taller for better alignment */
  width: 350px; /* Significantly lengthier */
  border: 1px solid var(--input-border);
  border-radius: 20px;
  background: var(--input-bg);
  overflow: hidden; /* Clips children to the perfect pill shape */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--shadow-sm);
}

.search-box input {
  flex: 1;
  padding: 0 16px 0 20px;
  font-size: 14px;
  height: 100%;
  min-width: 0;
  border: none !important;
  background: transparent;
  color: var(--input-text);
  outline: none; /* Removes default browser focus ring */
  margin: 0 !important; /* Prevents push from auth.css */
  border-radius: 0 !important; /* Removes inner pill shape */
}

.search-box input::placeholder {
  opacity: 0.6;
}

.search-box button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  width: 48px;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.search-box button:hover {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
}

/* ── Icon group ── */
.icon-group {
  display: flex;
  gap: 20px;
  align-items: center;
}

.icon {
  font-size: 20px;
  cursor: pointer;
}

.icon img {
  width: 35px;
  height: 35px;
  cursor: pointer;
  align-items: center;
}

.icon:hover {
  opacity: 0.7;
}

/* ── Auth area ── */
#authArea {
  display: flex;
  align-items: center;
}

/* ── Desktop/Default overrides for new classes ── */
.search-and-hamburger {
  display: flex;
  align-items: center;
  gap: 15px;
}
.hamburger-btn {
  display: none; /* hidden on desktop */
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-primary);
}
.mobile-overlay {
  display: none; /* hidden on desktop */
}
.mobile-close-btn {
  display: none; /* hidden on desktop */
}
.header-right-panel {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* ── Responsive header ── */
@media (max-width: 768px) {
  .site-header { 
    height: auto; 
    padding: 10px 0 15px 0; 
  }
  .header-center { 
    display: flex;
    flex-wrap: wrap;
    align-items: center; 
    justify-content: space-between;
    gap: 12px; 
  }
  
  .site-logo { 
    flex-shrink: 0;
    order: 1;
    width: 100%;
    justify-content: center;
  }
  .site-logo img { 
    height: 32px; 
  }
  
  /* Icons and Hamburger on row 2 */
  .icon-group {
    order: 2;
    gap: 12px;
    flex-wrap: nowrap;
    margin-left: 10px; /* Pull away from left edge */
  }

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    order: 3;
    margin-right: 10px; /* Pull away from right edge */
  }

  /* Search drops to row 3 and spans full width */
  .search-box { 
    order: 4;
    width: 100%;
    max-width: 100%;
    height: 40px; 
  }
  .search-box input { 
    font-size: 14px; 
  }

  /* Right Panel Mobile Navigation */
  .mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
  }
  .mobile-overlay.open {
    display: block;
  }

  .header-right-panel {
    position: fixed;
    top: 0;
    right: -280px;
    width: 260px;
    height: 100vh;
    background: var(--bg-surface);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 20px;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 1001;
    transition: right 0.3s ease;
    gap: 20px;
  }
  .header-right-panel.open {
    right: 0;
  }

  .header-nav { 
    display: flex;
    flex-direction: column;
    gap: 15px; 
    order: 2;
  }
  .header-nav a { 
    font-size: 16px; 
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
  }
}

@media (max-width: 480px) {
  .site-logo span {
    font-size: 16px;
  }
  .site-logo img {
    height: 28px;
  }
  .search-box {
    height: 36px;
  }
  .search-and-hamburger {
    width: 100%;
    min-width: 100%;
    justify-content: center;
  }
}
