/* ============================================
   HEADER — Header, mega nav, live search dropdown, sticky, live search — Tu Rincón Ferretero
   Extraído de style.css en Fase 2 (Solución 2.0).
   No modificar selectores ni valores: paridad 1:1 con el original.
   ============================================ */

/* ============================================
   HEADER
   ============================================ */
.site-header {
  background: var(--paper);
  border-bottom: 2.5px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 3px 0 var(--ink);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  max-width: 1280px;
  margin: 0 auto;
}

.site-logo {
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--accent-purple);
  padding: 6px 14px;
  border: 2px solid var(--line);
  border-radius: 2px;
  box-shadow: 2px 2px 0 var(--line);
  white-space: nowrap;
  text-decoration: none;
}
.site-logo:hover { text-decoration: none; color: #fff; }

/* Logo personalizado de WordPress */
.custom-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.custom-logo-link img.custom-logo {
  max-height: 52px;
  width: auto;
  display: block;
}

.header-search {
  flex: 1;
  display: flex;
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 2px 2px 0 var(--line);
}
.header-search input[type="search"] {
  flex: 1;
  border: none;
  padding: 8px 14px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}
.header-search input::placeholder { color: var(--muted); }
.header-search button {
  border: none;
  background: var(--paper);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 16px;
  border-left: 2px solid var(--line);
}

.header-icons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  width: 38px; height: 38px;
  border: 2px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  position: relative;
  box-shadow: 2px 2px 0 var(--line);
  transition: transform .1s;
  color: var(--ink);
  text-decoration: none;
}
.icon-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--line);
  text-decoration: none;
}
.icon-btn .badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--accent-pink);
  color: #fff;
  border: 1.5px solid var(--line);
  border-radius: 2px;
  font-size: 10px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

/* ============================================
   LIVE SEARCH DROPDOWN
   ============================================ */
.header-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.live-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--paper);
  border: 2px solid var(--line);
  border-top: none;
  border-radius: 0 0 2px 2px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 999;
  box-shadow: 2px 4px 0 var(--ink);
}

.live-search-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  transition: background .1s;
}
.live-search-item:hover {
  background: var(--accent-soft-purple);
}
.live-search-item:last-child {
  border-bottom: none;
}

.live-search-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 1px solid var(--line);
  flex-shrink: 0;
  border-radius: 2px;
}

.live-search-thumb-empty {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  flex-shrink: 0;
  border-radius: 2px;
  background: var(--accent-soft-cyan);
  font-size: 20px;
}

.live-search-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.live-search-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.live-search-price {
  font-size: 12px;
  color: var(--accent-pink);
  font-weight: 600;
}

.live-search-item-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.live-search-all {
  display: block;
  padding: 12px 14px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--accent-soft-purple);
  border-top: 2px solid var(--line);
  text-decoration: none;
}
.live-search-all:hover {
  background: var(--accent-purple);
  color: #fff;
  text-decoration: none;
}

/* ============================================
   MEGA NAV
   ============================================ */
.mega-nav {
  background: var(--accent-soft-purple);
  border-bottom: 2px solid var(--line);
  padding: 10px 0;
}

.mega-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.category-pill {
  border: 2px solid var(--line);
  border-radius: 2px;
  padding: 5px 12px;
  background: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 500;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--line);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all .1s;
  color: var(--ink);
  text-decoration: none;
}
.category-pill:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--line);
  text-decoration: none;
}
.category-pill.active, .category-pill.current-cat {
  background: var(--accent-purple);
  color: #fff;
}

/* ============================================
   STICKY HEADER INTELIGENTE
   Solo desktop — en móvil sticky + will-change rompen el comportamiento
   ============================================ */
@media (min-width: 769px) {
  .site-header {
    transition: transform 0.3s ease, box-shadow 0.2s ease;
  }
  .site-header.tr-header-hidden {
    transform: translateY(-100%);
  }
  .site-header.tr-header-scrolled {
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
  }
}

/* ============================================
   LIVE SEARCH
   ============================================ */
.header-search-wrapper {
  position: relative;
}

.live-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--paper);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
  z-index: 9999;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 4px;
  border-radius: 2px;
}

.live-search-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s;
  gap: 12px;
}

.live-search-item:last-child {
  border-bottom: none;
}

.live-search-item:hover {
  background: var(--accent-yellow);
}

.live-search-thumb, .live-search-thumb-empty {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--muted);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.live-search-info {
  display: flex;
  flex-direction: column;
}

.live-search-name {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 4px;
}

.live-search-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent-purple);
  font-weight: bold;
}

.live-search-item-empty {
  padding: 16px;
  text-align: center;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--muted);
}

