/* ============================================================================
 * SOMNO · HEADER
 * ----------------------------------------------------------------------------
 * Estilos del header (barra superior + navegacion + megamenus).
 * Usa las variables de css/tokens.css. No define colores literales: todo via
 * var(--somno-...), para poder cambiar la paleta desde tokens.css.
 * ============================================================================ */

/* ---- Reset local del header ---- */
.somno-header * { box-sizing: border-box; }
.somno-header {
	font-family: var(--somno-font);
}

/* ============================================================
 * 1. BARRA SUPERIOR (horario + ubicacion + accesos)
 * ============================================================ */
.somno-topbar {
	background: var(--somno-navy);
	color: var(--somno-text-light);
	font-size: 13px;
	min-height: var(--somno-topbar-h);
}
.somno-topbar__inner {
	max-width: var(--somno-header-max);
	margin: 0 auto;
	padding: 0 20px;
	min-height: var(--somno-topbar-h);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.somno-topbar__info {
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
}
.somno-topbar__dot {
	width: 7px; height: 7px;
	border-radius: 50%;
	background: var(--somno-accent);
	display: inline-block;
	flex-shrink: 0;
}
.somno-topbar__links {
	display: flex;
	align-items: center;
	gap: 22px;
}
.somno-topbar__links a {
	color: var(--somno-text-light);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	transition: color 0.15s ease;
	white-space: nowrap;
}
.somno-topbar__links a:hover { color: var(--somno-text-invert); }

/* ============================================================
 * 2. BARRA DE NAVEGACION PRINCIPAL
 * ============================================================ */
.somno-nav {
	background: var(--somno-surface);
	border-bottom: 1px solid var(--somno-border);
	position: sticky;
	top: 0;
	z-index: 2500;
}
.somno-nav__inner {
	max-width: var(--somno-header-max);
	margin: 0 auto;
	padding: 0 20px;
	min-height: var(--somno-nav-h);
	display: flex;
	align-items: center;
	gap: 24px;
}

/* Logo */
.somno-nav__logo {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	text-decoration: none;
}
.somno-nav__logo img { display: block; height: 46px; width: auto; }

/* Menu principal */
.somno-menu {
	display: flex;
	align-items: center;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1;
}
.somno-menu__item { position: static; }
.somno-menu__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 14px;
	border-radius: var(--somno-radius-sm);
	color: var(--somno-primary-700);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	background: transparent;
	border: 0;
	transition: background 0.15s ease, color 0.15s ease;
	white-space: nowrap;
}
.somno-menu__link:hover,
.somno-menu__item.is-open .somno-menu__link {
	background: var(--somno-hover-bg);
	color: var(--somno-primary);
}
.somno-menu__caret {
	width: 0; height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	opacity: 0.6;
	transition: transform 0.15s ease;
}
.somno-menu__item.is-open .somno-menu__caret { transform: rotate(180deg); }

/* Acciones (telefono + reserva) */
.somno-nav__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
	margin-left: auto;
}
.somno-btn-phone {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px; height: 42px;
	border-radius: 50%;
	border: 1px solid var(--somno-border);
	color: var(--somno-primary);
	background: var(--somno-surface);
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease;
}
.somno-btn-phone:hover { background: var(--somno-hover-bg); border-color: var(--somno-primary); }
.somno-btn-phone svg { width: 18px; height: 18px; }

.somno-btn-reserva {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 20px;
	border-radius: var(--somno-radius-sm);
	background: var(--somno-accent);
	color: var(--somno-text-invert);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	transition: background 0.15s ease;
	white-space: nowrap;
}
.somno-btn-reserva:hover { background: var(--somno-accent-600); color: var(--somno-text-invert); }
.somno-btn-reserva svg { width: 16px; height: 16px; }

/* ============================================================
 * 3. MEGAMENUS
 * ============================================================ */
