/*!
 * SuperNet Header CSS — Style Carrefour 3 rangées
 * Rangée 1 : .sn-topbar (bandeau info vert moyen)
 * Rangée 2 : .sn-header-main (logo + recherche + panier, fond vert pâle)
 * Rangée 3 : .sn-header-nav (pills catégories, fond vert pâle)
 */

/* =============================================================================
   HEADER — Structure globale
   ========================================================================== */

/* Reset TOTAL du header parent — overrider les 191KB du parent theme */
#header {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  color: inherit !important;
}

/* Override parent #header a colors (parent sets #232323 and hover #24b9d7) */
#header a {
  color: inherit !important;
}

#header a:hover {
  color: inherit !important;
  text-decoration: none !important;
}

#header .sn-header,
.sn-header {
  position: relative;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Masquer les éléments du parent theme qui restent dans les hooks */
#header .header-top,
#header .header-nav,
#header > nav,
#header .top-menu-link,
#_desktop_top_menu,
#_mobile_top_menu,
#header .blockcart:not(.sn-cart .blockcart),
.header-top,
.header-nav {
  display: none !important;
}

/* Le module ps_searchbar rendu par le hook displayTop du parent */
#header #search_widget,
#header .ps-searchbar,
.ps_searchbar,
#search_widget:not(.sn-search-widget) {
  display: none !important;
}

/* Le module ps_shoppingcart rendu par displayNav2 */
#header .blockcart.cart-preview:not(.sn-cart .blockcart) {
  display: none !important;
}

/* Masquer le module ps_mainmenu du parent (on a nos propres pills) */
#header .menu,
#header #_desktop_top_menu,
.js-top-menu:not(.sn-category-pills) {
  display: none !important;
}

/* Conteneur interne (centré, max-width) */
.sn-header-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 24px;
  box-sizing: border-box;
}

/* =============================================================================
   RANGÉE 1 — Barre info (topbar)
   ========================================================================== */

#header .sn-topbar,
.sn-topbar {
  background: var(--supernet-bg-topbar, #4CAF50) !important;
  color: var(--supernet-text-on-primary, #FFFFFF) !important;
  padding: 6px 0 !important;
  font-size: var(--supernet-font-size-xs, 12px) !important;
  text-align: center !important;
  letter-spacing: 0.3px;
}

.sn-topbar-text {
  font-weight: 500;
}

/* =============================================================================
   RANGÉE 2 — Barre principale (logo, recherche, panier)
   ========================================================================== */

#header .sn-header-main,
.sn-header-main {
  background: #E8F5E9 !important;
  padding: 12px 0 !important;
  border-bottom: 1px solid var(--supernet-border, #E5E7EB) !important;
}

.sn-header-main .sn-header-container {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Logo */
.sn-logo {
  flex: 0 0 auto;
}

.sn-logo a {
  display: flex;
  align-items: center;
}

.sn-logo .logo {
  max-height: 100px;
  width: auto;
}

/* Recherche — proéminente, au centre */
.sn-search {
  flex: 1 1 auto;
  max-width: 600px;
}

.sn-search-widget {
  position: relative;
  display: flex;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  overflow: hidden;
  height: 44px;
  transition: border-color 0.2s ease;
}

.sn-search-widget:focus-within {
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

.sn-search-widget .search-input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  border: none !important;
  background: transparent !important;
  font-size: var(--supernet-font-size-sm, 14px);
  font-family: var(--supernet-font-family);
  color: var(--supernet-text-main, #1A1A1A);
  outline: none !important;
  box-shadow: none !important;
}

.sn-search-widget .search-input::placeholder {
  color: var(--supernet-text-secondary, #666666);
}

#header .sn-search-btn,
.sn-search-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  background: #4CAF50 !important;
  color: #FFFFFF !important;
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

#header .sn-search-btn:hover,
.sn-search-btn:hover {
  background: #388E3C !important;
}

.sn-search-btn .material-icons {
  font-size: 22px;
}

/* Panier */
.sn-cart {
  flex: 0 0 auto;
  margin-left: auto;
}

#header .sn-cart-link,
#header a.sn-cart-link,
.sn-cart-link {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 14px 18px !important;
  border-radius: 0 !important;
  text-decoration: none !important;
  color: #1A1A1A !important;
  background: none !important;
  border: none !important;
  transition: color 0.2s ease !important;
}

#header .sn-cart-link:hover,
#header a.sn-cart-link:hover,
.sn-cart-link:hover {
  color: #4CAF50 !important;
  text-decoration: none !important;
}

.sn-cart-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sn-cart-icon {
  font-size: 48px !important;
  color: var(--supernet-text-main, #1A1A1A);
}

.sn-cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: #DC2626;
  color: white;
  border-radius: 50%;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border: 3px solid var(--supernet-bg-card, #FFFFFF);
  line-height: 1;
}

.blockcart.inactive .sn-cart-badge {
  background: #9CA3AF;
}

.sn-cart-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sn-cart-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--supernet-text-secondary, #666666);
  line-height: 1;
}

.sn-cart-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--supernet-text-main, #1A1A1A);
  line-height: 1;
}

/* Rangée 3 supprimée — catégories uniquement dans la sidebar (ps_categorytree) */

/* =============================================================================
   MASQUAGE — Éléments indésirables du thème parent
   ========================================================================== */

/* Masquer le header par défaut de PrestaShop (remplacé par .sn-header) */
#supernet-header,
.header-main,
.header-top,
.header-nav,
#_desktop_top_menu {
  display: none !important;
}

/* Masquer les sous-menus */
.popover.sub-menu.js-sub-menu.collapse,
.menu .popover,
.menu .collapse {
  display: none !important;
}

/* =============================================================================
   RESPONSIVE
   ========================================================================== */

/* Tablette */
@media (max-width: 1024px) {
  .sn-header-main .sn-header-container {
    gap: 16px;
  }

  .sn-search {
    max-width: 400px;
  }

}

/* Mobile */
@media (max-width: 768px) {
  .sn-topbar {
    display: none;
  }

  .sn-header-main .sn-header-container {
    flex-wrap: wrap;
    gap: 8px;
  }

  .sn-logo {
    flex: 0 0 auto;
  }

  .sn-logo .logo {
    max-height: 70px;
  }

  .sn-cart {
    order: 2;
    margin-left: auto;
  }

  .sn-cart-info {
    display: none;
  }

  .sn-cart-link {
    min-width: auto;
    padding: 10px 12px !important;
    gap: 8px !important;
  }

  .sn-cart-icon {
    font-size: 36px !important;
  }

  .sn-cart-badge {
    min-width: 22px;
    height: 22px;
    font-size: 12px;
    top: -6px;
    right: -8px;
  }

  .sn-search {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
  }

}

/* =============================================================================
   AUTOCOMPLÉTION
   ========================================================================== */

#supernet-autocomplete-dropdown {
  font-family: var(--supernet-font-family);
}

#supernet-autocomplete-dropdown .autocomplete-item:first-child {
  border-radius: 12px 12px 0 0;
}

#supernet-autocomplete-dropdown .autocomplete-item:last-child {
  border-radius: 0 0 12px 12px;
}

#supernet-autocomplete-dropdown .autocomplete-item:only-child {
  border-radius: 12px;
}
