/* 
 * New Header Styles for Zeta Calculator
 * Created: July 8, 2025
 */

/* Main header styles */
.page-header {
  background-color: var(--card-color);
  padding: 0;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  height: 70px;
  display: flex;
  align-items: center;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  position: relative;
}

/* Logo styles */
.logo-link {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 8px 0;
}

.logo-img {
  height: 54px; /* Increased from 40px */
  width: auto; /* Maintain aspect ratio */
  max-width: 100%; /* Ensure it doesn't overflow */
  transition: transform 0.3s ease;
}

.logo-link:hover .logo-img {
  transform: scale(1.05);
}

/* Desktop navigation */
.desktop-nav {
  display: flex;
  gap: 2rem;
  margin-left: auto;
  height: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  color: var(--text-light);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0 0.75rem;
  height: 100%;
  position: relative;
  transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary-color);
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 3px;
  bottom: 0;
  left: 0;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-link:hover::after, .nav-link.active::after {
  width: 100%;
}

/* Desktop search */
.desktop-search {
  margin-left: 2rem;
}

.search-input {
  width: 250px;
  height: 42px;
  border-radius: 21px;
  padding: 0 45px 0 45px;
  border: 2px solid var(--border-color);
  background-color: var(--background-color);
  color: var(--text-color);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.search-input:focus {
  width: 300px;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Mobile controls */
.mobile-controls {
  display: none;
  gap: 0.5rem;
  align-items: center;
}

.mobile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: transparent;
  border: none;
  color: var(--text-color);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.mobile-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Hamburger button */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 40px;
  width: 40px;
  padding: 12px 8px;
  box-sizing: border-box;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-color);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  background-color: var(--card-color);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  z-index: 99;
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  opacity: 0;
  pointer-events: none; /* Disable pointer events when hidden */
}

.mobile-menu.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto; /* Enable pointer events when visible */
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.mobile-nav-link {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--text-color);
  font-weight: 500;
  font-size: 1.1rem;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
}

.mobile-nav-link:hover, .mobile-nav-link.active {
  background-color: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-color);
  border-left-color: var(--primary-color);
}

/* Mobile search */
.mobile-search {
  display: none;
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  padding: 1rem;
  background-color: var(--card-color);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  z-index: 99;
  transform: translateY(-100%);
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  pointer-events: none; /* Disable pointer events when hidden */
}

.mobile-search.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto; /* Enable pointer events when visible */
}

.mobile-search-input-wrapper {
  position: relative;
  width: 100%;
}

.mobile-search-input-wrapper .search-icon {
  color: #f59e0b; /* Orange color for the search icon */
}

.mobile-search-input {
  width: 100%;
  height: 48px;
  border-radius: 24px;
  padding: 0 45px 0 45px;
  border: 2px solid #f59e0b; /* Orange border */
  background-color: #ffffff;
  color: var(--text-color);
  font-size: 1rem;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15);
}

.mobile-search-input:focus {
  border-color: #f59e0b; /* Keep orange color on focus */
  box-shadow: 0 2px 15px rgba(245, 158, 11, 0.25);
}

.mobile-clear-search {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #f59e0b; /* Orange color for the clear button */
  font-size: 1rem;
  cursor: pointer;
  display: none;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.mobile-clear-search.visible {
  display: block;
}

.mobile-clear-search:hover {
  opacity: 1;
}

/* Mobile search results */
.mobile-search-results {
  background-color: #ffffff;
  border-radius: 12px;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  border: 1px solid #f0f0f0;
}

.mobile-search.active .mobile-search-results:not(:empty) {
  max-height: 400px;
  overflow-y: auto;
}

/* Mobile search result items */
.mobile-search-results .search-result-item {
  display: block;
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s ease;
}

.mobile-search-results .search-result-item:last-child {
  border-bottom: none;
}

.mobile-search-results .search-result-item:hover,
.mobile-search-results .search-result-item:focus {
  background-color: #fff8f0;
}

.mobile-search-results .search-result-name {
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
}

.mobile-search-results .search-result-description {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 6px;
}

.mobile-search-results .search-result-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mobile-search-results .search-result-category-tag {
  font-size: 0.75rem;
  background-color: #ffecd7;
  color: #f59e0b;
  padding: 2px 8px;
  border-radius: 12px;
}

.mobile-search-results .see-all-results {
  display: block;
  text-align: center;
  padding: 12px;
  font-weight: 500;
  color: #f59e0b;
  text-decoration: none;
  border-top: 1px solid #f0f0f0;
}

.mobile-search-results .no-results {
  padding: 20px;
  text-align: center;
  color: #666;
}

.mobile-search-results mark {
  background-color: rgba(245, 158, 11, 0.2);
  color: #d97706;
  padding: 0 2px;
  border-radius: 2px;
}

.mobile-search-results .search-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  color: #666;
}

