

/* merged: header.css */

/* Styles spécifiques au header */
/* Ligne unique : logo | recherche | actions (flexbox) */
:root {
  --nav-white: #fff;
  --nav-surface: #f8fafc;
  --nav-surface-legacy: #f8f9fa;
  --nav-surface-hover: #f1f5f9;
  --nav-border: #e5e7eb;
  --nav-border-soft: #d1d5db;
  --nav-text: #1e293b;
  --nav-text-strong: #2c3e50;
  --nav-text-muted: #64748b;
  --nav-primary: #385e6b;
  --nav-info: #0ea5e9;
  --nav-danger: #dc2626;
  --nav-danger-bg: #fef2f2;
  --nav-shadow-md: rgba(0, 0, 0, 0.15);
  --nav-info-line: rgba(14, 165, 233, 0.25);
  --nav-white-text: rgba(255, 255, 255, 0.9);
}

.header-lbc-leboncoin {
  position: relative;
  z-index: 10050;
}

.header-lbc-leboncoin .main-nav {
  position: relative;
  z-index: 10050;
}

.header-lbc-leboncoin .header-content-lbc {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0;
}
.header-lbc-leboncoin .search-bar-lbc.search-bar-desktop {
  flex: 1;
  min-width: 0;
  margin-left: 12px;
  margin-right: 12px;
}
.header-lbc-leboncoin .search-bar-lbc .search-bar-input {
  flex: 1;
  min-width: 120px;
}
.header-lbc-leboncoin .header-actions-lbc {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
}

/* Navigation et menu déroulant */
.nav-item.has-dropdown { position: relative; }
.nav-item.has-dropdown .dropdown-menu {
  display: none;
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  background: var(--nav-white);
  min-width: 180px;
  box-shadow: 0 4px 16px rgba(44,62,80,0.10);
  border-radius: 0 0 10px 10px;
  z-index: 20000;
  padding: 10px 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
}
.nav-item.has-dropdown:hover .dropdown-menu,
.nav-item.has-dropdown:focus-within .dropdown-menu {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.dropdown-menu li {
  list-style: none;
}
.dropdown-menu a {
  display: block;
  padding: 10px 24px;
  color: #23272b;
  text-decoration: none;
  font-size: 1rem;
  transition: background 0.15s;
  background: none;
  white-space: nowrap;
}
.dropdown-menu a:hover {
  background: #f2f2f2;
  color: var(--accent);
}
.main-nav, .nav-container, .nav-menu, .nav-item, .nav-link {
  overflow: visible !important;
}

/* Barre de recherche header */
.search-bar-lbc {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 24px;
  position: relative;
}
.search-bar-input {
  padding: 10px 14px;
  border-radius: 6px 0 0 6px;
  border: 1px solid var(--nav-border-soft);
  font-size: 1rem;
  background: var(--nav-white);
  transition: border 0.2s, box-shadow 0.2s;
  outline: none;
  width: 420px;
}
.search-bar-input:focus {
  border-color: var(--nav-info);
  box-shadow: 0 0 0 2px var(--nav-info-line);
}
.search-bar-btn {
  padding: 10px 18px;
  border-radius: 0 6px 6px 0;
  background: var(--accent);
  color: var(--on-accent, var(--nav-white));
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.search-bar-btn:hover {
  background: var(--accent-hover);
}

/* Suggestions de recherche */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--nav-white);
  border: 1px solid var(--nav-border-soft);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 1000;
  display: none;
  max-height: 300px;
  overflow-y: auto;
}
.search-suggestions.is-visible {
  display: block;
}
.search-suggestion-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
}
.search-suggestion-item:hover {
  background: var(--nav-surface-legacy);
}
.search-suggestion-item.active {
  background: #e3f0fa;
}
.search-suggestion-item:last-child {
  border-bottom: none;
}
.search-suggestion-icon {
  color: #666;
  font-size: 14px;
}
.search-suggestion-text {
  color: #333;
  font-size: 14px;
}
.search-suggestion-type {
  color: #888;
  font-size: 12px;
  margin-left: auto;
}

