/* header.css - Navigation and Header Styles */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 30px rgba(15, 23, 42, 0.03);
  transition: var(--transition-normal);
  padding: 15px 0;
}

/* Header sticky contraction */
.site-header.scrolled {
  padding: 8px 0;
  background-color: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Logo */
.header-logo img {
  height: 38px;
  width: auto;
  object-fit: contain;
  transition: var(--transition-fast);
}

.site-header.scrolled .header-logo img {
  height: 32px;
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 30px;
  margin-bottom: 0;
  padding-left: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-heading);
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary);
  transition: var(--transition-fast);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Dropdown Menu */
.nav-item-dropdown:hover .dropdown-menu-custom {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu-custom {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  min-width: 200px;
  list-style: none;
  padding: var(--space-2) 0;
  margin-top: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition-fast);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

/* Arrow indicator for dropdown link */
.nav-link .bi-chevron-down {
  font-size: 0.75rem;
  transition: var(--transition-fast);
}

.nav-item-dropdown:hover .bi-chevron-down {
  transform: rotate(180deg);
}

.dropdown-item-custom a {
  display: block;
  padding: 8px 20px;
  font-size: 0.9rem;
  color: var(--text-heading);
}

.dropdown-item-custom a:hover {
  background-color: var(--primary);
  color: #ffffff;
  padding-left: 24px;
}

/* Search Icon Button in Header */
.header-search-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 1.1rem;
}

.header-search-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: rgba(255, 70, 100, 0.05);
  transform: translateY(-1px);
}

/* User controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.user-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-btn:hover,
.user-dropdown-wrap:hover .user-btn {
  border-color: var(--primary);
  color: var(--primary);
  background-color: rgba(255, 70, 100, 0.05);
}

/* User Dropdown Menu */
.user-dropdown-wrap {
  position: relative;
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 200px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.2s;
  z-index: 1100;
}

/* Invisible bridge to prevent mouse leave gap */
.user-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
}

/* Pointer arrow */
.user-dropdown-arrow {
  position: absolute;
  top: -6px;
  right: 12px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-left: 1px solid var(--border-color);
  border-top: 1px solid var(--border-color);
  transform: rotate(45deg);
}

/* Show on hover (wrap includes both btn and menu so menu stays open) */
.user-dropdown-wrap:hover .user-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-heading);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.user-dropdown-item i {
  font-size: 0.95rem;
  width: 16px;
  text-align: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.15s;
}

.user-dropdown-item:hover {
  background-color: rgba(255, 70, 100, 0.05);
  color: var(--primary);
}

.user-dropdown-item:hover i {
  color: var(--primary);
}

.user-dropdown-item--danger {
  color: #ef4444;
}

.user-dropdown-item--danger i {
  color: #ef4444;
}

.user-dropdown-item--danger:hover {
  background-color: #fef2f2;
  color: #dc2626;
}

.user-dropdown-item--danger:hover i {
  color: #dc2626;
}

.user-dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

/* Mobile Toggler Button */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-heading);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Autocomplete Suggestion Box */
.search-autocomplete-box {
  position: absolute;
  top: 105%;
  left: 0;
  right: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  display: none;
}

.autocomplete-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.05em;
  padding: var(--space-2) var(--space-4) var(--space-1) var(--space-4);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  background-color: #f8fafc;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.autocomplete-item:hover {
  background-color: #f1f5f9;
}

.autocomplete-thumb {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  object-fit: cover;
}

.autocomplete-thumb.rounded-avatar {
  border-radius: 50%;
}

.autocomplete-info {
  flex: 1;
}

.autocomplete-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-heading);
}

.autocomplete-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Offcanvas custom overrides for light theme */
.offcanvas-custom {
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border-left: 1px solid var(--border-color) !important;
}

.offcanvas-custom .offcanvas-header {
  border-bottom: 1px solid var(--border-color);
}

.offcanvas-custom .btn-close {
  opacity: 0.7;
}

.mobile-nav-list {
  list-style: none;
  padding-left: 0;
}

.mobile-nav-item {
  border-bottom: 1px solid var(--border-color);
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 10px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-heading);
}

.mobile-nav-link:hover {
  color: var(--primary);
  background-color: rgba(255, 70, 100, 0.03);
}

.mobile-submenu {
  list-style: none;
  padding-left: 20px;
  background-color: #f8fafc;
}

.mobile-submenu-item a {
  display: block;
  padding: 10px 10px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.mobile-submenu-item a:hover {
  color: var(--primary);
}

/* Header Action Buttons (Favorites, Cart) */
.header-action-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 1.1rem;
}

.header-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: rgba(255, 70, 100, 0.05);
  transform: translateY(-1px);
}

.header-action-btn .header-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: var(--primary);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(255, 70, 100, 0.3);
}

/* Responsive adjustment for header actions */
@media (max-width: 576px) {
  .header-actions {
    gap: 8px;
  }

  /* Keep Favorites and Cart visible, hide search and user toggle on small mobile to save space */
  .header-search-toggle-btn,
  .user-btn {
    display: none !important;
  }
}

/* =============================================
   CART PANEL (Slide-in Sidebar)
   ============================================= */

#cart-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 9998;
  backdrop-filter: blur(2px);
}

#cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 92vw;
  height: 100dvh;
  background: #ffffff;
  box-shadow: -8px 0 40px rgba(15, 23, 42, 0.12);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#cart-panel.open {
  transform: translateX(0);
}

.cart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.cart-panel-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
  display: flex;
  align-items: center;
}

.cart-panel-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: #f1f5f9;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.cart-panel-close:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.cart-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.cart-panel-body::-webkit-scrollbar {
  width: 4px;
}

.cart-panel-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Empty state */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-muted);
  gap: 12px;
}

.cart-empty i {
  font-size: 3rem;
  opacity: 0.35;
}

.cart-empty p {
  font-size: 0.95rem;
  margin: 0;
}

/* Cart Items */
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.cart-item-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cart-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}

.cart-item-price.contact {
  color: #64748b;
  font-weight: 500;
}

.cart-item-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.cart-item-remove:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #ef4444;
}

/* Footer */
.cart-panel-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-panel-footer .btn-custom {
  text-align: center;
  padding: 12px 20px;
  font-size: 0.95rem;
}

.cart-panel-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}