/* ============================================================================
   Go PetiA Shell 1.1 — revestimiento del header.

   Criterio de rediseño: una superficie sólida y segura de sí misma, con
   bloques bien definidos, en vez de pastillas flotando sobre nada.

   Prefijo body.has-gpshell en todo, para ganar especificidad sobre el tema
   sin recurrir a !important y para no filtrarse a otras pantallas.
   ========================================================================= */

/* Por defecto se respeta la tarjeta oscura que el tema ya diseñó: fondo #160b2d
   con los bloques de cuenta e idioma en blanco encima. Es el mismo patrón del
   header de Petify y funcionaba; lo que fallaba era la jerarquía dentro. */
body.has-gpshell {
	--gps-purple: #8b34a7;
	--gps-purple-soft: rgba(255, 255, 255, .12);
	--gps-gold: #e5c547;
	--gps-ink: #28162f;
	--gps-muted: #6f6b7d;
	--gps-line: rgba(255, 255, 255, .13);
	--gps-h: 72px;
	--gps-surface: #160b2d;
	--gps-on-surface: #fff;
	--gps-on-surface-soft: rgba(255, 255, 255, .70);
	--gps-block: #fff;
	--gps-block-line: #e5d9e9;
}

/* Variante de marca: morado de PetiA en vez del casi negro del tema. */
body.has-gpshell.gpshell-brand {
	--gps-surface: linear-gradient(180deg, #5b3fa5 0%, #432c80 100%);
}

/* Variante clara. Exige forzar el color del texto: el tema fija blanco en el
   nombre y en el estado, pensados para fondo oscuro. Omitir esto fue el error
   que dejó «admin1979» ilegible en la primera versión. */
body.has-gpshell.gpshell-light {
	--gps-purple: #5b3fa5;
	--gps-purple-soft: rgba(91, 63, 165, .10);
	--gps-line: rgba(26, 22, 37, .09);
	--gps-surface: #fff;
	--gps-on-surface: #28162f;
	--gps-on-surface-soft: #6f6b7d;
	--gps-block: #fff;
	--gps-block-line: #e5d9e9;
}

body.has-gpshell.gpshell-light .gp-chat__name strong,
body.has-gpshell.gpshell-light .gp-chat__identity small,
body.has-gpshell.gpshell-light .gp-specialist-chip b {
	color: var(--gps-on-surface);
}

body.has-gpshell.gpshell-light .gp-chat__mobile-action span {
	background: var(--gps-on-surface);
}

/* ---------------------------------------------------------------------------
   1. La superficie
   ------------------------------------------------------------------------ */

/* Se conserva la tarjeta flotante del tema: esquinas redondeadas y sombra.
   Fijarla al borde superior fue un error: al tener radio y margen laterales, el
   contenido de la página se colaba por los huecos y aparecían letras detrás. */
body.has-gpshell .gp-chat__head {
	position: relative;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: var(--gps-h);
	padding: .6rem .85rem;
	background: var(--gps-surface);
	border-bottom: 0;
	transition: min-height .18s ease, box-shadow .18s ease;
}

/* Fijarla sí es posible, pero entonces deja de ser tarjeta: esquinas rectas y
   ancho completo, o vuelve el problema de las letras al fondo. */
body.has-gpshell.gpshell-sticky .gp-chat__head {
	position: sticky;
	top: 0;
	z-index: 40;
	border-radius: 0;
	margin-left: calc(-1 * var(--gps-bleed, 0px));
	margin-right: calc(-1 * var(--gps-bleed, 0px));
	padding-left: calc(.85rem + var(--gps-bleed, 0px));
	padding-right: calc(.85rem + var(--gps-bleed, 0px));
	box-shadow: 0 6px 22px rgba(22, 11, 45, .18);
}

body.has-gpshell.gpshell-sticky.gpshell-shrink.is-scrolled .gp-chat__head {
	min-height: 60px;
}

/* ---------------------------------------------------------------------------
   2. Identidad. La marca nunca se trunca: si no cabe, se oculta entera.
   ------------------------------------------------------------------------ */

body.has-gpshell .gp-chat__identity {
	display: flex;
	align-items: center;
	gap: 11px;
	flex: 0 0 auto;
}

body.has-gpshell .gp-chat__brand-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	flex: 0 0 38px;
	background: rgba(255, 255, 255, .12);
}

body.has-gpshell .gp-chat__identity > div {
	flex: 0 0 auto;
	min-width: 0;
}

