/* header */
.cps-top-info {
  background: var(--blue-primary);
  color: #ffffff;
  font-size: 12px;
  padding-top: 8px;
}

.cps-top-info a {
  color: #ffffff;
  margin-left: 15px;
  text-decoration: none;
}

.cps-top-info a:hover {
  color: var(--gold-primary);
}

.cps-header {
  background: linear-gradient(to bottom,
      var(--blue-primary),
      var(--primary-dark-color));
  padding: 0 0;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
}

.cps-header-container {
  position: relative;
  height: 74px;
  max-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cps-header-left,
.cps-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

/* Prominent Circular 3D PC Builder Orb centered in header */
@keyframes pgOrbSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pgOrbPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(14, 165, 233, 0.45), 0 0 0 0 rgba(56, 189, 248, 0.45); }
  50% { box-shadow: 0 10px 30px rgba(37, 99, 235, 0.65), 0 0 0 8px rgba(56, 189, 248, 0); }
}

.pg-build3d-orb {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -44%);
  z-index: 40;
  width: 66px;
  height: 66px;
  border-radius: 9999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #ffffff;
  background: radial-gradient(circle at 30% 25%, #1e293b 0%, #0b132b 65%, #020617 100%);
  border: 2.5px solid rgba(255, 255, 255, 0.92);
  animation: pgOrbPulse 2.8s ease-in-out infinite;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
  isolation: isolate;
}

.pg-build3d-orb::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 9999px;
  background: conic-gradient(from 0deg, #38bdf8, #2563eb, #a855f7, #ec4899, #38bdf8);
  z-index: -2;
  animation: pgOrbSpin 4.5s linear infinite;
  opacity: 0.92;
}

.pg-build3d-orb::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 9999px;
  background: radial-gradient(circle at 32% 24%, #1e3a8a 0%, #0b132b 58%, #020617 100%);
  z-index: -1;
}

.pg-build3d-orb:hover {
  transform: translate(-50%, -48%) scale(1.08);
  filter: brightness(1.1);
}

.pg-build3d-orb .material-symbols-outlined {
  font-size: 24px;
  line-height: 1;
  color: #38bdf8;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.85));
}

.pg-build3d-orb-label {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f8fafc;
  margin-top: 2px;
  line-height: 1;
}

.pg-build3d-orb-tip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #0f172a;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 10px 25px rgba(2, 6, 23, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.2s ease;
}

.pg-build3d-orb:hover .pg-build3d-orb-tip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.cps-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
  flex-shrink: 0;
  width: 132px;
  overflow: hidden;
}

.logo-img {
  height: auto;
  width: auto;
  object-fit: contain;
  display: block;
}


.header-items {
  max-height: 40px;
}

.cps-header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  padding: 8px 10px;
  border-radius: 5px;
  color: #fff;
  font-size: 13px;
  transition: all 0.2s;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  white-space: nowrap;
}

.cps-header-btn:hover {
  background: rgba(0, 0, 0, 0.15);
}

.catalog-btn {
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 15px;
  position: relative;
}

.catalog-btn:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* catalog dropdown menu */
.catalog-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 250px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(#fff);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 1000;
  padding: 10px 0;
}

.catalog-btn:hover .catalog-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.catalog-dropdown ul {
  position: relative;
}

.catalog-dropdown ul li {
  position: relative;
}

.catalog-dropdown ul li a {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 400;
  justify-content: space-between;
}

.catalog-dropdown ul li a .cat-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.catalog-dropdown ul li a:hover {
  background: var(--bg-secondary);
  color: var(--gold-primary);
}

.catalog-dropdown ul li a i {
  width: 20px;
  text-align: center;
  color: var(--text-muted);
}

.catalog-dropdown ul li a:hover i {
  color: var(--gold-primary);
}

/* sub-menu (megamenu style) */
.sub-menu {
  position: absolute;
  top: 0;
  left: 100%;
  width: 500px;
  min-height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: all 0.2s ease;
  z-index: 1001;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-content: flex-start;
}

.sub-menu::before {
  content: "";
  position: absolute;
  top: 0;
  left: -2px;
  width: 2px;
  height: 100%;
}

.catalog-dropdown ul li:hover .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.sub-menu-col h4 {
  font-size: 14px;
  color: var(--black-primary);
  margin-bottom: 15px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-color);
}

.sub-menu-col ul {
  display: flex;
  flex-direction: column;
}

.sub-menu-col ul li a {
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-main);
  background: transparent !important;
}

.sub-menu-col ul li a:hover {
  color: var(--gold-primary);
  padding-left: 5px;
  transition: 0.2s;
}

.sub-menu-col ul li a i {
  display: none;
}

.cps-header-btn i {
  font-size: 24px;
}

.cps-header-btn span {
  display: flex;
  flex-direction: column;
}

/* Compact Search Icon + Floating Popover */
.cps-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
}

.cps-search-toggle {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.34) !important;
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cps-search-toggle:hover,
.cps-search.open .cps-search-toggle {
  background: #ffffff !important;
  color: #1544b7 !important;
  border-color: #ffffff !important;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
}

.cps-search-popover {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 250;
}

