/* ═══════════════════════════════════════════
   Tema v4 (Comercial) — encabezado y pie
   Lo carga templates/shared/header-v4.php, así que aplica en todas las páginas de una tienda v4.
   Prefijos: v4h- (encabezado) · v4f- (pie)
═══════════════════════════════════════════ */

:root {
  --v4-ink: #111827;
  --v4-ink-2: #374151;
  --v4-muted: #6b7280;
  --v4-line: #e5e7eb;
  --v4-soft: #f4f4f6;
  --v4-accent: var(--color-primario, #4260dc);
  --v4-accent-soft: color-mix(in srgb, var(--v4-accent) 9%, #ffffff);
  --v4-sale: #d82c49;
  --v4-sale-ink: #b4233b;
  --v4-sale-soft: #fdecef;
  --v4-ok: #0f6b3a;
  --v4-ok-soft: #e6f6ec;
  --v4-wa: #128c4a;
  --v4-radius: 14px;
  --v4-wrap: 1320px;
  --v4-shadow: 0 2px 10px rgba(17, 24, 39, 0.05);
  --v4-shadow-hover: 0 6px 20px rgba(17, 24, 39, 0.09);
  --v4-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.v4-lock {
  overflow: hidden;
}

/* ── Franja superior ── */
.v4h-announce {
  background: var(--v4-ink);
  color: #ffffff;
  font-family: var(--v4-font);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  padding: 9px 16px;
}

.v4h-announce strong {
  font-weight: 700;
}

/* ── Encabezado ── */
.v4h {
  position: sticky;
  top: 0;
  z-index: 900;
  background: #ffffff;
  border-bottom: 1px solid var(--v4-line);
  font-family: var(--v4-font);
  color: var(--v4-ink);
}

.v4h *,
.v4h *::before,
.v4h *::after,
.v4h-chips,
.v4h-chips * {
  box-sizing: border-box;
}

.v4h a {
  color: inherit;
  text-decoration: none;
}

.v4h-bar {
  max-width: var(--v4-wrap);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.v4h-burger {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--v4-ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.v4h-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
}

.v4h-brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.v4h-brand-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v4h-search {
  flex: 1 1 320px;
  max-width: 620px;
  margin: 0 auto;
  height: 48px;
  display: flex;
  align-items: stretch;
  padding: 0;
  border: 1.5px solid var(--v4-ink);
  border-radius: 10px;
  background: #ffffff;
  font: inherit;
  cursor: text;
  overflow: hidden;
}

.v4h-search-text {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  color: var(--v4-muted);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
}

.v4h-search-btn {
  display: flex;
  align-items: center;
  padding: 0 22px;
  background: var(--v4-accent);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
}

.v4h-icons {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.v4h-icon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 48px;
  min-height: 48px;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--v4-ink);
}

.v4h-icon:hover {
  background: var(--v4-soft);
}

.v4h-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.v4h-badge,
body .v4h .cpt-notification-badge {
  position: absolute;
  top: 2px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--v4-sale);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.v4h-badge:empty {
  display: none !important;
}

/* Menú de la tienda (computadora) */
.v4h-nav {
  max-width: var(--v4-wrap);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
}

.v4h-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0 13px;
  border: 0;
  border-bottom: 2.5px solid transparent;
  background: none;
  font: inherit;
  color: var(--v4-ink);
  cursor: pointer;
  white-space: nowrap;
}

.v4h-link:hover {
  color: var(--v4-accent);
}

.v4h-link.is-active {
  color: var(--v4-accent);
  border-bottom-color: var(--v4-accent);
}

.v4h-link--sale,
.v4h-link--sale:hover {
  color: var(--v4-sale-ink);
}

.v4h-link--sale.is-active {
  border-bottom-color: var(--v4-sale);
}

.v4h-cats {
  position: relative;
  margin-left: auto;
}

.v4h-mega {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 950;
  min-width: 300px;
  max-width: min(760px, 90vw);
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--v4-line);
  border-radius: var(--v4-radius);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.v4h-mega.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.v4h-mega-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 24px;
}

.v4h-mega-col {
  display: flex;
  flex-direction: column;
}

.v4h-mega-title {
  margin: 4px 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--v4-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.v4h-mega-link {
  padding: 7px 0;
  font-size: 14px;
  font-weight: 500;
}

.v4h-mega-link:hover {
  color: var(--v4-accent);
}

.v4h-mega-all {
  display: block;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--v4-line);
  font-size: 14px;
  font-weight: 700;
}

/* Celular: buscador y categorías (ocultos en computadora) */
.v4h-msearch-wrap,
.v4h-chips {
  display: none;
}

.v4h-msearch {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--v4-soft);
  color: var(--v4-muted);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: text;
}

