﻿/* ================== BASE NAVBAR ================== */
body.navbar-offset {
  padding-top: 80px;
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}

.navbar.navbar--solid {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ================== CONTAINER ================== */
.navbar-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem clamp(1.5rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* ================== LOGO ================== */
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  z-index: 101;
}

.icone-header {
  height: 48px;
  width: auto;
  display: block;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #16aaff;
  letter-spacing: -0.02em;
}

/* ================== ACTIONS ZONE ================== */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

/* ================== BOUTONS ================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn i {
  width: 18px;
  height: 18px;
}

/* Bouton Nouvelle Annonce */
.btn-new-ad {
  background: #16aaff;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(22, 170, 255, 0.25);
}

.btn-new-ad:hover {
  background: #1498e6;
  box-shadow: 0 4px 12px rgba(22, 170, 255, 0.35);
  transform: translateY(-1px);
}

/* Boutons auth (non connecté) */
.btn-login {
  background: transparent;
  color: #333;
  border: 1px solid #ddd;
}

.btn-login:hover {
  background: #f5f5f5;
}

.btn-signup {
  background: #16aaff;
  color: #ffffff;
}

.btn-signup:hover {
  background: #1498e6;
}

/* ================== COMPTEUR ================== */
.navbar-counter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f0f9ff;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.navbar-counter:hover {
  background: #e0f4ff;
  transform: translateY(-1px);
}

.navbar-counter i {
  width: 20px;
  height: 20px;
  color: #16aaff;
}

.counter-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #333;
}

/* ================== MENU UTILISATEUR ================== */
.user-menu {
  position: relative;
}

.user-avatar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem 0.35rem 0.35rem;
  background: transparent;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-avatar:hover {
  background: #f5f5f5;
}

.avatar-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 50%;
  text-transform: uppercase;
}

.chevron-icon {
  width: 16px;
  height: 16px;
  color: #666;
  transition: transform 0.2s ease;
}

.user-avatar[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

/* ================== DROPDOWN MENU ================== */
.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 200px;
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #333;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background: #f5f5f5;
}

.dropdown-item i {
  width: 18px;
  height: 18px;
  color: #666;
}

.dropdown-item.logout {
  color: #dc2626;
}

.dropdown-item.logout i {
  color: #dc2626;
}

.dropdown-item.logout:hover {
  background: #fef2f2;
}

.dropdown-divider {
  margin: 0.5rem 0;
  border: none;
  border-top: 1px solid #e5e5e5;
}

/* ================== MOBILE MENU ================== */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 101;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2.5px;
  background: #333;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.menu-overlay.active {
  display: block;
  opacity: 1;
}

/* ================== RESPONSIVE ================== */
@media (max-width: 960px) {
  body.navbar-offset {
    padding-top: 70px;
  }

  .navbar-container {
    padding: 0.6rem clamp(1rem, 4vw, 1.5rem);
  }

  .menu-toggle {
    display: flex;
  }

  .icone-header {
    height: 42px;
  }

  .logo-text {
    font-size: 1.25rem;
  }

  .navbar-actions {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: 320px;
    max-width: 85vw;
    background: #ffffff;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 90px 20px 20px;
    margin: 0;
    gap: 1rem;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    overflow-y: auto;
  }

  .navbar-actions.active {
    right: 0;
  }

  .btn-new-ad,
  .btn-login,
  .btn-signup {
    width: 100%;
    justify-content: center;
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }

  .navbar-counter {
    width: 100%;
    justify-content: center;
    padding: 1rem;
  }

  .user-menu {
    width: 100%;
  }

  .user-avatar {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    border-radius: 0.5rem;
    background: #f5f5f5;
  }

  .user-dropdown {
    position: static;
    min-width: 100%;
    margin-top: 0.5rem;
    box-shadow: none;
    border: 1px solid #e5e5e5;
  }

  .user-dropdown.active {
    display: block;
  }

  .user-dropdown:not(.active) {
    display: none;
  }
}

@media (max-width: 720px) {
  .navbar-actions {
    width: 280px;
    padding: 80px 16px 16px;
  }

  .icone-header {
    height: 38px;
  }

  .logo-text {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  body.navbar-offset {
    padding-top: 65px;
  }

  .navbar-actions {
    width: 260px;
  }
}