.cps-search.open .cps-search-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.cps-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.cps-search input {
  width: 100%;
  padding: 10px 42px 10px 14px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  font-size: 13.5px;
  color: #0f172a;
  outline: none;
  box-shadow: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cps-search input:focus {
  border-color: #2a83e9;
  background: #ffffff;
}

.cps-search-submit {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #1544b7 !important;
  color: #ffffff !important;
  font-size: 14px;
  border: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.cps-search-submit:hover {
  background: #2a83e9 !important;
}

.cps-search-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.cps-search-chip {
  font-size: 11px;
  font-weight: 700;
  color: #334155 !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cps-search-chip:hover {
  background: #eff6ff !important;
  border-color: #2563eb !important;
  color: #1544b7 !important;
}

.cart-btn {
  position: relative;
  margin-left: 0;
  margin-right: 0;
  padding-right: 0;
}

.cps-cart-badge {
  position: absolute;
  top: 0;
  left: 27px;
  background: #ff9800;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cps-header-login {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  line-height: 1.3;
  white-space: nowrap;
}

.cps-header-login:hover {
  background: rgba(0, 0, 0, 0.15);
}

.login-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

/* container tổng */
.user-menu {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

/* cụm avatar và mũi tên */
.user-avatar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 30px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.user-avatar-wrapper:hover {
  background-color: #f5f5f5;
  border-color: #ddd;
}

.arrow-icon {
  font-size: 10px;
  color: #666;
  transition: transform 0.3s ease;
}

/* menu dropdown */

.user-dropdown-menu.active {
  display: block;
}

/* item trong menu */
.user-dropdown-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  text-decoration: none;
  color: #333;
  font-size: 14px;
  transition: background 0.2s;
}

.user-dropdown-menu li a i {
  color: #007bff;
  /* màu icon đồng bộ với polygear */
  font-size: 16px;
}

.user-dropdown-menu li a:hover {
  background-color: #f8f9fa;
  color: #007bff;
}

/* đường kẻ phân cách */
.divider {
  height: 1px;
  background-color: #eee;
  margin: 5px 0;
}

.logout-link:hover {
  color: #ff4d4f !important;
  /* đăng xuất thì hiện màu đỏ cảnh báo */
}

/* animation mượt mà */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-dropdown {
  position: relative;
  display: inline-block;
  margin-left: -16px;
}

/* avatar hiển thị với đường kính 40px */
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  /* bo tròn thành hình tròn */
  cursor: pointer;
  background-color: #f1f5f9;
  object-fit: cover;
  transition: border-color 0.2s;
}

/* hiệu ứng viền khi hover vào avatar */
.user-dropdown:hover .user-avatar {
  border-color: #2a83e9;
}

/* khối sub-menu (ẩn đi theo mặc định) */
.user-dropdown-menu {
  position: absolute;
  top: 100%;
  margin-top: 10px;
  background-color: #ffffff;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  min-width: 220px;

  /* hiệu ứng ẩn/hiện mượt mà */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  padding: 8px 0;
}

/* tạo khoảng không vô hình để cầu nối chuột khi hover không bị đứt đoạn */
.user-dropdown-menu::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  height: 15px;
}

/* mũi tên trỏ lên (tooltip arrow) hướng về avatar */
.user-dropdown-menu::after {
  content: "";
  position: absolute;
  top: -6px;
  right: 194px;
  width: 10px;
  height: 10px;
  background-color: #ffffff;
  border-left: 1px solid #e2e8f0;
  border-top: 1px solid #e2e8f0;
  transform: rotate(45deg);
}

/* hiển thị sub-menu khi hover vào container */
.user-dropdown:hover .user-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* khối header chứa tên người dùng */
.user-dropdown-header {
  padding: 8px 16px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

.user-role {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  margin-top: 2px;
}

/* từng item lựa chọn trong menu */
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: #334155;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition:
    background-color 0.15s,
    color 0.15s;
}

.user-dropdown-item:hover {
  background-color: #f8fafc;
  color: #2a83e9;
}

.user-dropdown-icon {
  font-size: 20px;
  color: #94a3b8;
  transition: color 0.15s;
}

.user-dropdown-item:hover .user-dropdown-icon {
  color: #2a83e9;
}

/* đường gạch phân cách */
.user-dropdown-divider {
  height: 1px;
  background-color: #f1f5f9;
  margin: 4px 0;
}

/* nút logout màu đỏ đặc biệt */
.logout-item {
  color: #ef4444;
}

.logout-item:hover {
  background-color: #fef2f2;
  color: #dc2626;
}

.logout-item .user-dropdown-icon {
  color: #ef4444;
}

.logout-item:hover .user-dropdown-icon {
  color: #dc2626;
}

.mobile-menu-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 5px;
}

.mobile-menu-btn .material-symbols-outlined {
  font-size: 28px;
}


.mobile-menu-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

@media (min-width: 1024px) {
  .mobile-menu-btn {
    display: none !important;
  }
}

/* media queries */

@media (max-width: 1024px) {
  .cps-header-container {
    gap: 12px;
  }

  .cps-top-info {
    display: none;
  }
}

@media (max-width: 768px) {
  .cps-header-container {
    height: 64px;
    padding: 8px 15px;
    gap: 10px;
  }

  .cps-logo {
    min-width: 96px;
    max-width: 116px;
  }

  .pg-build3d-orb {
    width: 54px;
    height: 54px;
  }

  .pg-build3d-orb .material-symbols-outlined {
    font-size: 20px;
  }

  .pg-build3d-orb-label {
    font-size: 8px;
  }

  .cps-search {
    display: none;
    /* search available inside mobile menu */
  }

  .cart-btn {
    margin-right: 0;
    margin-left: 0;
  }

  .user-dropdown {
    display: none;
  }

  .cps-header-login {
    display: none;
  }
}

/* sidebar states */
#mobile-sidebar {
  display: none;
}

#mobile-sidebar.active {
  display: block;
  visibility: visible;
  opacity: 1;
}

#mobile-sidebar.active #mobile-sidebar-content {
  transform: translateX(0);
}

@media (max-width: 768px) {
  .cps-header-container {
    padding: 10px 15px;
    justify-content: space-between;
    gap: 10px;
  }

  .logo-img {
    max-height: 40px;
  }
}