/**
 * ======================================================
 * ARCHIVO: hub-pages.css
 * UBICACIÓN: frontend/public/styles/
 * VERSIÓN: 2.2 — HU-061 buscador expandible en dos filas
 * ÚLTIMA ACTUALIZACIÓN: 2026-06-22
 *
 * 🎯 PROPÓSITO:
 * Estilos CSS del módulo `hub-pages`.
 *
 * ======================================================
 * 📋 REGLAS PARA PRODUCCIÓN:
 * ------------------------------------------------------
 * - Console.log marcados con // @strip se eliminan al generar build para cliente
 * - Esta cabecera se elimina al generar versión para cliente (documentación interna)
 *
 * ======================================================
 * 📋 HISTORIAL DE CAMBIOS:
 * ------------------------------------------------------
 * [2.2] - 2026-06-22
 *    ✅ HU-061: barra búsqueda ancha + botones auth en columna al abrir
 * [2.1] - 2026-06-17 20:00
 * ======================================================
 */

body.soluciones-home,
body.tramites-body.hub-aligned {
  --hub-accent: #1f4fd8;
  --hub-accent-dark: #163fc1;
  --hub-radius: 12px;
  --hub-max: 1180px;
  font-family: 'Poppins', system-ui, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  overflow-x: hidden;
  max-width: 100%;
}

body.soluciones-home img,
body.soluciones-home video,
body.soluciones-home svg {
  max-width: 100%;
  height: auto;
}

body.soluciones-home .bono-card-grid,
body.soluciones-home .featured-bonos-slider,
body.soluciones-home .catalog-productos-track {
  max-width: 100%;
}

/* ---------- Anular tema oscuro catálogo en TODAS las páginas hub ---------- */
body.soluciones-home .catalog-header.bonos-header,
body.soluciones-home .site-header.catalog-header {
  background: #ffffff !important;
  box-shadow: 0 1px 0 #e2e8f0, 0 4px 24px rgba(15, 23, 42, 0.06) !important;
  position: sticky;
  top: 0;
  z-index: 1000;
  overflow: visible;
}

body.soluciones-home .hub-header .header-inner {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 4px 8px;
  padding: 8px 16px;
  max-width: 1280px;
  margin: 0 auto;
  overflow: visible;
  position: relative;
  z-index: 1;
}

body.soluciones-home .hub-header .menu-toggle {
  flex-shrink: 0;
  grid-column: 1;
}

body.soluciones-home .hub-header .logo-wrap {
  flex-shrink: 0;
  grid-column: 2;
}

