/* ===== HEADER STYLES - Red Theme (Based on test.html layout) ===== */

.header {
  position: relative;
  width: 100%;
  z-index: 9999;
  background: transparent;
}

/* Announcement Bar */
.announcement {
  background-color: #ffffff;
  color: var(--primary-color);
  padding: 4px 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.8rem;
  height: 30px;
  font-weight: 600;
  border-bottom: 1px solid #f0f0f0;
}

.announcement-content {
  display: inline-block;
  animation: scroll-left 40s linear infinite;
}

.announcement-text {
  display: inline-block;
  padding-right: 2rem;
}

@keyframes scroll-left {
  0% { transform: translateX(120vw); }
  2% { transform: translateX(70vw); }
  100% { transform: translateX(-100%); }
}

/* ===== STICKY HEADER WRAPPER ===== */
.header-sticky-wrapper {
  background: rgba(180, 20, 30, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  width: 100%;
  z-index: 9999;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== MAIN HEADER ===== */
.main-header {
  background: transparent;
  padding: 0;
}

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

/* ===== LOGO ===== */
.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-image {
  max-height: 44px;
  width: auto;
  transition: transform 0.2s;
  filter: brightness(0) invert(1);
}

.logo-image:hover {
  transform: scale(1.03);
}

/* ===== SEARCH BAR ===== */
.header-search-container {
  flex: 1;
  max-width: 580px;
  margin: 0 20px;
  display: flex;
  align-items: center;
}

.search-form {
  display: flex;
  width: 100%;
  gap: 0;
  align-items: center;
  border-radius: 50px;
  background: #ffffff;
  border: none;
  padding: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.search-form:focus-within {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.search-input {
  width: 100%;
  padding: 0 20px 0 0;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  height: 44px;
  margin: 0;
  color: #333;
}

.search-input::placeholder {
  color: #dc143c; /* Orange placeholder like reference */
  font-weight: 400;
}

.search-btn {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  height: 44px;
  width: 48px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.search-btn:hover {
  color: #333;
}

/* ===== HEADER ACTIONS (Right Side) ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Action Buttons: Icon + Text column layout (like test.html .nav-btn) */
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  border-radius: 10px;
  background: none;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  transition: all 0.2s;
  position: relative;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}

.action-btn i {
  font-size: 20px;
}

.action-text {
  font-size: 11px;
  font-weight: 700;
}

.action-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

/* "Nạp tiền" button highlighted */
.action-btn[title="Nạp Tiền"] {
  color: #fff;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.action-btn[title="Nạp Tiền"]:hover {
  color: #dc143c;
  background: #fff;
}

/* Badge */
.badge-count {
  position: absolute;
  top: 0;
  right: 6px;
  background-color: #dc143c;
  color: #fff;
  border-radius: 50%;
  width: 17px;
  height: 17px;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(220, 20, 60, 0.4);
}

/* ===== AUTH BUTTONS ===== */
.login-btns {
  display: flex;
  gap: 6px;
  margin-left: 6px;
}

.btn-auth {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  white-space: nowrap;
}

/* Login: Ghost style */
.btn-login {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.75);
}

.btn-login:hover {
  border-color: #fff;
  color: #fff;
}

/* Register: Gold/Yellow accent */
.btn-register {
  background: linear-gradient(135deg, #dc143c, #a10f2c);
  color: #fff;
  box-shadow: 0 2px 12px rgba(220, 20, 60, 0.2);
}

.btn-register:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(220, 20, 60, 0.3);
  color: #fff;
}

/* ===== USER PROFILE WIDGET ===== */
.user-widget {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.3rem 0.9rem 0.3rem 0.3rem;
  border-radius: 2rem;
  text-decoration: none;
  color: #fff;
  transition: all 0.2s;
  margin-left: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.user-widget:hover {
  background-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
}

.user-balance {
  font-size: 0.8rem;
  color: #dc143c;
  font-weight: 700;
}

/* ===== SECONDARY NAV ===== */
.secondary-nav {
  background-color: #fff;
  border-bottom: 1px solid #e5e5e5;
  padding: 0;
  position: relative;
  z-index: 40;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  height: 50px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.nav-item-link {
  height: 100%;
  display: flex;
  align-items: center;
  color: #444;
  font-weight: 600;
  text-decoration: none;
  font-size: 16px;
  gap: 0.3rem;
  transition: color 0.2s;
  cursor: pointer;
}

.nav-item-link:hover {
  color: var(--primary-color);
}

/* Hide main icons except arrow */
.nav-item-link>i:not(.fa-chevron-down) {
  display: none;
}

.nav-item-link .fa-chevron-down {
  font-size: 0.75em;
  color: #888;
  margin-left: 2px;
}

.nav-item-link:hover .fa-chevron-down {
  color: var(--primary-color);
}

/* ===== MEGA MENU ===== */
.has-dropdown {
  position: relative;
}

.mega-menu {
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 99;
  background-color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid #eee;
  border-top: 3px solid var(--primary-color);
  min-width: 220px;
  border-radius: 0 0 6px 6px;
  transition: all 0.3s ease;
  pointer-events: none;
}

.has-dropdown::after {
  content: '';
  position: absolute;
  top: 80%;
  left: 0;
  width: 100%;
  height: 30px;
  background: transparent;
  z-index: 98;
}

.has-dropdown:hover .mega-menu,
.has-dropdown.show .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.mega-menu-content {
  padding: 10px;
}

.mega-menu-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mega-menu-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: #333;
  text-decoration: none;
  font-size: 15px;
  border-radius: 4px;
  transition: background 0.2s;
  white-space: nowrap;
}

.mega-menu-item:hover {
  background-color: #f5f5f5;
  color: var(--primary-color);
}

/* ===== USER DROPDOWN ===== */
.dropdown-menu {
  display: flex !important;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  position: absolute;
  z-index: 100;
  background: #fff;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid #f0f0f0;
  min-width: 200px;
  padding: 8px 0;
  transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
  pointer-events: none;
}

.user-dropdown-wrapper::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 0;
  width: 100%;
  height: 20px;
  background: transparent;
}

.user-dropdown-wrapper:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  padding: 8px 15px;
  color: #333;
  text-decoration: none;
  font-size: 15px;
  display: flex;
  align-items: center;
}

.dropdown-item:hover {
  background-color: #f5f5f5;
  color: #000;
}

.dropdown-divider {
  border-top: 1px solid #eee;
  margin: 5px 0;
}

/* ===== MOBILE RESPONSIVE ===== */
.mobile-search-toggle,
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #fff;
}

@media (max-width: 991px) {
  .nav-menu {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .header-content {
    gap: 8px;
    height: 52px;
  }

  .header-actions {
    gap: 2px;
  }

  .action-btn {
    padding: 4px 8px;
    border-radius: 8px;
  }

  .action-btn i {
    font-size: 16px;
  }

  .action-text {
    font-size: 9px;
  }

  /* Hide user widget on tablet/mobile */
  .user-widget {
    display: none !important;
  }

  /* Hide orders and deposit on tablet */
  .action-btn[title="Đơn Hàng"],
  .action-btn[title="Nạp Tiền"] {
    display: none !important;
  }

  .logo-image {
    max-height: 32px;
  }

  .main-header {
    padding: 0;
  }

  /* Search bar on mobile */
  .header-search-container {
    display: block;
    flex: 1;
    margin: 0 4px;
    max-width: none;
  }

  .search-input {
    padding: 0 10px;
    height: 32px;
    font-size: 12px;
  }

  .search-btn {
    padding: 0 10px;
    height: 32px;
    font-size: 12px;
  }

  .search-form {
    border-radius: 8px;
  }

  /* Hide login buttons on mobile */
  .desktop-only {
    display: none !important;
  }
}

/* Mobile logo swap */
.logo-mobi {
  display: none !important;
}

.logo-image {
  display: block !important;
}

@media (max-width: 700px) {
  .logo-image {
    display: none !important;
  }

  .logo-mobi {
    display: block !important;
    width: auto;
    max-width: 90px;
    height: 22px;
    object-fit: contain;
    margin: 0;
    filter: brightness(0) invert(1);
  }
}

/* TAPHOAMMO.CV Branding */
@media (max-width: 700px) {
  body.is-taphoammo .logo-image {
    display: block !important;
    max-height: 32px;
  }
  body.is-taphoammo .logo-mobi {
    display: none !important;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .header-content {
    height: 46px;
    gap: 4px;
  }

  .header-actions {
    gap: 0;
  }

  .action-btn {
    padding: 3px 5px;
  }

  .action-btn i {
    font-size: 14px;
  }

  .action-text {
    font-size: 8px;
  }

  .logo-mobi {
    max-width: 80px;
    height: 20px;
  }

  .badge-count {
    width: 14px;
    height: 14px;
    font-size: 0.55rem;
    top: -2px;
    right: 2px;
  }

  .action-btn[title="Đơn Hàng"],
  .action-btn[title="Nạp Tiền"] {
    display: none;
  }

  .announcement {
    font-size: 0.7rem;
    height: 22px;
    padding: 2px 0;
  }

  .search-input {
    padding: 0 8px;
    height: 30px;
    font-size: 11px;
  }

  .search-btn {
    padding: 0 8px;
    height: 30px;
  }
}

/* Landscape phones */
@media (max-width: 767px) and (orientation: landscape) {
  .announcement {
    display: none;
  }
}

/* ===== MOBILE MENU OVERLAY ===== */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
}

.overlay.active {
  display: block;
}

/* ===== MOBILE MENU SIDEBAR ===== */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -85%;
  width: 85%;
  max-width: 320px;
  height: 100vh;
  background: #fff;
  z-index: 9999;
  transition: right 0.3s ease;
  overflow-y: auto;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

.mobile-menu.active {
  right: 0;
}

.mobile-menu-header {
  background: #fff;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.mobile-menu-title {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
}

.mobile-menu-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

/* Nav Items */
.mobile-menu-nav {
  padding: 0;
  flex: 1;
  overflow-y: auto;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid #e8e8e8;
  font-size: 16px;
}

.mobile-nav-item:hover {
  background: #f5f5f5;
}

.mobile-nav-item i {
  color: #999;
  font-size: 0.7rem;
}

/* Contact Footer */
.mobile-menu-contact {
  padding: 20px;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
  background: #fff;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  color: #333;
  text-decoration: none;
  font-size: 0.9rem;
}

.contact-item i {
  width: 20px;
  color: var(--primary-color);
  text-align: center;
}

/* Seller Red Button */
.btn-seller-red {
  color: #fff !important;
  background-color: #d9534f;
  padding: 5px 15px !important;
  border-radius: 4px;
  transition: background-color 0.2s !important;
  margin-left: 10px;
}

.btn-seller-red:hover {
  background-color: #c9302c !important;
  color: #fff !important;
}