/* Menu utilisateur */
.user-menu-container {
  position: relative;
}
.user-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}
.user-menu-btn:hover {
  background: rgba(255,255,255,0.1);
}
.user-name {
  color: var(--primary-dark);
  font-weight: 500;
  font-size: 14px;
}
.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--nav-white);
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 200px;
  z-index: 10001;
  display: none;
  padding: 8px 0;
  margin-top: 6px;
}
.user-dropdown.show {
  display: block;
  animation: dropdownFadeIn 0.2s ease;
}
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.user-dropdown hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 8px 0;
}
.user-info {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--nav-surface-legacy);
  border-radius: 6px;
  margin: 8px;
}
.user-info strong {
  display: block;
  color: var(--primary-dark);
  font-size: 14px;
}
.user-info small {
  color: #666;
  font-size: 12px;
}
.user-dropdown a {
  display: block;
  padding: 10px 16px;
  color: var(--primary-dark);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
}
.user-dropdown a:hover {
  background: var(--nav-surface-legacy);
  color: var(--accent);
}
.logout-link {
  color: #e74c3c !important;
}
.logout-link:hover {
  background: #fdf2f2 !important;
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 6px;
}
.dropdown-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
}

/* Formulaire login inline (style Vinted/Leboncoin) */
.login-dropdown-inner {
  padding: 16px;
  min-width: 300px;
}
.header-login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-group-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group-inline label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}
.form-group-inline input {
  padding: 12px;
  border: 1px solid var(--nav-border-soft);
  border-radius: 12px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group-inline input:focus {
  outline: none;
  border-color: var(--nav-info);
  box-shadow: 0 0 0 2px var(--nav-info-line);
}
.remember-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
}
.remember-inline input {
  width: auto;
  margin: 0;
}
.header-login-error {
  font-size: 13px;
  color: var(--nav-danger);
  background: var(--nav-danger-bg);
  padding: 8px 10px;
  border-radius: 6px;
  display: none;
}
.header-login-error:not(:empty) {
  display: block;
}
.btn-login-submit {
  width: 100%;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--on-accent, var(--nav-white));
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.btn-login-submit:hover {
  background: var(--accent-hover);
}
.btn-login-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.login-dropdown-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--nav-border);
  text-align: center;
  font-size: 13px;
}
.login-dropdown-footer a {
  display: inline;
  padding: 0;
  color: var(--accent);
  text-decoration: none;
}
.login-dropdown-footer a:hover {
  text-decoration: underline;
  background: none;
}
.login-dropdown-footer .separator {
  margin: 0 6px;
  color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
  .search-bar-input {
    width: 300px;
  }
  .user-name {
    display: none;
  }
}
@media (max-width: 600px) {
  .search-bar-input {
    width: 250px;
  }
  .search-bar-lbc {
    margin: 0 12px;
  }
}

/* ------------------------------------------------------------------ */
/*  Fix position loupe (header)                                       */
/* ------------------------------------------------------------------ */
/* Le bouton de recherche du header est positionné en absolute via les
   classes utilitaires; si la hauteur de l'input varie, `top-1` n'est plus
   fiable → on force un centrage vertical robuste. */
.header-lbc-leboncoin .search-bar-lbc.search-bar-desktop .search-bar-btn {
  left: auto !important;
  right: 0.25rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

/* Sélecteur de langue (drapeaux) discret dans le header */
.lang-switcher-header {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: 8px;
  flex-shrink: 0;
}
.lang-switcher-header .lang-flag {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  text-decoration: none;
  border-radius: 2px;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.lang-switcher-header .lang-flag:hover {
  opacity: 1;
}
.lang-switcher-header .lang-flag.active {
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}
@media (max-width: 900px) {
  .lang-switcher-header { margin-right: 4px; }
  .lang-switcher-header .lang-flag { font-size: 0.9rem; }
}


/* merged: mobile-menu.css */

/* ===== MENU MOBILE STYLE LEBONCOIN ===== */
/* Hamburger + drawer, barre recherche, catégories horizontales */

:root {
  --mobile-header-height: 56px;
  --mobile-drawer-width: 300px;
  --mobile-touch-min: 44px;
  --mobile-safe-top: env(safe-area-inset-top, 0px);
  --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Hamburger (masqué sur desktop) */
.header-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--mobile-touch-min);
  height: var(--mobile-touch-min);
  min-width: var(--mobile-touch-min);
  min-height: var(--mobile-touch-min);
  padding: 0;
  border: none;
  background: none;
  color: var(--nav-text-strong);
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.header-hamburger[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.header-hamburger[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}
.header-hamburger[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Zone recherche + catégories mobile (masquée sur desktop) */
.header-mobile-search-wrap {
  display: none;
}

/* Catégories horizontales scrollables */
.header-categories-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
  box-sizing: border-box;
}

.header-categories-scroll::-webkit-scrollbar {
  display: none;
}

.header-category-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--nav-white-text);
  text-decoration: none;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.header-category-chip:hover {
  color: var(--nav-white);
  text-decoration: underline;
}

/* Overlay drawer – couvre uniquement la zone à droite du drawer pour ne pas bloquer les clics */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10002;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.mobile-menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
  left: min(var(--mobile-drawer-width), 85vw);
}

/* Drawer */
.mobile-menu-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(var(--mobile-drawer-width), 85vw);
  max-width: 320px;
  background: var(--nav-white);
  z-index: 10003;
  box-shadow: 4px 0 24px var(--nav-shadow-md);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu-drawer.is-open {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--nav-border);
}

