/* ================================================
   CUSTOM HEADER - Glass sticky header
   Desktop: logo + nav links + search + inscription
   Mobile: logo + search + burger (mega menu)
   ================================================ */

/* ===== HIDE GeneratePress default header, nav menu + search icon ===== */
.site-header {
  display: none !important;
}

/* Hide GP main navigation (replaced by our bl-desktop-nav + mega menu) */
#site-navigation,
.main-navigation {
  display: none !important;
}

/* Hide GP native search toggle icon (replaced by our search bar) */
.search-item,
.navigation-search {
  display: none !important;
}

/* ===== GLASS HEADER ===== */
.bl-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  will-change: transform;
  background: rgba(30, 30, 30, 0.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bl-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
}

/* Logo — Permanent Marker (loaded via PHP wp_enqueue_style) */
.bl-logo {
  font-family: 'Permanent Marker', cursive;
  font-size: 22px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0;
}

.bl-logo span {
  color: #e33922;
}

.bl-logo:hover {
  text-decoration: none;
  color: #fff;
}

/* ===== DESKTOP NAV (hidden on mobile) ===== */
.bl-desktop-nav {
  display: none;
  align-items: center;
  gap: 4px;
  flex: 1;
  margin: 0 16px;
}

/* Support both direct <a> links and wp_nav_menu <ul><li><a> or bare <li><a> */
.bl-desktop-nav > ul,
.bl-desktop-nav {
  list-style: none;
}