body.has-gpshell .gp-chat__name {
	display: flex;
	align-items: center;
	gap: 8px;
	line-height: 1.1;
	margin: 0;
}

body.has-gpshell .gp-chat__name strong {
	font-size: 1.06rem;
	font-weight: 700;
	letter-spacing: -.012em;
	color: var(--gps-on-surface);
	white-space: nowrap;
	max-width: none;
	overflow: visible;
	text-overflow: clip;
}

/* La insignia repite lo que ya dice el chip de especialista. */
body.has-gpshell.gpshell-nobadge .gp-chat__name > span {
	display: none;
}

/* Estado: una línea sobria bajo el nombre, no una frase decorativa. */
body.has-gpshell .gp-chat__identity small {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: .745rem;
	line-height: 1.25;
	color: var(--gps-on-surface-soft);
	white-space: nowrap;
	margin-top: 2px;
}

body.has-gpshell .gp-chat__identity small i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #22c58b;
	flex: 0 0 6px;
	display: inline-block;
	box-shadow: 0 0 0 3px rgba(34, 197, 139, .18);
}

/* ---------------------------------------------------------------------------
   3. Menú
   ------------------------------------------------------------------------ */

body.has-gpshell .gp-chat__mobile-action {
	width: 40px;
	height: 40px;
	border-radius: 12px;
	border: 0;
	background: var(--gps-purple-soft);
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	cursor: pointer;
	flex: 0 0 40px;
	transition: background .15s ease;
}

body.has-gpshell .gp-chat__mobile-action:hover {
	background: rgba(91, 63, 165, .18);
}

body.has-gpshell .gp-chat__mobile-action span {
	display: block;
	width: 17px;
	height: 2px;
	border-radius: 2px;
	background: var(--gps-on-surface);
}

/* ---------------------------------------------------------------------------
   4. Chip de especialista: sólo cuando deja de ser el general.
   ------------------------------------------------------------------------ */

body.has-gpshell .gp-specialist-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 6px 13px 6px 10px;
	border-radius: 999px;
	background: var(--gps-purple-soft);
	border: 0;
	line-height: 1.1;
	flex: 0 0 auto;
	animation: gps-in .2s ease;
}

body.has-gpshell.gpshell-smartchip .gp-specialist-chip[data-specialist="general"],
body.has-gpshell.gpshell-smartchip .gp-specialist-chip[data-specialist=""],
body.has-gpshell.gpshell-smartchip .gp-specialist-chip:not([data-specialist]) {
	display: none;
}

body.has-gpshell .gp-specialist-chip small {
	display: none;
}

body.has-gpshell .gp-specialist-chip b {
	font-size: .8rem;
	font-weight: 600;
	color: var(--gps-on-surface);
}

body.has-gpshell .gp-specialist-chip > span {
	font-size: .88rem;
	line-height: 1;
}

@keyframes gps-in {
	from { opacity: 0; transform: translateY(-3px); }
	to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------------
   5. Acciones. Bloques sólidos y bien definidos, no pastillas huecas.
   ------------------------------------------------------------------------ */

body.has-gpshell .gp-chat__head-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-left: auto;
	flex: 0 0 auto;
}

body.has-gpshell .gp-chat__head-actions .locale-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 42px;
	padding: 0 12px;
	border-radius: 12px;
	border: 1px solid var(--gps-block-line);
	background: var(--gps-block);
	cursor: pointer;
	line-height: 1;
	transition: box-shadow .15s ease;
}

body.has-gpshell .gp-chat__head-actions .locale-toggle:hover {
	box-shadow: 0 3px 12px rgba(26, 22, 37, .12);
}

body.has-gpshell.gpshell-compactlocale .gp-chat__head-actions .locale-toggle__meta small {
	display: none;
}

body.has-gpshell .gp-chat__head-actions .locale-toggle__meta {
	display: flex;
	flex-direction: column;
	line-height: 1;
}

body.has-gpshell .gp-chat__head-actions .locale-toggle__meta span {
	font-size: .82rem;
	font-weight: 600;
	color: var(--gps-ink);
	white-space: nowrap;
}

body.has-gpshell .gp-chat__head-actions .locale-toggle__flag {
	font-size: 1.15rem;
	line-height: 1;
}

body.has-gpshell .gp-chat__head-actions .locale-toggle__chevron {
	font-size: .58rem;
	color: var(--gps-muted);
}

