/* Styling for Header */
.header {
  background-color: var(--nimon-white, #FFFFFF);
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo {
  width: 3em;
  height: 3em;
  border-radius: 50%;
}

.brand-name {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-family: "Baloo 2";
  font-weight: 700;
  color: var(--brand-blue, #2667FF);
  letter-spacing: 0.5px;
}

/* Hamburger Menu Button */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 101;
}

.hamburger-btn span {
  width: 100%;
  height: 3px;
  background-color: #333;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.hamburger-btn.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.header-right {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.5rem);
  flex-wrap: wrap;
}

.cart-icon {
  position: relative;
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.cart-icon:hover {
  color: #5AA9E6;
}

.cart-icon:active {
  color: #FDBD0E;
}

.lucide {
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lucide-layout-dashboard {
  fill: var(--black, #000) !important;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #2667FF;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  box-sizing: border-box;
  white-space: nowrap;
}

.cart-icon,
a.header-action[href="/cart"],
a[href="/cart"] {
  position: relative;
}

.balance {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: none;
  border: 1px solid var(--neutral-500, #9DA4A8);
  border-radius: 16px;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
}

.balance:hover {
  background: #5AA9E6;
  border-color: #5AA9E6;
  color: #fff;
}

.balance:active {
  background: #FDBD0E;
  border-color: #FDBD0E;
  color: #000;
}

.balance svg {
  color: inherit;
}

.user-profile-dropdown {
  position: relative;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border: none;
  border-radius: 16px;
  background: none;
  font-family: var(--font-primary, "Open Sauce One", sans-serif);
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  font-weight: 600;
  transition: all 0.2s ease;
}

.user-profile:hover {
  background: #5AA9E6;
  color: #fff;
}

.user-profile:active {
  background: #FDBD0E;
  color: #000;
}

.user-avatar {
  object-fit: cover;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background-color: #fcfcfc;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  width: 200px;
  z-index: 110;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.dropdown-menu.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  padding: 12px 16px;
  color: var(--black, #000);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background: #5AA9E6;
  color: #fff;
}

.dropdown-item:active {
  background: #FDBD0E;
  color: #000;
}

.dropdown-item:first-child {
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.dropdown-item:last-child {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.logout-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.logout-form .dropdown-item {
  background: none;
  border: none;
  border-radius: 0;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: left;
  color: var(--red, #f0787a);
}

.logout-form .dropdown-item:hover {
  background: #f0787a;
  color: #fff;
}

.header-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border: none;
  border-radius: 16px;
  background: none;
  font-family: var(--font-primary, "Open Sauce One", sans-serif);
  color: var(--black, #000);
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.header-action:hover:not(:active) {
  background: #5AA9E6;
  color: #fff;
}

.header-action:active {
  background: #FDBD0E;
  color: #000;
}

.header-action.active {
  background: #FDBD0E;
  color: #000;
}

.guest-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-login {
  padding: 10px 24px;
  background: #000;
  border: 2px solid #000;
  border-radius: 16px;
  font-family: "Open Sauce One", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #FDBD0E;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-login:hover {
  background: var(--button-hover);
  color: var(--button-text-primary);
  border-color: #111;
}

.btn-login:active {
  border-color: #000;
}

.btn-signup {
  padding: 10px 24px;
  background: #000;
  border: 2px solid #000;
  border-radius: 16px;
  font-family: "Open Sauce One", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #FDBD0E;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-signup:hover {
  background: var(--button-hover);
  color: var(--button-text-primary);
}

.header .guest-buttons .btn-login,
.header .guest-buttons .btn-register,
.header .guest-buttons a.btn-login,
.header .guest-buttons a.btn-register {
  background: #000 !important;
  color: #FDBD0E !important;
  border: 2px solid #000 !important;
  border-radius: 16px !important;
  padding: 10px 24px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  display: inline-block !important;
  cursor: pointer !important;
  transition: background 0.12s ease, color 0.12s ease !important;
}

.header .guest-buttons .btn-login:hover,
.header .guest-buttons .btn-register:hover,
.header .guest-buttons a.btn-login:hover,
.header .guest-buttons a.btn-register:hover {
  background: var(--button-hover) !important;
  color: var(--button-text-primary) !important;
  border-color: none !important;
}

.header .guest-buttons .btn-login:active,
.header .guest-buttons .btn-register:active,
.header .guest-buttons a.btn-login:active,
.header .guest-buttons a.btn-register:active {
  background: var(--button-hover) !important;
  color: var(--button-text-primary) !important;
  border-color: none !important;
}

/* Mobile Overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Mobile Responsive Styles */
@media (max-width: 1119px) {
  .header {
    padding: 0.75rem 1rem;
    flex-wrap: nowrap;
  }

  .hamburger-btn {
    display: flex;
  }

  .header-right {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: 280px;
    max-width: 85vw;
    background-color: #FFFFFF;
    flex-direction: column;
    align-items: stretch;
    padding: 80px 20px 20px;
    gap: 0;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 100;
    overflow-y: auto;
  }

  .header-right.active {
    right: 0;
    display: block;
  }

  .mobile-overlay {
    display: block;
  }

  /* Mobile menu items */
  .header-action,
  .balance,
  .user-profile-dropdown,
  .guest-buttons {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
    margin-bottom: 8px;
  }

  .header-action {
    padding: 16px;
    font-size: 1rem;
  }

  .balance {
    padding: 16px;
    justify-content: space-between;
  }

  .cart-icon {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    justify-content: flex-start;
  }

  .cart-icon a {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
  }

  .cart-icon:hover {
    background: #5AA9E6;
  }

  .cart-icon:hover a {
    color: #fff;
  }

  .cart-badge {
    position: absolute;
    top: 6px; left: 32px;
  }

  .user-profile-dropdown {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
  }

  .user-profile {
    width: 100%;
    padding: 16px;
    justify-content: flex-start;
    border-radius: 12px;
  }

  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    width: 100%;
    margin-top: 8px;
    background: #f8f9fa;
  }

  .dropdown-item {
    padding: 14px 16px;
    border-radius: 8px !important;
    margin-bottom: 4px;
  }

  .guest-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .btn-login,
  .btn-signup,
  .header .guest-buttons .btn-login,
  .header .guest-buttons .btn-register {
    width: 100%;
    text-align: center;
    padding: 14px 24px !important;
  }

  /* Keep only essential items visible in header */
  .header-left {
    flex: 1;
  }

  .brand-name {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .logo {
    width: 2.5em;
    height: 2.5em;
  }

  .brand-name {
    font-size: 1rem;
  }
}