.bl-desktop-nav > ul {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.bl-desktop-nav > ul > li,
.bl-desktop-nav > li {
  list-style: none;
  margin: 0;
  display: inline-block;
}

.bl-desktop-nav a {
  color: #ddd;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.bl-desktop-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

/* Bouton CTA — ajouter class CSS "nav-cta" sur l'item dans le menu WP */
.bl-desktop-nav a.nav-cta,
.bl-desktop-nav .nav-cta > a {
  color: #fff;
  background: #e33922;
  font-weight: 700;
}

.bl-desktop-nav a.nav-cta:hover,
.bl-desktop-nav .nav-cta > a:hover {
  background: #c22d1a;
}

/* Header right actions — push to right */
.bl-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Search bar */
.bl-search-wrap {
  flex: 0 1 280px;
}

.bl-search-wrap form {
  position: relative;
  margin: 0;
}

input.bl-search-input,
input[type="search"].bl-search-input,
.bl-header input.bl-search-input {
  width: 100% !important;
  height: 44px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  padding: 0 34px 0 14px !important;
  color: #fff !important;
  font-size: 14px !important;
  outline: none !important;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.bl-search-input::placeholder {
  color: #aaa;
}

input.bl-search-input:focus,
.bl-header input.bl-search-input:focus {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(227, 57, 34, 0.4) !important;
}

.bl-search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  pointer-events: none;
  font-size: 13px;
}

/* Inscription button (desktop only) */
.bl-header-register {
  display: none;
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
}

.bl-header-register:hover {
  background: rgba(255, 255, 255, 0.14);
  text-decoration: none;
  color: #fff;
}

/* Burger button (mobile only) */
.bl-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s;
}

.bl-burger:active {
  background: rgba(255, 255, 255, 0.12);
}

.bl-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Burger → X animation */
body.mega-menu-open .bl-burger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.mega-menu-open .bl-burger span:nth-child(2) {
  opacity: 0;
}

body.mega-menu-open .bl-burger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== CATEGORY PILLS ===== */
.bl-pills-wrap {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 9989;
  will-change: transform;
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding: 8px 0;
}

.bl-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.bl-pills::-webkit-scrollbar {
  display: none;
}

.bl-pill {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 600;
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  transition: all 0.2s;
  flex-shrink: 0;
}

/* Custom colored pills (pub/promo) */
.bl-pill-custom {
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bl-pill-custom:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.bl-pill:hover {
  color: #fff;
  text-decoration: none;
}

.bl-pill.active {
  background: #e33922;
  color: #fff;
  border-color: #e33922;
}

/* ===== BODY OFFSET for fixed header + pills ===== */
body {
  padding-top: 96px !important; /* 56px header + 40px pills */
}

/* Remove any extra top margin/padding from GP content area */
.site-content {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

#page .site-content,
#page .content-area,
#page .site-main {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* ===== Desktop-only utility ===== */
.bl-desktop-only {
  display: none;
}

/* ===== Mobile search icon button (hidden on desktop) ===== */
.bl-mobile-search-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 15px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.bl-mobile-search-btn:active {
  background: rgba(255, 255, 255, 0.12);
}

/* ===== Mobile slide-down search bar ===== */
.bl-mobile-search-bar {
  display: none;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 8px;
  background: rgba(18, 18, 18, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.bl-mobile-search-bar.bl-search-open {
  max-height: 56px;
  padding: 8px 8px;
}

.bl-mobile-search-bar form {
  position: relative;
  margin: 0;
}

.bl-mobile-search-input,
input[type="search"].bl-mobile-search-input,
.bl-header input.bl-mobile-search-input {
  width: 100% !important;
  height: 40px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  padding: 0 34px 0 14px !important;
  color: #fff !important;
  font-size: 14px !important;
  outline: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.bl-mobile-search-input::placeholder {
  color: #aaa;
}

.bl-mobile-search-input:focus {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(227, 57, 34, 0.4) !important;
}

.bl-mobile-search-bar-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  pointer-events: none;
  font-size: 13px;
}

/* ===== MOBILE (default) ===== */
@media (max-width: 768px) {
  /* Hide desktop nav, register, search on mobile (search is in mega menu) */
  .bl-desktop-nav,
  .bl-header-register,
  .bl-desktop-only {
    display: none !important;
  }

  /* Compact mobile header: 48px */
  .bl-header-top {
    height: 48px;
  }

  .bl-logo {
    font-size: 18px;
  }

  /* Show mobile search icon */
  .bl-mobile-search-btn {
    display: flex;
  }

  /* Show mobile search bar container (height controlled by .bl-search-open) */
  .bl-mobile-search-bar {
    display: block;
  }

  /* Compact burger on mobile */
  .bl-burger {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  /* Adjust pills offset for 48px header */
  .bl-pills-wrap {
    top: 48px;
  }

  /* Adjust body padding for shorter header */
  body {
    padding-top: 88px !important; /* 48px header + 40px pills */
  }
}

/* ===== DESKTOP ===== */
@media (min-width: 769px) {
  .bl-header {
    padding: 0 24px;
  }

  .bl-header-top {
    height: 56px;
  }

  /* Show desktop nav */
  .bl-desktop-nav {
    display: flex;
  }

  /* Show register button + search on desktop */
  .bl-header-register {
    display: inline-flex;
  }

  .bl-desktop-only {
    display: block;
  }

  .bl-search-wrap {
    flex: 0 1 400px;
    min-width: 200px;
  }

  /* Hide burger on desktop */
  .bl-burger {
    display: none !important;
  }

  .bl-search-wrap {
    flex: 0 1 320px;
  }

  .bl-pills-wrap {
    padding: 8px 16px;
  }
}

/* ===== FOCUS INDICATORS ===== */
.bl-search-input:focus-visible {
  outline: 2px solid #e33922;
  outline-offset: 1px;
}
.bl-burger:focus-visible {
  outline: 2px solid #e33922;
  outline-offset: 2px;
}
.bl-pill:focus-visible {
  outline: 2px solid #e33922;
  outline-offset: 2px;
}
.bl-desktop-nav a:focus-visible {
  outline: 2px solid #e33922;
  outline-offset: 2px;
}

/* ===== PILLS SCROLL INDICATOR ===== */
/* Note: .bl-pills-wrap is already position:fixed — use .bl-pills for the gradient */
.bl-pills {
  position: relative;
}
.bl-pills::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(to right, transparent, rgb(18, 18, 18));
  pointer-events: none;
  z-index: 10;
}

/* ===== ADMIN BAR OFFSET ===== */
@media (max-width: 782px) {
  body.admin-bar { padding-top: 134px !important; } /* 46 admin + 48 header + 40 pills */
  body.admin-bar .bl-header { top: 46px; }
  body.admin-bar .bl-pills-wrap { top: 94px; } /* 46 admin + 48 header */
}
@media (min-width: 783px) {
  body.admin-bar { padding-top: 128px !important; }
  body.admin-bar .bl-header { top: 32px; }
  body.admin-bar .bl-pills-wrap { top: 88px; }
}

/* ===== REGISTER BUTTON FOCUS ===== */
.bl-header-register:focus-visible {
  outline: 2px solid #e33922;
  outline-offset: 2px;
}

/* ===== PILLS VERY SMALL SCREENS ===== */
@media (max-width: 380px) {
  .bl-pills { padding: 0 8px; }
  .bl-pill { padding: 4px 10px; font-size: 11px; }
}
