/* ============================================
   ECOSERVISTRACTORES – Header & Navigation
   Unique, propre, sans doublon
   ============================================ */

/* ── TOP BAR ─────────────────────────────── */
.topbar {
  background: #1A3C28;
  padding: 0 0;
  height: 40px;
  font-size: 0.8125rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.topbar .container { height: 100%; }
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}
.topbar__left  { display: flex; align-items: center; gap: 20px; }
.topbar__right { display: flex; align-items: center; gap: 12px; }

.topbar__item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(245,240,230,0.85);
  font-size: 0.8rem;
  white-space: nowrap;
}
.topbar__link {
  color: rgba(245,240,230,0.85);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.15s;
}
.topbar__link:hover { color: #fff; }
.topbar__sep { color: rgba(245,240,230,0.2); }

/* ── MAIN HEADER ─────────────────────────── */
.header {
  background: #fff;
  height: 70px;
  position: sticky;
  top: 0;
  z-index: 300;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}
.header.scrolled {
  box-shadow: 0 2px 20px rgba(0,0,0,0.14);
}
.header .container { height: 100%; }
.header__inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 20px;
}

/* ── LOGO ────────────────────────────────── */
.header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}
.header__logo img { height: 46px; width: auto; }

/* ── NAV ─────────────────────────────────── */
.header__nav { flex: 1; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 11px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2E2B26;
  border-radius: 7px;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1;
}
.nav-link:hover,
.nav-link.active {
  color: #2E5A3C;
  background: rgba(46,90,60,0.07);
}
.nav-link svg { transition: transform 0.15s; }
.nav-item:hover > .nav-link svg { transform: rotate(180deg); }

/* ── DROPDOWN ────────────────────────────── */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  border: 1px solid #E8E0CC;
  padding: 6px;
  min-width: 210px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.2s;
  z-index: 400;
}
.nav-item:hover .nav-dropdown,
.nav-item:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-dropdown a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  font-size: 0.85rem;
  color: #2E2B26;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s;
}
.nav-dropdown a:hover { background: #F5F0E6; color: #2E5A3C; }

/* ── SEARCH BAR (single, desktop) ───────── */
.header__search {
  flex: 0 0 230px;
  position: relative;
}
.header__search-input {
  width: 100%;
  padding: 8px 38px 8px 14px;
  background: #F5F0E6;
  border: 2px solid transparent;
  border-radius: 30px;
  font-size: 0.85rem;
  outline: none;
  transition: all 0.18s;
  color: #1C1C1C;
}
.header__search-input:focus {
  background: #fff;
  border-color: #2E5A3C;
  box-shadow: 0 0 0 3px rgba(46,90,60,0.1);
}
.header__search-input::placeholder { color: #B0A898; }
.header__search-btn {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #7A7268;
  padding: 2px;
  display: flex;
  align-items: center;
}

/* ── ACTION ICONS ────────────────────────── */
.header__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.header__action-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #4A4540;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.header__action-btn:hover {
  background: #F5F0E6;
  color: #2E5A3C;
}
.header__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #2E5A3C;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── HAMBURGER ───────────────────────────── */
.header__mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s;
}
.header__mobile-toggle:hover { background: #F5F0E6; }
.header__mobile-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #2E2B26;
  border-radius: 2px;
  transition: all 0.2s;
}
/* animate to X when open */
.header__mobile-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.header__mobile-toggle.open span:nth-child(2) { opacity: 0; width: 0; }
.header__mobile-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ── MOBILE MENU ─────────────────────────── */
.mobile-menu {
  position: fixed;
  top: 70px; /* matches header height */
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  z-index: 299;
  overflow-y: auto;
  padding: 20px 20px 40px;
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  border-top: 3px solid #2E5A3C;
}
.mobile-menu.open { transform: translateX(0); }

.mobile-menu__search {
  position: relative;
  margin-bottom: 20px;
}
.mobile-menu__search input {
  width: 100%;
  padding: 11px 42px 11px 16px;
  border: 2px solid #E8E0CC;
  border-radius: 10px;
  font-size: 0.9rem;
  outline: none;
  background: #F5F0E6;
}
.mobile-menu__search input:focus {
  border-color: #2E5A3C;
  background: #fff;
}
.mobile-menu__search button {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #7A7268;
}

.mobile-menu__nav { display: flex; flex-direction: column; gap: 2px; }
.mobile-menu__nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  font-size: 1rem;
  font-weight: 600;
  color: #2E2B26;
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.15s;
}
.mobile-menu__nav a:hover { background: #F5F0E6; color: #2E5A3C; }
.mobile-menu__nav a + a { border-top: 1px solid #F0EBE0; }

.mobile-menu__footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #E8E0CC;
}

/* ── RESPONSIVE BREAKPOINTS ──────────────── */
@media (max-width: 1100px) {
  .header__search { flex: 0 0 190px; }
  .nav-link { padding: 8px 9px; font-size: 0.82rem; }
}

@media (max-width: 920px) {
  .header__nav   { display: none; }
  .header__search { display: none; }
  .header__mobile-toggle { display: flex; }
  .topbar { display: none; } /* hide on small screens */
}

@media (max-width: 480px) {
  .header { height: 60px; }
  .mobile-menu { top: 60px; }
  .header__logo img { height: 38px; }
}
