/**
 * Modern Header Layout
 * Logo | Menu | Search (max-width) | Preferences | Cart
 * Keeps original dark theme
 */

header.modern-header {
  background: #000;
  color: #fff;
  position: relative;
  z-index: 1000;
  padding: 1.5rem 3rem;
}

.header-container {
  display: flex;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

/* Logo */
header .logo {
  flex-shrink: 0;
}

header .logo a {
  display: inline-block;
  line-height: 0;
  cursor: pointer;
  transition: opacity 0.2s;
}

header .logo a:hover {
  opacity: 0.8;
}

header .logo img,
header .logo svg {
  height: 45px;          /* -25% (avant 60px) */
  width: auto;
  max-width: 100%;
  display: block;
}

/* Main Menu */
.main-menu {
  display: flex;
  gap: 1.5rem;
  flex-shrink: 0;
}

.main-menu-item {
  position: relative;
  cursor: pointer;
  color: #fff;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.5rem 0;
  transition: color 0.2s;
}

.main-menu-item:hover {
  color: rgba(255, 255, 255, 0.7);
}

.main-menu-item a {
  color: #fff;
  text-decoration: none;
}

.main-menu-item a:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* Products Dropdown */
.products-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border-radius: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  min-width: 900px;
  max-width: 1100px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s;
  margin-top: 0.5rem;
  z-index: 999;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
}

.products-menu-trigger:hover .products-dropdown,
.products-menu-trigger.active .products-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.products-dropdown-category {
  margin-bottom: 1.5rem;
}

.products-dropdown-category:last-child {
  margin-bottom: 0;
}

.products-dropdown-category-title {
  font-weight: 800;
  font-size: 1.25rem;
  color: #252429;
  margin-bottom: 1rem;
}

.products-dropdown-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.products-dropdown-links a {
  color: #333;
  text-decoration: none;
  padding: 0.35rem 0;
  font-size: 0.95rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.products-dropdown-links a:hover {
  color: #000;
  padding-left: 0.5rem;
}

/* Sous-menu Produits : maîtresse (libellé) + liens enfants (hiérarchie stuv_cb) */
.products-nav-subgroup {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.65rem;
}

.products-nav-master {
  display: block;
  font-weight: 700;
  font-size: 0.875rem;
  color: #111;
  padding: 0.25rem 0 0.05rem;
  letter-spacing: 0.02em;
}

.products-nav-sublinks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-left: 0.65rem;
  margin: 0 0 0.35rem 0.15rem;
  border-left: 2px solid #ddd;
}

.products-nav-sublinks .products-nav-sublinks {
  border-left-color: #e5e5e5;
  padding-left: 0.55rem;
  margin-bottom: 0.15rem;
}

/* Global Search (Central) */
.global-search {
  flex: 0 1 auto;
  position: relative;
  width: calc(48vw - 6rem);
  /* max-width: 800px; */
}

.global-search input {
  width: 100%;
  padding: 0.75rem 3rem 0.75rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: #2B2E2D;
  border-radius: 0;
  font-size: 0.95rem;
  color: #fff;
  transition: all 0.2s;
}

.global-search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.global-search input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.15);
}

.global-search button {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: #000;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.global-search button:hover {
  background: #333;
}

.global-search button svg {
  width: 14px;
  height: 14px;
}

.global-search button svg path {
  fill: #fff;
}

#search-list {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 9999;
}

#search-list a {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

#search-list a:last-child {
  border-bottom: none;
}

#search-list a:hover {
  background: #f5f5f5;
}

#search-list .parent {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 0.25rem;
}

#search-list .name {
  font-weight: 500;
  color: #333;
}

/* Right Actions */
.header-actions {
  display: flex;
  gap: 0.25rem;  /* Resserré entre Contact et Cart */
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

/* Icônes contact / panier : 36 × 36 px (SVG inline) */
header.modern-header .header-actions .contact-trigger svg,
header.modern-header .header-actions .basket > svg {
  width: 36px;
  height: 36px;
  display: block;
  flex-shrink: 0;
}
/* Préférences garde sa respiration vs les icônes contact/cart */
.header-actions .preferences-trigger {
  margin-right: 0.75rem;
}

.header-actions > * {
  cursor: pointer;
}

/* Preferences button - text style like products menu */
.header-actions .preferences-trigger {
  padding: 0;
}

.header-actions .preferences-trigger span:not(.preferences-desktop-icon):not(.sr-only) {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0;
}

.header-actions .preferences-trigger:hover span:not(.preferences-desktop-icon):not(.sr-only) {
  color: rgba(255, 255, 255, 0.7);
}

/* Icône préférences desktop (user-gear) : 36 × 36 px */
.header-actions .preferences-trigger-desktop .preferences-desktop-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-actions .preferences-trigger-desktop .preferences-desktop-icon svg {
  width: 36px;
  height: 36px;
  display: block;
  flex-shrink: 0;
}

/* Contact (enveloppe) — styles déplacés du inline de header.php (2026-06-05) */
.header-actions .contact-trigger {
  color: #fff;
  padding: 0.5rem;
  text-decoration: none;
}

#header_menu .contact-trigger {
  margin-right: 0.15rem;
}

/* Cart icon - same size as preferences */
.basket {
  position: relative;
  color: #fff;
  font-size: 1.2rem;
  padding: 0.5rem;
  border-radius: 0;
  transition: all 0.2s;
  text-decoration: none;
}

.basket:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.basket::after {
  content: attr(data-count);
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--color-brand-primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  min-width: 20px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  text-align: center;
  line-height: 1;
  padding: 0.25rem;
}

/* Mobile */
@media (max-width: 1200px) {
  header .row {
    gap: 1rem;
    padding: 1rem;
  }
  
  .main-menu {
    display: none; /* Hide on mobile, show hamburger */
  }
  
  .global-search {
    max-width: none;
  }
}

@media (max-width: 768px) {
  header .row {
    flex-wrap: wrap;
  }
  
  .global-search {
    order: 3;
    width: 100%;
    margin-top: 0.5rem;
  }
}