body.soluciones-home .hub-header .nav-main {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-wrap: nowrap;
  justify-content: center;
  grid-column: 3;
  justify-self: center;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.soluciones-home .hub-header .nav-main::-webkit-scrollbar {
  display: none;
}

body.soluciones-home .hub-header .logo-wrap img {
  height: clamp(40px, 7vw, 72px);
  width: auto;
  max-width: min(160px, 28vw);
  object-fit: contain;
}

body.soluciones-home .hub-header .menu-toggle {
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

/* Nav links — centrados entre logo y acciones */
body.soluciones-home .hub-header .nav-main,
body.soluciones-home .hub-header .nav-bonos-compact {
  justify-content: center !important;
}

body.soluciones-home .hub-header .nav-main a {
  color: #475569 !important;
  font-weight: 500;
  font-size: 0.76rem !important;
  padding: 6px 7px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

body.soluciones-home .hub-header .nav-main a::before {
  display: none !important;
}

body.soluciones-home .hub-header .nav-main a:hover {
  color: var(--hub-accent) !important;
  background: rgba(31, 79, 216, 0.08);
}

body.soluciones-home .hub-header .nav-main a[aria-current='page'] {
  color: var(--hub-accent) !important;
  background: rgba(31, 79, 216, 0.12);
  font-weight: 600;
}

/* Buscador colapsable — cerrado por defecto en HTML; solo .is-open despliega */
body.soluciones-home .hub-header .global-search-wrap.global-search-wrap--collapsible:not(.is-open) .global-search-field {
  position: absolute;
  top: 0;
  left: 46px;
  width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

body.soluciones-home .hub-header .global-search-wrap.global-search-wrap--collapsible:not(.is-open) input {
  width: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* Buscador colapsable — lupa fija en header; campo y lista flotan encima */
body.soluciones-home .hub-header .global-search-wrap,
body.soluciones-home .hub-header .bonos-search-wrap {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  margin: 0;
  flex-shrink: 0;
  overflow: visible;
  z-index: 1100;
}

body.soluciones-home .hub-header .global-search-wrap::before,
body.soluciones-home .hub-header .bonos-search-wrap::before {
  content: none !important;
  display: none !important;
}

body.soluciones-home .global-search-toggle {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

body.soluciones-home .global-search-toggle:hover,
body.soluciones-home .global-search-wrap.is-open .global-search-toggle {
  color: var(--hub-accent);
  border-color: var(--hub-accent);
  background: rgba(31, 79, 216, 0.06);
}

body.soluciones-home .global-search-field {
  position: absolute;
  top: 0;
  left: 46px;
  width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-width 0.22s ease, opacity 0.18s ease;
  z-index: 1;
}

body.soluciones-home .hub-header .global-search-wrap.is-open .global-search-field {
  width: min(260px, calc(100vw - 140px));
  max-width: min(260px, calc(100vw - 140px));
  opacity: 1;
  pointer-events: auto;
}

/* HU-061: búsqueda abierta — segunda fila ancha + auth apilado a la derecha */
body.soluciones-home .hub-header.hub-header--search-open .header-inner {
  grid-template-columns: auto auto 1fr;
  grid-template-rows: auto auto;
  row-gap: 10px;
}

body.soluciones-home .hub-header.hub-header--search-open .menu-toggle {
  grid-column: 1;
  grid-row: 1;
}

body.soluciones-home .hub-header.hub-header--search-open .logo-wrap {
  grid-column: 2;
  grid-row: 1;
}

body.soluciones-home .hub-header.hub-header--search-open .nav-main {
  grid-column: 3;
  grid-row: 1;
  justify-self: center;
  min-width: 0;
}

body.soluciones-home .hub-header.hub-header--search-open .header-actions {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 10px;
  align-items: start;
  width: 100%;
  margin-left: 0;
  flex-direction: row;
}

body.soluciones-home .hub-header.hub-header--search-open .global-search-wrap.is-open,
body.soluciones-home .hub-header.hub-header--search-open .bonos-search-wrap.is-open {
  grid-column: 1;
  grid-row: 1 / -1;
  align-self: center;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin-left: 0;
  z-index: 1100;
}

body.soluciones-home .hub-header.hub-header--search-open .global-search-field {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  opacity: 1;
  pointer-events: auto;
  overflow: visible;
  transition: opacity 0.18s ease;
}

body.soluciones-home .hub-header.hub-header--search-open .global-search-wrap.is-open .global-search-field {
  width: auto;
  max-width: none;
}

body.soluciones-home .hub-header.hub-header--search-open .header-actions .hub-auth-btn--outline,
body.soluciones-home .hub-header.hub-header--search-open .header-actions .bonos-btn-login {
  grid-column: 2;
  grid-row: 1;
  min-width: 108px;
  width: 100%;
}

body.soluciones-home .hub-header.hub-header--search-open .header-actions .hub-auth-btn--primary,
body.soluciones-home .hub-header.hub-header--search-open .header-actions .bonos-btn-register {
  grid-column: 2;
  grid-row: 2;
  min-width: 108px;
  width: 100%;
}

body.soluciones-home .hub-header.hub-header--search-open .header-actions #user-box {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
}

body.soluciones-home .hub-header.hub-header--search-open .global-search-wrap .global-search-results {
  left: 0;
  right: 0;
  width: 100%;
  min-width: 0;
  max-width: none;
}

body.soluciones-home .hub-header.hub-header--search-open .global-search-wrap input,
body.soluciones-home .hub-header.hub-header--search-open .bonos-search-wrap input {
  padding: 12px 18px;
  font-size: 0.98rem;
}

body.soluciones-home .hub-header .global-search-wrap .global-search-results {
  position: absolute;
  left: auto;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, calc(100vw - 32px));
  min-width: 280px;
  z-index: 5000;
  margin: 0;
}

body.soluciones-home .hub-header .global-search-wrap input,
body.soluciones-home .hub-header .bonos-search-wrap input {
  width: 100%;
  min-width: 0;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid #e2e8f0 !important;
  background: #fff !important;
  color: #0f172a !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}

body.soluciones-home .hub-header .global-search-wrap input::placeholder,
body.soluciones-home .hub-header .bonos-search-wrap input::placeholder {
  color: #94a3b8 !important;
  font-weight: 400;
}

body.soluciones-home .hub-header .global-search-wrap input:focus,
body.soluciones-home .hub-header .bonos-search-wrap input:focus {
  outline: none;
  border-color: var(--hub-accent) !important;
  box-shadow: 0 0 0 3px rgba(31, 79, 216, 0.15), 0 4px 16px rgba(31, 79, 216, 0.08) !important;
  background: #fff !important;
}

/* Legacy: reglas anteriores del buscador siempre visible */
body.soluciones-home .hub-header .global-search-wrap:not(.global-search-wrap--collapsible),
body.soluciones-home .hub-header .bonos-search-wrap:not(.global-search-wrap--collapsible) {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

body.soluciones-home .hub-header .global-search-wrap:not(.global-search-wrap--collapsible)::before,
body.soluciones-home .hub-header .bonos-search-wrap:not(.global-search-wrap--collapsible)::before {
  content: '🔍' !important;
  display: block !important;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
}

/* Botones auth — estilo hub (Microsoft-like) */
.hub-auth-btn,
body.soluciones-home .hub-header .bonos-btn-login,
body.soluciones-home .hub-header .bonos-btn-register {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, filter 0.2s;
  white-space: nowrap;
  min-width: 96px;
  line-height: 1.2;
}

.hub-auth-btn--outline,
body.soluciones-home .hub-header .bonos-btn-login {
  background: #ffffff !important;
  color: var(--hub-accent) !important;
  border: 2px solid var(--hub-accent) !important;
}

.hub-auth-btn--outline:hover,
body.soluciones-home .hub-header .bonos-btn-login:hover {
  background: rgba(31, 79, 216, 0.06) !important;
  transform: translateY(-1px);
}

.hub-auth-btn--primary,
body.soluciones-home .hub-header .bonos-btn-register {
  background: var(--hub-accent) !important;
  color: #ffffff !important;
  border: 2px solid transparent !important;
  box-shadow: 0 4px 14px rgba(31, 79, 216, 0.35);
}

.hub-auth-btn--primary:hover,
body.soluciones-home .hub-header .bonos-btn-register:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(31, 79, 216, 0.4);
}

body.soluciones-home .hub-header .header-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  flex-shrink: 0;
  margin-left: 0;
  grid-column: 4;
}

body.soluciones-home .hub-header .header-actions .global-search-wrap,
body.soluciones-home .hub-header .header-actions .bonos-search-wrap {
  flex-shrink: 0;
}

body.soluciones-home .hub-header #user-box .user-toggle {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Franja intro bajo header */
body.soluciones-home .soluciones-intro,
body.soluciones-home .hub-page-intro-strip {
  background: linear-gradient(135deg, rgba(31, 79, 216, 0.07) 0%, rgba(31, 79, 216, 0.02) 100%);
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 20px;
  text-align: center;
}

body.soluciones-home .soluciones-intro-inner,
body.soluciones-home .hub-page-intro-strip .hub-page-intro-inner {
  max-width: 720px;
  margin: 0 auto;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #334155;
}

body.soluciones-home .soluciones-intro-inner strong,
body.soluciones-home .hub-page-intro-strip strong {
  color: var(--hub-accent);
  font-weight: 600;
}

/* Hero interior unificado */
.hub-page-hero,
body.soluciones-home .proyectos-hero,
body.soluciones-home .requerimientos-hero,
body.soluciones-home .aliados-hero,
body.soluciones-home .tramites-hero,
body.soluciones-home .cg-hero {
  max-width: var(--hub-max);
  margin: 0 auto;
  padding: 32px 20px 16px;
  text-align: center;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.hub-page-hero h1,
body.soluciones-home .proyectos-hero h1,
body.soluciones-home .requerimientos-hero h1,
body.soluciones-home .aliados-hero h1,
body.soluciones-home .tramites-hero h1,
body.soluciones-home .cg-hero h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 10px;
}

.hub-page-lead,
body.soluciones-home .proyectos-lead,
body.soluciones-home .requerimientos-lead,
body.soluciones-home .aliados-lead,
body.soluciones-home .tramites-lead,
body.soluciones-home .cg-hero p {
  max-width: 680px;
  margin: 0 auto;
  color: #64748b;
  font-size: 1rem;
  line-height: 1.6;
}

.hub-page-main,
body.soluciones-home .proyectos-main,
body.soluciones-home .requerimientos-main,
body.soluciones-home .aliados-page-main,
body.soluciones-home .tramites-main,
body.soluciones-home .cg-main {
  max-width: var(--hub-max);
  margin: 0 auto;
  padding: 0 20px 56px;
}

/* Botones primarios en formularios / páginas */
body.soluciones-home .hub-btn,
body.soluciones-home .btn-primary,
body.soluciones-home .requerimientos-form button[type='submit'],
body.soluciones-home .tramites-otro .btn-secondary {
  font-family: inherit;
}

body.soluciones-home .requerimientos-form button[type='submit'],
body.soluciones-home .hub-btn-primary {
  background: var(--hub-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(31, 79, 216, 0.3);
}

body.soluciones-home .requerimientos-form button[type='submit']:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

/* Filtros tipo chip (proyectos, aliados, cursos) */
body.soluciones-home .proyectos-filter-btn.is-active,
body.soluciones-home .aliados-filter-btn.is-active,
body.soluciones-home .cg-chip.is-active {
  background: var(--hub-accent) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 14px rgba(31, 79, 216, 0.3);
}

/* Tarjetas contenido */
body.soluciones-home .requerimientos-form,
body.soluciones-home .cg-hero {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--hub-radius);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

body.soluciones-home .cg-hero {
  padding: 28px 24px;
  margin-top: 8px;
}

/* Bonos landing alineado */
body.soluciones-home .bonos-landing-main {
  background: transparent;
}

body.soluciones-home .bonos-page-header h2,
body.soluciones-home .soluciones-catalog-heading {
  color: #0f172a;
  font-weight: 700;
}

/* Footer coherente */
body.soluciones-home .site-footer.catalog-footer {
  background: #0f172a;
  border-top: 3px solid var(--hub-accent);
}

/* Trámites */
body.tramites-body.hub-aligned {
  background: #f8fafc;
}

body.tramites-body.hub-aligned .card-panel,
body.tramites-body.hub-aligned .tramites-grid article {
  border-radius: var(--hub-radius);
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

@media (max-width: 1024px) {
  body.soluciones-home .hub-header .header-inner {
    grid-template-columns: auto 1fr auto;
    row-gap: 8px;
  }

  body.soluciones-home .hub-header .logo-wrap {
    grid-column: 2;
  }

  body.soluciones-home .hub-header .header-actions {
    grid-column: 3;
    margin-left: 0;
  }

  body.soluciones-home .hub-header .global-search-wrap.is-open,
  body.soluciones-home .hub-header .bonos-search-wrap.is-open {
    width: auto;
  }

  body.soluciones-home .hub-header.hub-header--search-open .header-actions {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.soluciones-home .hub-header .nav-main:not(.open) {
    display: none;
  }

  body.soluciones-home .hub-header .nav-main.open {
    display: flex;
    flex-direction: column;
    grid-column: 1 / -1;
    grid-row: 2;
    overflow: visible;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 4px 0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    justify-self: stretch;
    justify-content: flex-start;
  }

  body.soluciones-home .hub-header.hub-header--search-open .nav-main.open {
    grid-row: 3;
  }

  body.soluciones-home .hub-header .nav-main.open a {
    padding: 12px 16px;
    border-radius: 0;
    width: 100%;
    font-size: 0.88rem !important;
  }
}

@media (max-width: 520px) {
  body.soluciones-home .hub-header .header-inner {
    padding: 8px 12px;
    gap: 6px;
  }

  body.soluciones-home .hub-header .logo-wrap img {
    max-width: min(120px, 32vw);
    height: clamp(36px, 8vw, 52px);
  }

  body.soluciones-home .hub-header .nav-main.open a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  body.soluciones-home .hub-page-main,
  body.soluciones-home .hub-page-hero,
  body.soluciones-home .bonos-landing-main,
  body.soluciones-home .catalog-categorias-bonos,
  body.soluciones-home .bonos-grid-section {
    padding-left: 12px;
    padding-right: 12px;
    max-width: 100%;
    box-sizing: border-box;
  }

  body.soluciones-home .featured-bonos-slider,
  body.soluciones-home .bonos-destacados-section .featured-bonos-slider {
    padding-left: 12px;
    padding-right: 12px;
  }

  body.soluciones-home .bonos-grid-4 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  body.soluciones-home .hub-header .header-actions {
    gap: 6px;
  }

  .hub-auth-btn,
  body.soluciones-home .hub-header .bonos-btn-login,
  body.soluciones-home .hub-header .bonos-btn-register {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  body.soluciones-home .hub-header.hub-header--search-open .global-search-wrap.is-open .global-search-field,
  body.soluciones-home .global-search-wrap.is-open .global-search-field {
    left: auto;
    right: auto;
    width: auto;
    max-width: none;
  }

  body.soluciones-home .hub-header.hub-header--search-open .global-search-wrap .global-search-results,
  body.soluciones-home .hub-header .global-search-wrap .global-search-results {
    left: 0;
    right: 0;
    min-width: 0;
    width: 100%;
  }
}