.mobile-search-results .clear-history-btn {
  background: none;
  border: none;
  color: #f59e0b;
  font-size: 0.875rem;
  cursor: pointer;
}

.mobile-search-results .search-history-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  text-decoration: none;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
}

.mobile-search-results .search-history-icon {
  color: #f59e0b;
  margin-right: 10px;
  font-size: 0.875rem;
}

/* Active state for hamburger menu button */
.hamburger-btn.active .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Dark mode adjustments */
.dark-mode .mobile-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.dark-mode .mobile-menu,
.dark-mode .mobile-search {
  background-color: var(--card-color);
  border-color: var(--border-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.dark-mode .mobile-search-input {
  background-color: #1e293b;
  color: #f8fafc;
  border-color: #f59e0b;
}

.dark-mode .mobile-search-results {
  background-color: #1e293b;
  border-color: #334155;
}

.dark-mode .mobile-search-results .search-result-item {
  border-color: #334155;
  color: #f8fafc;
}

.dark-mode .mobile-search-results .search-result-item:hover,
.dark-mode .mobile-search-results .search-result-item:focus {
  background-color: rgba(245, 158, 11, 0.1);
}

.dark-mode .mobile-search-results .search-result-name {
  color: #f8fafc;
}

.dark-mode .mobile-search-results .search-result-description {
  color: #cbd5e1;
}

.dark-mode .mobile-search-results .search-history-header {
  border-color: #334155;
  color: #cbd5e1;
}

.dark-mode .mobile-search-results .search-history-item {
  border-color: #334155;
  color: #f8fafc;
}

.dark-mode .mobile-search-results .see-all-results {
  border-color: #334155;
}

.dark-mode .mobile-nav-link:hover,
.dark-mode .mobile-nav-link.active {
  background-color: rgba(var(--primary-rgb), 0.15);
}

/* Responsive styles */
@media screen and (max-width: 992px) {
  .desktop-search {
    margin-left: 1rem;
  }
  
  .search-input {
    width: 200px;
  }
  
  .search-input:focus {
    width: 240px;
  }
  
  .desktop-nav {
    gap: 1rem;
  }
}

@media screen and (max-width: 768px) {
  .desktop-nav,
  .desktop-search {
    display: none;
  }
  
  .mobile-controls {
    display: flex;
  }
  
  .mobile-menu,
  .mobile-search {
    display: block;
  }
  
  .page-header {
    height: 60px;
    z-index: 100; /* Ensure header is above other elements */
  }
  
  .logo-img {
    height: 48px; /* Increased from 36px */
  }
  
  .mobile-menu {
    top: 60px;
    z-index: 99; /* Below header but above content */
  }
  
  .mobile-search {
    top: 60px;
    z-index: 99; /* Below header but above content */
  }
}

@media screen and (max-width: 480px) {
  .page-header {
    height: 56px;
  }
  
  .logo-img {
    height: 42px; /* Increased from 32px */
  }
  
  .mobile-menu {
    top: 56px;
    z-index: 99;
  }
  
  .mobile-search {
    top: 56px;
    z-index: 99;
  }
  
  .mobile-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  .hamburger-btn {
    height: 36px;
    width: 36px;
    padding: 10px 7px;
  }
}
