* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  background: #f5f5f5;
}

header {
  width: 100%;
  background: #000;
  color: #fff;
}

.top-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo {
  font-size: 26px;
  font-weight: 800;
  color: #FFD700;
  line-height: 1;
}

.logo span {
  display: block;
  font-size: 13px;
  color: #fff;
  margin-top: 4px;
}

.search-box {
  flex: 1;
  max-width: 500px;
  display: flex;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: 14px;
}

.search-box button {
  width: 45px;
  border: none;
  background: #FFD700;
  cursor: pointer;
  transition: 0.2s;
}

.search-box button:hover {
  background: #e6c200;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

#guestActions,
#loggedInActions {
  display: flex;
  align-items: center;
}

.user-dropdown {
  position: relative;
}

.user-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
}

.user-toggle i {
  font-size: 20px;
  margin-right: 0;
}

.logged-toggle {
  padding: 8px 12px;
  border-radius: 999px;
  transition: 0.2s ease;
}

.logged-toggle:hover,
.user-toggle:hover {
  color: #ffd700;
  background: rgba(255, 255, 255, 0.08);
}

.welcome-text {
  color: #ffd700;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#displayUsername {
  color: #fff;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e7e7e7;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  padding: 10px 0;
  display: none;
  z-index: 9999;
}

/* cầu nối hover */
.user-dropdown::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 12px;
}

.user-dropdown:hover .user-menu {
  display: block;
}

.user-menu-title {
  display: block;
  padding: 8px 14px 10px;
  font-size: 13px;
  font-weight: 700;
  color: #777;
  border-bottom: 1px solid #efefef;
  margin-bottom: 6px;
}

.user-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #111;
  text-decoration: none;
  font-size: 14px;
  transition: 0.2s ease;
}

.user-menu a:hover {
  background: #f7f7f7;
  color: #111;
}

.cart-link {
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  transition: 0.2s ease;
}

.cart-link:hover {
  color: #ffd700;
}

.menu {
  background: #111;
}

.menu ul {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  list-style: none;
}

.menu li a {
  display: block;
  padding: 14px 20px;
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  transition: 0.2s;
}

.menu li a:hover {
  color: #FFD700;
}

.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  font-size: 22px;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ffd700;
  color: #111;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cart-count.hidden {
  display: none;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #ffd700;
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 768px) {
  .top-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }

  .menu-toggle {
    display: block;
    margin-left: auto;
  }

  .search-box {
    order: 3;
    width: 100%;
  }

  .user-actions {
    order: 2;
  }

  .menu {
    display: none;
    width: 100%;
  }

  .menu.active {
    display: block;
  }

  .menu ul {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .menu ul li {
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .menu ul li a {
    display: block;
    padding: 14px 20px;
  }
}

@media (min-width: 769px) {
  .menu {
    display: block !important;
  }
}

@media (max-width: 900px) {
  .top-header {
    flex-wrap: wrap;
  }

  .search-box {
    width: 100%;
    max-width: 100%;
  }

  .menu ul {
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .top-header {
    flex-direction: column;
    align-items: stretch;
  }

  .logo {
    text-align: center;
  }

  .user-actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .menu ul {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .logged-toggle {
    padding: 6px 10px;
  }

  .welcome-text {
    font-size: 13px;
  }
}