.v4h-chips {
  gap: 8px;
  overflow-x: auto;
  padding: 12px 12px;
  background: #ffffff;
  font-family: var(--v4-font);
  scrollbar-width: none;
}

.v4h-chips::-webkit-scrollbar {
  display: none;
}

.v4h-chip {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  background: var(--v4-soft);
  color: var(--v4-ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.v4h-chip--sale {
  background: var(--v4-sale-soft);
  color: var(--v4-sale-ink);
}

.v4h-chip.is-active {
  background: var(--v4-ink);
  color: #ffffff;
}

@media (max-width: 1023px) {
  .v4h-announce {
    font-size: 12px;
    padding: 8px 12px;
  }

  .v4h-announce-extra,
  .v4h-search,
  .v4h-nav,
  .v4h-icon-label,
  .v4h-icon--fav {
    display: none;
  }

  .v4h-bar {
    padding: 6px 8px;
    gap: 4px;
  }

  .v4h-burger {
    display: flex;
  }

  .v4h-brand {
    flex: 1;
    gap: 8px;
  }

  .v4h-brand-logo {
    width: 30px;
    height: 30px;
  }

  .v4h-brand-name {
    font-size: 18px;
  }

  .v4h-icon {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
  }

  .v4h-badge,
  body .v4h .cpt-notification-badge {
    top: 3px;
    right: 1px;
  }

  .v4h-msearch-wrap {
    display: block;
    padding: 0 12px 10px;
  }

  .v4h-chips {
    display: flex;
  }
}

/* ── Pie ── */
.v4f {
  margin-top: 0;
  background: var(--v4-ink);
  color: #ffffff;
  font-family: var(--v4-font);
}

.v4f *,
.v4f *::before,
.v4f *::after {
  box-sizing: border-box;
}

.v4f a {
  color: #d1d5db;
  text-decoration: none;
}

.v4f a:hover {
  color: #ffffff;
}

.v4f-inner {
  max-width: var(--v4-wrap);
  margin: 0 auto;
  padding: 56px 24px 40px;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 40px;
}

.v4f-brand {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.v4f .v4f-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-size: 19px;
  font-weight: 800;
}

.v4f-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 8px;
  padding: 3px;
}

.v4f-slogan {
  margin: 0;
  max-width: 300px;
  color: #d1d5db;
  font-size: 14px;
  line-height: 1.6;
}

.v4f-social {
  display: flex;
  gap: 10px;
}

.v4f .v4f-social a {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #374151;
  display: flex;
  align-items: center;
  justify-content: center;
}

.v4f-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
}

.v4f-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.v4f-bottom {
  border-top: 1px solid #1f2937;
}

.v4f-bottom-inner {
  max-width: var(--v4-wrap);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #9ca3af;
}

@media (max-width: 1023px) {
  .v4f-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 40px 16px 28px;
    gap: 32px 20px;
  }

  .v4f-brand {
    grid-column: 1 / -1;
  }

  .v4f-bottom-inner {
    padding: 16px;
  }
}

/* Punto de notificaciones sin leer sobre "Mi cuenta" */
.v4h-dot {
  position: absolute;
  top: 6px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--v4-sale);
  box-shadow: 0 0 0 2px #ffffff;
}