.somno-mega {
	position: absolute;
	left: 0; right: 0;
	top: 100%;
	background: var(--somno-surface);
	border-top: 1px solid var(--somno-border);
	box-shadow: var(--somno-shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
	z-index: 999;
}
.somno-menu__item.is-open .somno-mega {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.somno-mega__inner {
	max-width: var(--somno-header-max);
	margin: 0 auto;
	padding: 32px 20px 36px;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 32px;
}
.somno-mega__col h6 {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--somno-text-muted);
	margin: 0 0 14px;
}
.somno-mega__col h6 + h6 { margin-top: 18px; }
.somno-mega__link {
	display: block;
	padding: 8px 12px;
	margin: 0 -12px;
	border-radius: var(--somno-radius-sm);
	color: var(--somno-text);
	font-size: 14.5px;
	line-height: 1.35;
	text-decoration: none;
	transition: background 0.12s ease, color 0.12s ease;
}
.somno-mega__link:hover {
	background: var(--somno-hover-bg);
	color: var(--somno-primary);
}

/* ============================================================
 * 4. MOBILE
 * ============================================================ */
.somno-nav__toggle {
	display: none;
	width: 44px; height: 44px;
	border: 0;
	background: transparent;
	cursor: pointer;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	padding: 0;
	margin-left: auto;
}
.somno-nav__toggle span {
	display: block;
	height: 2px;
	width: 24px;
	background: var(--somno-primary-700);
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ============================================================
 * 4b. RANGO INTERMEDIO (992-1199px): el menu completo + boton reserva con texto
 * no caben y el boton se desbordaba a la derecha (scroll horizontal). Reducimos
 * gaps y compactamos el boton reserva a solo icono en este rango.
 * ============================================================ */
@media (min-width: 992px) and (max-width: 1199.98px) {
	.somno-nav__inner { gap: 10px; overflow: hidden; }
	.somno-menu { gap: 2px; min-width: 0; }
	.somno-menu__link { padding: 10px 10px; font-size: 14px; }
	.somno-nav__actions { gap: 8px; }
	/* Boton reserva solo icono para que quepa */
	.somno-btn-reserva {
		padding: 0;
		width: 42px;
		height: 42px;
		justify-content: center;
	}
	.somno-btn-reserva span { display: none; }
	.somno-btn-reserva svg { width: 18px; height: 18px; }
}

@media (max-width: 991.98px) {
	/* Topbar: en movil mostramos las sucursales (info) y ocultamos los accesos
	   largos, que se mueven a la barra fija inferior */
	.somno-topbar__info { display: flex; font-size: 12px; }
	.somno-topbar__links { display: none; }
	.somno-topbar__inner { justify-content: center; }
	.somno-nav__toggle { display: flex; }
	.somno-nav__actions { margin-left: 0; gap: 8px; }
	.somno-nav__inner { gap: 12px; }
	.somno-nav__logo img { height: 38px; }
	/* En movil el boton reserva se compacta (solo icono) para no romper el layout */
	.somno-btn-reserva {
		padding: 0;
		width: 42px;
		height: 42px;
		justify-content: center;
	}
	.somno-btn-reserva span { display: none; }
	.somno-btn-reserva svg { width: 18px; height: 18px; }

	.somno-menu {
		display: none;
		position: absolute;
		top: 100%;
		left: 0; right: 0;
		flex-direction: column;
		align-items: stretch;
		background: var(--somno-surface);
		border-top: 1px solid var(--somno-border);
		box-shadow: var(--somno-shadow);
		padding: 8px;
		gap: 0;
		max-height: calc(100vh - var(--somno-nav-h));
		overflow-y: auto;
	}
	.somno-nav.is-menu-open .somno-menu { display: flex; }

	.somno-menu__link { width: 100%; justify-content: space-between; padding: 14px 12px; }

	/* En mobile el megamenu se despliega inline (acordeon) */
	.somno-mega {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		border-top: 0;
		display: none;
	}
	.somno-menu__item.is-open .somno-mega { display: block; }
	.somno-mega__inner {
		grid-template-columns: 1fr;
		gap: 16px;
		padding: 8px 12px 20px;
	}
}

/* Controles de tamano de fuente (accesibilidad) que ya existian */
.somno-header .incSize { font-size: 18px !important; }

/* ============================================================
 * 5. MODAL DE CONTACTO (telefono / gclid) - nativo sin Bootstrap
 * ============================================================ */
.somno-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(20, 30, 50, 0.5);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 3000;
	padding: 20px;
}
.somno-modal-overlay.is-open { display: flex; }
.somno-modal {
	background: var(--somno-surface);
	border-radius: var(--somno-radius-lg);
	box-shadow: var(--somno-shadow);
	max-width: 400px;
	width: 100%;
	padding: 28px 24px 24px;
	position: relative;
	font-family: var(--somno-font);
	text-align: center;
}
.somno-modal__close {
	position: absolute;
	top: 12px; right: 14px;
	background: transparent;
	border: 0;
	font-size: 26px;
	line-height: 1;
	color: var(--somno-text-muted);
	cursor: pointer;
}
.somno-modal__close:hover { color: var(--somno-text); }
.somno-modal__title {
	font-size: 18px;
	font-weight: 700;
	color: var(--somno-text);
	margin: 0 0 12px;
}
.somno-modal__value {
	font-size: 22px;
	font-weight: 700;
	color: var(--somno-primary);
	margin: 0 0 8px;
}
.somno-modal__subtitle {
	font-size: 15px;
	color: var(--somno-text-muted);
	margin: 0 0 8px;
	line-height: 1.5;
}
.somno-modal__gclid { margin: 16px 0 4px; }
.somno-modal__gclid-label {
	font-size: 14px;
	font-weight: 600;
	color: var(--somno-text);
	margin: 0 0 8px;
}
.somno-modal__gclid-input {
	width: 220px;
	max-width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--somno-border);
	border-radius: var(--somno-radius-sm);
	font-size: 15px;
	text-align: center;
	outline: none;
}
.somno-modal__gclid-input:focus { border-color: var(--somno-primary); }
.somno-modal__gclid-error {
	font-size: 12px;
	color: #d33;
	margin: 6px 0 0;
}
.somno-modal__actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-top: 20px;
}
.somno-modal__btn {
	padding: 10px 22px;
	border-radius: var(--somno-radius-sm);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	border: 1px solid transparent;
	transition: background 0.15s ease;
}
.somno-modal__btn--primary {
	background: var(--somno-accent);
	color: var(--somno-text-invert);
}
.somno-modal__btn--primary:hover { background: var(--somno-accent-600); }
.somno-modal__btn--secondary {
	background: transparent;
	color: var(--somno-text-muted);
	border-color: var(--somno-border);
}
.somno-modal__btn--secondary:hover { background: var(--somno-hover-bg); }