.mobile-menu-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--nav-text);
}

.mobile-menu-close {
  width: var(--mobile-touch-min);
  height: var(--mobile-touch-min);
  padding: 0;
  border: none;
  background: var(--nav-surface-hover);
  color: var(--nav-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mobile-menu-close:hover {
  background: #e2e8f0;
  color: var(--nav-text);
}

.mobile-menu-nav {
  padding: 16px 0;
}

.mobile-menu-link {
  display: block;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.mobile-menu-link:hover {
  background: var(--nav-surface);
  color: var(--nav-text);
}

.mobile-menu-link.active {
  font-weight: 600;
  background: #eff6ff;
  color: #1d4ed8;
}

.mobile-menu-sublink {
  display: block;
  padding: 10px 20px 10px 36px;
  font-size: 0.9375rem;
  color: var(--nav-text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.mobile-menu-sublink:hover {
  background: var(--nav-surface);
  color: var(--nav-primary);
}

.mobile-menu-cta {
  background: rgba(242, 222, 185, 0.25);
  color: var(--nav-text-strong);
  font-weight: 600;
}

.mobile-menu-cta:hover {
  background: rgba(242, 222, 185, 0.4);
  color: var(--nav-text);
}

.mobile-menu-logout {
  color: var(--nav-danger);
}

.mobile-menu-logout:hover {
  background: var(--nav-danger-bg);
  color: #b91c1c;
}

.mobile-menu-divider {
  border: none;
  border-top: 1px solid var(--nav-border);
  margin: 12px 0;
}

.mobile-menu-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--nav-surface);
  margin: 0 16px 12px;
  border-radius: 10px;
}

.mobile-menu-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.mobile-menu-user strong {
  display: block;
  font-size: 0.9375rem;
  color: var(--nav-text);
}

.mobile-menu-user small {
  display: block;
  font-size: 0.8125rem;
  color: var(--nav-text-muted);
  margin-top: 2px;
}

/* ===== BREAKPOINT MOBILE ===== */
@media (max-width: 768px) {
  .header-hamburger {
    display: flex;
    color: var(--nav-white);
  }

  .header-hamburger:hover {
    color: var(--nav-white-text);
  }

  .header-actions-desktop {
    display: none !important;
  }

  .search-bar-desktop {
    display: none !important;
  }

  .header-lbc-leboncoin {
    background: linear-gradient(180deg, var(--nav-text-strong) 0%, var(--nav-primary) 100%);
    box-shadow: 0 2px 12px var(--nav-shadow-md);
  }

  .header-lbc-leboncoin .header-content-lbc {
    padding: 8px 12px;
    min-height: var(--mobile-header-height);
    flex-wrap: nowrap;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
  }

  .header-lbc-leboncoin .logo-lbc {
    flex: 1;
    justify-content: center;
    align-items: center;
  }

  .logo-lbc a {
    display: flex;
    justify-content: center;
  }

  .header-mobile-search-wrap {
    display: block;
  }

  .search-bar-mobile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.15);
    margin: 12px 0 0;
    border-radius: 10px;
  }

  .search-bar-mobile-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
  }

  .search-bar-mobile-input {
    flex: 1;
    min-width: 0;
    padding: 10px 0;
    border: none;
    background: none;
    color: var(--nav-white);
    font-size: 1rem;
  }

  .search-bar-mobile-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
  }

  .search-bar-mobile-input:focus {
    outline: none;
  }

  .search-bar-mobile-btn {
    display: none;
  }

  .main-nav {
    display: none !important;
  }

  .mobile-menu-overlay,
  .mobile-menu-drawer {
    display: block;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }
}