/* Cuenta: el bloque con más peso, como en el header de Petify. */
body.has-gpshell .gp-chat__account {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 42px;
	padding: 0 14px 0 5px;
	border-radius: 12px;
	border: 1px solid var(--gps-block-line);
	background: var(--gps-block);
	cursor: pointer;
	transition: box-shadow .15s ease;
}

body.has-gpshell .gp-chat__account:hover {
	box-shadow: 0 3px 14px rgba(91, 63, 165, .18);
}

body.has-gpshell .gp-chat__account.is-guest {
	background: var(--gps-gold);
	border-color: transparent;
}

body.has-gpshell .gp-chat__account img,
body.has-gpshell .gp-chat__account [data-account-avatar-fallback] {
	width: 32px;
	height: 32px;
	border-radius: 9px;
	object-fit: cover;
	flex: 0 0 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--gps-purple-soft);
	font-size: .8rem;
	font-weight: 700;
	color: var(--gps-purple);
}

body.has-gpshell .gp-chat__account > span {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
	text-align: left;
	min-width: 0;
}

body.has-gpshell .gp-chat__account > span small {
	font-size: .68rem;
	font-weight: 500;
	color: var(--gps-muted);
	order: -1;
	white-space: nowrap;
}

body.has-gpshell .gp-chat__account > span b {
	font-size: .86rem;
	font-weight: 700;
	color: var(--gps-ink);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 15ch;
}

body.has-gpshell .gp-chat__account i {
	display: none;
}

body.has-gpshell .gp-chat__context-toggle {
	height: 42px;
	padding: 0 14px;
	border-radius: 12px;
	border: 1px solid var(--gps-block-line);
	background: var(--gps-block);
	color: var(--gps-ink);
	font-size: .82rem;
	font-weight: 600;
	cursor: pointer;
}

/* ---------------------------------------------------------------------------
   6. Móvil. Nada se trunca: lo que no cabe, se oculta completo.
   ------------------------------------------------------------------------ */

@media (max-width: 860px) {
	body.has-gpshell .gp-chat__identity small span {
		display: none;
	}
}

@media (max-width: 720px) {
	body.has-gpshell .gp-chat__head {
		gap: 10px;
		padding: 0 14px;
		min-height: 60px;
	}

	body.has-gpshell .gp-chat__head-actions .locale-toggle__meta,
	body.has-gpshell .gp-chat__head-actions .locale-toggle__chevron {
		display: none;
	}

	body.has-gpshell .gp-chat__head-actions .locale-toggle {
		width: 42px;
		padding: 0;
		justify-content: center;
	}

	body.has-gpshell .gp-chat__account {
		padding: 0 5px;
	}

	body.has-gpshell .gp-chat__account > span {
		display: none;
	}
}

/* Muy angosto: la marca escrita se retira y queda el avatar, que ya identifica. */
@media (max-width: 420px) {
	body.has-gpshell .gp-chat__identity > div {
		display: none;
	}

	body.has-gpshell .gp-chat__head {
		gap: 8px;
		padding: 0 12px;
	}
}

/* ---------------------------------------------------------------------------
   7. Modo app instalada
   ------------------------------------------------------------------------ */

@media (display-mode: standalone), (display-mode: minimal-ui), (display-mode: fullscreen) {
	body.has-gpshell.gpshell-appmode .gp-chat__head {
		min-height: 56px;
		padding-top: env(safe-area-inset-top);
		padding-left: max(16px, env(safe-area-inset-left));
		padding-right: max(16px, env(safe-area-inset-right));
	}

	body.has-gpshell.gpshell-appmode .gp-chat__head-actions .locale-selector {
		display: none;
	}
}

body.has-gpshell.gpshell-appmode.is-standalone .gp-chat__head {
	min-height: 56px;
	padding-top: env(safe-area-inset-top);
}

body.has-gpshell.gpshell-appmode.is-standalone .gp-chat__head-actions .locale-selector {
	display: none;
}

body.has-gpshell.gpshell-appmode.is-standalone .gp-chat-main {
	padding-bottom: env(safe-area-inset-bottom);
}

/* ---------------------------------------------------------------------------
   8. Accesibilidad
   ------------------------------------------------------------------------ */

body.has-gpshell .gp-chat__head button:focus-visible,
body.has-gpshell .gp-chat__head a:focus-visible {
	outline: 2px solid var(--gps-gold);
	outline-offset: 2px;
	border-radius: 12px;
}