/* Accesos rapidos dentro del menu movil (Valor / Presupuesto / Evaluacion) */
.somno-menu__access { display: none; }
@media (max-width: 991.98px) {
	.somno-menu__access {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 8px;
		padding: 12px 4px 16px;
		border-bottom: 1px solid var(--somno-border);
		margin-bottom: 8px;
	}
	.somno-menu__access a {
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		padding: 12px 8px;
		border-radius: var(--somno-radius-sm);
		background: var(--somno-hover-bg);
		color: var(--somno-primary-700);
		font-size: 13px;
		font-weight: 600;
		line-height: 1.25;
		text-decoration: none;
	}
	.somno-menu__access a:hover { background: var(--somno-border); }
}

/* ============================================================
 * 6 y 7 (bottombar + wa-float): MOVIDAS a footer.css
 * El HTML de esos componentes vive en footer.php, por eso su CSS
 * esta en footer.css (que es autonomo). Aqui se eliminaron para
 * evitar duplicacion y el body{padding-bottom} que dejaba franja blanca.
 * ============================================================ */

/* ============================================================
 * Legacy: ocultar el boton flotante viejo #fixedbutton "Reserve su hora"
 * (d-md-none, position fixed bottom). El diseno nuevo ya tiene la bottombar
 * (.somno-bottombar) con reserva/llamada/whatsapp, asi que este estorba y se
 * veia corrido sobre el footer en movil. Se oculta en todos los tamanos.
 * ============================================================ */
#fixedbutton { display: none !important; }

/* ============================================================
 * Blindaje: quitar subrayado en hover de todos los enlaces del header
 * (el style.css viejo aplica a:hover { text-decoration: underline })
 * ============================================================ */
.somno-topbar__links a:hover,
.somno-nav__logo:hover,
.somno-menu__link:hover,
.somno-mega__link:hover,
.somno-btn-phone:hover,
.somno-btn-reserva:hover,
.somno-menu__access a:hover,
.somno-bottombar__btn:hover,
.somno-wa-float:hover {
	text-decoration: none !important;
}
