/*
 * Cabecera común con la web principal (réplica). Ver App\Core\SiteHeader.
 *
 * Hoja propia, sin Tailwind: así la réplica sigue igual aunque cambie el CSS
 * del comparador. Cada sitio define sus tokens en .sh--{clave}; los de
 * m4kers son los de src/index.css de m4kers.com (modo claro).
 * Las medidas copian las clases de pages/+Layout.tsx de m4kers.com.
 */
.sh {
  --sh-bg: hsl(40 30% 97%);
  --sh-fg: hsl(220 25% 12%);
  --sh-muted: hsl(220 10% 42%);
  --sh-primary: hsl(18 95% 54%);
  --sh-primary-fg: #fff;
  --sh-accent: hsl(200 85% 45%);
  --sh-accent-fg: #fff;
  --sh-secondary: hsl(220 15% 94%);
  --sh-mutedbg: hsl(40 15% 92%);
  --sh-border: hsl(220 13% 88%);
  --sh-popover: #fff;
  --sh-danger: hsl(0 75% 52%);
  --sh-radius: 8px;
  --sh-tile: linear-gradient(135deg, hsl(18 95% 54%) 0%, hsl(8 85% 50%) 100%);
  --sh-tile-shadow: 0 10px 40px -10px hsl(18 95% 54% / .25);
  --sh-font: 'Inter', system-ui, sans-serif;
  --sh-font-display: 'Space Grotesk', system-ui, sans-serif;

  position: relative;
  font-family: var(--sh-font);
  color: var(--sh-fg);
  -webkit-font-smoothing: antialiased;
}
/* La barra (el <header> que la envuelve): bg-background/80 + blur, como allí.
   Gana a «body > header» del tema del comparador por especificidad. */
.sh-header {
  background: hsl(40 30% 97% / .8);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid hsl(220 13% 88% / .5);
}
.sh *, .sh *::before, .sh *::after { box-sizing: border-box; }
.sh [hidden] { display: none !important; }

/* Caja común de las dos cabeceras: la del comparador (max-w-7xl = 1280px,
   px-4 sm:px-6). m4kers.com usa la misma en pages/+Layout.tsx.
   .sh-container es la misma caja para la franja del comparador. */
.sh-bar, .sh-container {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) { .sh-bar, .sh-container { padding: 0 1.5rem; } }
.sh-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  height: 64px;
}
@media (min-width: 1280px) { .sh-bar { gap: .75rem; } }

/* Marca */
.sh-brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: inherit; flex: none; }
.sh-tile {
  position: relative; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--sh-radius);
  background: var(--sh-tile); color: #fff; box-shadow: var(--sh-tile-shadow);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.sh-brand:hover .sh-tile { transform: scale(1.05); }
.sh-tile-ico { width: 20px; height: 20px; stroke-width: 2.5; }
.sh-word { font-family: var(--sh-font-display); font-size: 20px; line-height: 28px; font-weight: 700; letter-spacing: -.025em; }

/* Menú principal (≥1024px) */
.sh-nav { display: none; align-items: center; gap: .125rem; margin-left: .5rem; }
@media (min-width: 1024px) { .sh-nav { display: flex; } }
@media (min-width: 1280px) { .sh-nav { margin-left: .75rem; } }
.sh-link {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .5rem; border-radius: var(--sh-radius);
  font: 500 14px/20px var(--sh-font); color: var(--sh-muted);
  text-decoration: none; background: none; border: 0; cursor: pointer;
  transition: color .3s cubic-bezier(.4, 0, .2, 1);
}
@media (min-width: 1280px) { .sh-link { padding: .5rem .625rem; } }
.sh-link:hover, .sh-link[aria-expanded="true"] { color: var(--sh-primary); }
.sh-link.is-current { color: var(--sh-fg); }
.sh-link.is-current:hover { color: var(--sh-primary); }
/* Enlace destacado (Comparador): naranja, seminegrita y etiqueta de oferta. */
.sh-link.is-hot { color: var(--sh-primary); font-weight: 600; }
.sh-link.is-hot:hover, .sh-link.is-hot[aria-expanded="true"] { color: hsl(18 95% 54% / .8); }
.sh-link .sh-ico { width: 16px; height: 16px; flex: none; }
.sh-drawer-title.is-hot { display: flex; align-items: center; gap: .375rem; color: var(--sh-primary); }
.sh-drawer-title .sh-ico { width: 14px; height: 14px; }

