/**
 * Custom Header Component - GPCC
 * Modern, flexible header with sticky behavior
 */

/* === HEADER CONTAINER === */
.gpcc-custom-header {
  background: var(--header-bg, #0B1220);
  border-bottom: 1px solid var(--border, rgba(148, 163, 184, 0.12));
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gpcc-custom-header__container {
  max-width: var(--container, 1200px);
  margin: 0 auto;
  padding: 0 var(--gap, 1rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  gap: var(--gap, 1rem);
}

/* Scrolled state - more compact */
.gpcc-custom-header.is-scrolled {
  background: rgba(11, 18, 32, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.gpcc-custom-header.is-scrolled .gpcc-custom-header__container {
  min-height: 60px;
}

/* === BRANDING === */
.gpcc-custom-header__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 1001;
}

.gpcc-custom-header__brand .custom-logo-link {
  display: flex;
  align-items: center;
  line-height: 0;
}

.gpcc-custom-header__brand .custom-logo {
  max-height: 40px;
  width: auto;
  transition: transform 0.3s ease;
}

.gpcc-custom-header__brand .custom-logo:hover {
  transform: scale(1.05);
}

.gpcc-custom-header__site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text, #F1F5F9);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

.gpcc-custom-header__site-title:hover {
  color: var(--primary, #3B82F6);
}

/* === NAVIGATION === */
.gpcc-custom-header__nav {
  display: flex;
  align-items: center;
  flex-grow: 1;
  justify-content: center;
}

.gpcc-custom-header__menu {
  display: none;
}

.gpcc-custom-header__list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.gpcc-custom-header__list > li {
  position: relative;
}

.gpcc-custom-header__list > li > a {
  display: flex;
  align-items: center;
  padding: 0.625rem 1rem;
  color: var(--text, #F1F5F9);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  position: relative;
}

.gpcc-custom-header__list > li > a:hover,
.gpcc-custom-header__list > li > a:focus-visible {
  color: var(--primary, #3B82F6);
  background: rgba(59, 130, 246, 0.1);
}

.gpcc-custom-header__list > li.current-menu-item > a,
.gpcc-custom-header__list > li.current-menu-ancestor > a {
  color: var(--primary, #3B82F6);
}

.gpcc-custom-header__list > li.current-menu-item > a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary, #3B82F6);
  border-radius: 2px;
}

/* Dropdown Menu */
.gpcc-custom-header__list .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--surface-1, #111A33);
  border: 1px solid var(--border, rgba(148, 163, 184, 0.12));
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.gpcc-custom-header__list > li:hover > .sub-menu,
.gpcc-custom-header__list > li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.gpcc-custom-header__list .sub-menu li a {
  display: block;
  padding: 0.625rem 1rem;
  color: var(--text, #F1F5F9);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.gpcc-custom-header__list .sub-menu li a:hover {
  color: var(--primary, #3B82F6);
  background: rgba(59, 130, 246, 0.1);
  padding-left: 1.25rem;
}

/* === MOBILE TOGGLE === */
.gpcc-custom-header__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border, rgba(148, 163, 184, 0.12));
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1001;
}

.gpcc-custom-header__toggle:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--primary, #3B82F6);
}

.gpcc-custom-header__toggle-bar {
  width: 20px;
  height: 2px;
  background: var(--text, #F1F5F9);
  border-radius: 1px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.gpcc-custom-header__toggle[aria-expanded="true"] .gpcc-custom-header__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.gpcc-custom-header__toggle[aria-expanded="true"] .gpcc-custom-header__toggle-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.gpcc-custom-header__toggle[aria-expanded="true"] .gpcc-custom-header__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* === HEADER ACTIONS === */
.gpcc-custom-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.gpcc-custom-header__search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gpcc-custom-header__search-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15);
}

.gpcc-custom-header__cta {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: white;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.gpcc-custom-header__cta:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: white;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.3);
}

/* === SEARCH OVERLAY === */
.gpcc-custom-header__search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9999;
}

.gpcc-custom-header__search-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.gpcc-custom-header__search-container {
  position: relative;
  width: 90%;
  max-width: 600px;
  padding: 2rem;
}

.gpcc-custom-header__search-form {
  display: flex;
  gap: 0.75rem;
}

.gpcc-custom-header__search-input {
  flex: 1;
  padding: 1rem 1.5rem;
  background: var(--surface-1, #111A33);
  border: 2px solid var(--border, rgba(148, 163, 184, 0.12));
  border-radius: 0.75rem;
  color: var(--text, #F1F5F9);
  font-size: 1.125rem;
  transition: all 0.2s ease;
}

.gpcc-custom-header__search-input:focus {
  outline: none;
  border-color: var(--primary, #3B82F6);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.gpcc-custom-header__search-submit {
  padding: 1rem 2rem;
  background: var(--primary, #3B82F6);
  border: none;
  border-radius: 0.75rem;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gpcc-custom-header__search-submit:hover {
  background: var(--primary-hover, #2563EB);
  transform: scale(1.05);
}

.gpcc-custom-header__search-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gpcc-custom-header__search-close:hover {
  transform: rotate(90deg);
  color: var(--primary, #3B82F6);
}

/* === RESPONSIVE === */

/* Desktop */
@media (min-width: 1024px) {
  .gpcc-custom-header__menu {
    display: block;
  }
  
  /* Ẩn nút menu toggle trên desktop */
  .gpcc-custom-header__toggle {
    display: none !important;
  }
}

/* Tablet & Mobile */
@media (max-width: 1023px) {
  .gpcc-custom-header__toggle {
    display: flex;
  }

  .gpcc-custom-header__cta {
    display: none;
  }
  
  /* Giảm gap giữa các nút trên tablet/mobile */
  .gpcc-custom-header__actions {
    gap: 0.5rem;
  }

  /* Mobile Menu Overlay */
  .gpcc-custom-header__menu {
    position: fixed;
    inset: 0;
    background: rgba(11, 18, 32, 0.98);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
  }

  .gpcc-custom-header__menu.is-active {
    opacity: 1;
    visibility: visible;
  }

  .gpcc-custom-header__list {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
  }

  .gpcc-custom-header__list > li {
    width: 100%;
  }

  .gpcc-custom-header__list > li > a {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    justify-content: center;
    text-align: center;
  }

  .gpcc-custom-header__list > li.current-menu-item > a::after {
    display: none;
  }

  .gpcc-custom-header__list .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    margin-top: 0.5rem;
  }

  .gpcc-custom-header__list .sub-menu li a {
    font-size: 1rem;
    text-align: center;
  }
}

/* Mobile Only */
@media (max-width: 767px) {
  .gpcc-custom-header__container {
    min-height: 60px;
    padding: 0 1rem;
  }

  .gpcc-custom-header__brand .custom-logo {
    max-height: 32px;
  }
  
  /* Giảm gap giữa 2 nút search + menu trên mobile */
  .gpcc-custom-header__actions {
    gap: 0.5rem;
  }

  .gpcc-custom-header__search-toggle {
    width: 40px;
    height: 40px;
  }

  .gpcc-custom-header__toggle {
    width: 40px;
    height: 40px;
  }
}