@media (prefers-reduced-motion: reduce) {
	body.has-gpshell .gp-chat__head,
	body.has-gpshell .gp-specialist-chip,
	body.has-gpshell .gp-chat__account,
	body.has-gpshell .gp-chat__head-actions .locale-toggle {
		transition: none;
		animation: none;
	}
}

/* ============================================================================
   9. Fila de navegación secundaria.

   Es lo que convierte el header en algo que lleva a un lado, en vez de sólo
   anunciar quién eres. Sigue el patrón del header de Petify: una segunda banda
   con destinos reales y la puerta para negocios destacada al final.
   ========================================================================= */

body.has-gpshell .gps-nav {
	position: relative;
	z-index: 4;
	background: var(--gps-surface);
	border-radius: 0 0 20px 20px;
	margin-top: -14px;
	padding-top: 14px;
}

/* Con header fijo, la fila lo acompaña y ambas pierden el radio. */
body.has-gpshell.gpshell-sticky .gps-nav {
	position: sticky;
	top: var(--gps-h);
	z-index: 39;
	border-radius: 0;
	margin-top: 0;
	padding-top: 0;
	border-bottom: 1px solid var(--gps-line);
}

body.has-gpshell.gpshell-sticky.gpshell-shrink.is-scrolled .gps-nav {
	top: 60px;
}

body.has-gpshell .gps-nav__inner {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 20px 10px;
	overflow-x: auto;
	scrollbar-width: none;
}

body.has-gpshell .gps-nav__inner::-webkit-scrollbar {
	display: none;
}

body.has-gpshell .gps-nav__list {
	list-style: none;
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	flex: 1 1 auto;
}

body.has-gpshell .gps-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	border: 0;
	background: transparent;
	padding: 7px 12px;
	border-radius: 9px;
	font: inherit;
	font-size: .86rem;
	font-weight: 600;
	color: var(--gps-on-surface);
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s ease;
}

body.has-gpshell .gps-nav__link:hover {
	background: var(--gps-purple-soft);
}

body.has-gpshell .gps-nav__icon {
	font-size: .8rem;
	opacity: .75;
	line-height: 1;
}

/* La puerta para negocios: destacada, con dos líneas y flecha. */
body.has-gpshell .gps-nav__business {
	margin-left: 8px;
}

body.has-gpshell .gps-nav__link--business {
	gap: 10px;
	padding: 5px 12px 5px 14px;
	border-radius: 999px;
	background: var(--gps-gold);
	color: var(--gps-ink);
}

body.has-gpshell .gps-nav__link--business:hover {
	background: #d8b833;
}

body.has-gpshell .gps-nav__link--business span {
	display: flex;
	flex-direction: column;
	line-height: 1.15;
	text-align: left;
}

body.has-gpshell .gps-nav__link--business b {
	font-size: .84rem;
	font-weight: 700;
}

body.has-gpshell .gps-nav__link--business small {
	font-size: .68rem;
	font-weight: 600;
	opacity: .72;
}

body.has-gpshell .gps-nav__link--business i {
	font-style: normal;
	font-size: 1rem;
	line-height: 1;
}

/* Región: mismo lugar que el «Todo México» de Petify. */
body.has-gpshell .gps-nav__region {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	border: 0;
	background: transparent;
	padding: 7px 10px;
	border-radius: 9px;
	font: inherit;
	font-size: .82rem;
	font-weight: 600;
	color: var(--gps-on-surface-soft);
	cursor: pointer;
	white-space: nowrap;
	flex: 0 0 auto;
}

body.has-gpshell .gps-nav__region:hover {
	color: var(--gps-on-surface);
	background: var(--gps-purple-soft);
}

@media (max-width: 720px) {
	body.has-gpshell .gps-nav__inner {
		padding: 0 14px 9px;
		gap: 10px;
	}

	/* En móvil la región vive en el header y aquí sólo estorbaría. */
	body.has-gpshell .gps-nav__region {
		display: none;
	}

	body.has-gpshell .gps-nav__link--business small {
		display: none;
	}
}

/* En la app instalada hay barra de pestañas abajo: esta fila sobra. */
@media (display-mode: standalone), (display-mode: minimal-ui), (display-mode: fullscreen) {
	body.has-gpshell.gpshell-appmode .gps-nav {
		display: none;
	}
}

body.has-gpshell.gpshell-appmode.is-standalone .gps-nav {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	body.has-gpshell .gps-nav__link,
	body.has-gpshell .gps-nav__region {
		transition: none;
	}
}