/* Desplegables (como DropdownMenu de shadcn) */
.sh-dd { position: relative; }
.sh-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 60;
  width: 14rem; padding: .25rem;
  background: var(--sh-popover); color: var(--sh-fg);
  border: 1px solid var(--sh-border); border-radius: var(--sh-radius);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
}
.sh-menu--right { left: auto; right: 0; }
.sh-menu-item {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .375rem .5rem; border-radius: 6px;
  font: 400 14px/20px var(--sh-font); color: inherit; text-align: left;
  text-decoration: none; background: none; border: 0; cursor: pointer;
}
.sh-menu-item:hover, .sh-menu-item:focus-visible { background: var(--sh-accent); color: var(--sh-accent-fg); outline: none; }
.sh-menu-item .sh-ico { width: 16px; height: 16px; flex: none; }
.sh-menu-head { display: flex; flex-direction: column; gap: .25rem; padding: .375rem .5rem; border-bottom: 1px solid var(--sh-border); margin: 0 -.25rem .25rem; padding-left: .75rem; }
.sh-menu-head strong { font-size: 14px; line-height: 1; font-weight: 500; }
.sh-menu-head span { font-size: 12px; line-height: 1; color: var(--sh-muted); }
.sh-logout { color: var(--sh-danger); }

/* Buscador (≥1280px en la barra; en móvil, dentro del menú) */
.sh-search { position: relative; display: none; align-items: center; flex: 1; max-width: 28rem; margin-left: auto; }
@media (min-width: 1280px) { .sh-bar > .sh-search { display: flex; min-width: 6.5rem; } }
/* La lista no se estrecha con la caja: 24rem como mínimo, alineada a la derecha. */
.sh-bar > .sh-search .sh-suggest { left: auto; width: max(100%, 24rem); }
.sh-search--drawer { display: flex; max-width: none; margin: 0 0 1rem; }
.sh .sh-search input {
  width: 100%; padding: .5rem .75rem .5rem 2.25rem;
  font: 400 14px/20px var(--sh-font); color: var(--sh-fg);
  background: hsl(220 15% 94% / .5); border: 1px solid transparent; border-radius: var(--sh-radius);
  outline: none; transition: all .15s; -webkit-appearance: none; appearance: none;
}
.sh .sh-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.sh .sh-search input::placeholder { color: var(--sh-muted); }
.sh .sh-search input:focus { background: var(--sh-bg); box-shadow: 0 0 0 2px var(--sh-primary); }
.sh-search-ico { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--sh-muted); pointer-events: none; }

.sh-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 100;
  background: var(--sh-bg); border: 1px solid var(--sh-border); border-radius: var(--sh-radius);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
  overflow: hidden;
}
.sh-suggest-list { max-height: 22rem; overflow-y: auto; padding: .25rem 0; margin: 0; list-style: none; }
.sh-sg {
  display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem;
  color: inherit; text-decoration: none; transition: background-color .15s;
}
.sh-sg:hover, .sh-sg.is-active { background: hsl(220 15% 94% / .5); }
.sh-sg.is-active { background: var(--sh-secondary); }
.sh-sg-img { width: 40px; height: 40px; flex: none; border-radius: 4px; object-fit: cover; background: var(--sh-mutedbg); }
.sh-sg-img--contain { object-fit: contain; background: #fff; border: 1px solid var(--sh-border); }
.sh-sg-img--round { border-radius: 9999px; }
.sh-sg-img--initial { display: grid; place-items: center; font: 600 15px/1 var(--sh-font-display); color: var(--sh-muted); }
.sh-sg-text { flex: 1; min-width: 0; }
.sh-sg-title { margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-sg-sub { margin: 0; font-size: 12px; line-height: 16px; color: var(--sh-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-sg-sub b { color: var(--sh-fg); font-weight: 600; }
.sh-sg-tag { flex: none; padding: .125rem .5rem; font-size: 12px; line-height: 16px; color: var(--sh-muted); background: var(--sh-mutedbg); border-radius: 4px; }
.sh-sg-tag--cmp { color: hsl(18 80% 38%); background: hsl(25 100% 94%); }
.sh-suggest-msg { padding: .75rem 1rem; text-align: center; font-size: 14px; color: var(--sh-muted); }
.sh-suggest-all { display: block; padding: .5rem .75rem; text-align: center; font-size: 14px; font-weight: 500; color: var(--sh-primary); text-decoration: none; border-top: 1px solid var(--sh-border); }
.sh-suggest-all:hover { background: hsl(220 15% 94% / .5); }

/* Acciones de la derecha */
.sh-actions { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex: none; }
@media (min-width: 1280px) { .sh-actions { gap: .5rem; margin-left: .5rem; } }
.sh-slot { display: none; }
@media (min-width: 1280px) { .sh-slot { display: block; width: 40px; height: 40px; flex: none; } }
.sh-account { display: flex; align-items: center; gap: .25rem; }
@media (min-width: 1280px) { .sh-account { gap: .5rem; } }
.sh-btn {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  height: 36px; padding: 0 1rem; border-radius: var(--sh-radius);
  font: 500 14px/20px var(--sh-font); text-decoration: none; border: 0; cursor: pointer;
  transition: all .3s cubic-bezier(.4, 0, .2, 1);
}
.sh-btn--ghost { color: var(--sh-fg); background: transparent; }
.sh-btn--ghost:hover { background: var(--sh-accent); color: var(--sh-accent-fg); }
.sh-btn--primary { color: var(--sh-primary-fg); background: var(--sh-primary); }
.sh-btn--primary:hover { background: hsl(18 95% 54% / .9); }
.sh-btn--block { display: flex; width: 100%; margin-top: .25rem; height: auto; padding: .75rem; }
.sh-login { display: none; }
@media (min-width: 640px) { .sh-login { display: inline-flex; } }
/* Entre 1024 y 1279 el menú completo no deja sitio: solo «Crear cuenta». */
@media (min-width: 1024px) and (max-width: 1279px) { .sh-login { display: none; } }
.sh-account[data-state="user"] .sh-login, .sh-account[data-state="user"] .sh-register { display: none; }

.sh-icon-btn { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--sh-fg); background: none; border: 0; border-radius: var(--sh-radius); cursor: pointer; }
.sh-icon-btn:hover { background: var(--sh-accent); color: var(--sh-accent-fg); }
.sh-icon-btn .sh-ico { width: 20px; height: 20px; }
@media (min-width: 1024px) { .sh-burger { display: none; } }

.sh-avatar {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0; overflow: hidden;
  border: 0; border-radius: 9999px; cursor: pointer;
  background: var(--sh-tile); color: #fff; font: 600 14px/1 var(--sh-font-display);
}
.sh-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Menú móvil (Sheet de shadcn, lado derecho, w-72) */
.sh-drawer { position: fixed; inset: 0; z-index: 70; }
.sh-drawer-back { position: absolute; inset: 0; background: rgb(0 0 0 / .8); animation: sh-fade .2s ease-out; }
.sh-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 18rem; max-width: 85vw;
  padding: 1.5rem; padding-top: 3.5rem; overflow-y: auto;
  background: var(--sh-bg); border-left: 1px solid var(--sh-border);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1);
  animation: sh-slide .3s ease-out;
}
.sh-drawer-close { position: absolute; top: .75rem; right: .75rem; width: 32px; height: 32px; color: var(--sh-muted); }
.sh-drawer-close .sh-ico { width: 16px; height: 16px; }
.sh-drawer-nav { display: flex; flex-direction: column; gap: .25rem; }
.sh-drawer-link {
  display: flex; align-items: center; gap: .5rem; padding: .75rem; border-radius: var(--sh-radius);
  font: 500 16px/24px var(--sh-font); color: var(--sh-fg); text-decoration: none;
  background: none; border: 0; text-align: left; cursor: pointer; width: 100%;
}
.sh-drawer-link:hover, .sh-drawer-sub:hover { background: var(--sh-secondary); }
.sh-drawer-link .sh-ico { width: 16px; height: 16px; }
.sh-drawer-link.is-danger { color: var(--sh-danger); }
.sh-drawer-title { margin: 0; padding: .75rem .75rem .25rem; font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--sh-muted); }
.sh-drawer-sub { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border-radius: var(--sh-radius); font-size: 14px; line-height: 20px; color: var(--sh-fg); text-decoration: none; }
.sh-drawer-sub .sh-ico { width: 16px; height: 16px; }
.sh-drawer-sep { border-top: 1px solid var(--sh-border); margin: .75rem 0; }
.sh-drawer-account { display: flex; flex-direction: column; gap: .25rem; }
.sh-drawer-account[data-state="user"] .sh-guest-only { display: none; }

@keyframes sh-fade { from { opacity: 0; } }
@keyframes sh-slide { from { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .sh-drawer-back, .sh-drawer-panel { animation: none; }
}

/* Franja del comparador (views/partials/comparador_subbar.php): las
   categorías se desplazan en horizontal en móvil, sin barra visible. */
.cmp-subbar-cats { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cmp-subbar-cats::-webkit-scrollbar { display: none; }
