/* Header Styles */

/* Variables CSS para colores y espaciado */
:root {
	--header-bg: #ffffff;
	--header-text: #111827;
	--header-text-hover: #2563eb;
	--header-border: #e5e7eb;
	--header-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
	--header-blue: #2563eb;
	--header-blue-hover: #1d4ed8;
	--header-blue-light: #dbeafe;
	--header-gray-light: #f9fafb;
	--header-gray-medium: #6b7280;
	--header-gray-dark: #374151;
}

/* Header principal */
.site-header {
	position: relative;
	z-index: 50;
	background-color: var(--header-bg);
}

.header-container {
	width: 100%;
	padding: 1rem 1rem 0 1rem;
}

@media (min-width: 640px) {
	.header-container {
		padding-left: 1.5rem;
		padding-right: 1.5rem;
	}
}

@media (min-width: 768px) {
	.header-container {
		padding-left: 2rem;
		padding-right: 2rem;
	}
}

.header-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
	height: 4rem;
	padding-top: 1rem;
	padding-bottom: 1.5rem;
	padding-left: 1rem;
	padding-right: 1rem;
}

@media (min-width: 768px) {
	.header-content {
		height: 5rem;
		padding-bottom: 2.5rem;
		padding-left: 0;
		padding-right: 0;
	}
}

/* Logo y navegación izquierda */
.header-left {
	display: flex;
	align-items: center;
	gap: 1rem;
}

@media (min-width: 768px) {
	.header-left {
		gap: 1.5rem;
	}
}

@media (min-width: 1024px) {
	.header-left {
		gap: 2.5rem;
	}
}

.header-logo {
	display: flex;
	align-items: center;
}

.header-logo img {
	height: 2rem;
	width: auto;
}

@media (min-width: 768px) {
	.header-logo img {
		height: 2.5rem;
	}
}

@media (min-width: 1024px) {
	.header-logo img {
		height: 3rem;
	}
}

/* Navegación desktop */
.header-nav {
	display: none;
	align-items: center;
	gap: 2rem;
}

@media (min-width: 1280px) {
	.header-nav {
		display: flex;
		gap: 3rem;
	}
}

@media (min-width: 1536px) {
	.header-nav {
		gap: 3rem;
	}
}

.nav-item {
	position: relative;
}

.nav-link {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	color: var(--header-text);
	font-weight: 500;
	transition: color 0.15s ease-in-out;
	padding: 0.5rem 0;
	font-size: 0.875rem;
	text-decoration: none;
}

.nav-link:hover {
	color: var(--header-text-hover);
}

@media (min-width: 1536px) {
	.nav-link {
		font-size: 1rem;
	}
}

.nav-link.active {
	color: var(--header-text-hover);
}

/* Estilos para botones de navegación que solo abren dropdown */
.nav-link-button {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	color: var(--header-text);
	font-weight: 500;
	transition: color 0.15s ease-in-out;
	padding: 0.5rem 0;
	font-size: 0.875rem;
	text-decoration: none;
	background: none;
	border: none;
	cursor: pointer;
	font-family: inherit;
}

.nav-link-button:hover {
	color: var(--header-text-hover);
}

@media (min-width: 1536px) {
	.nav-link-button {
		font-size: 1rem;
	}
}

.nav-link-button.active {
	color: var(--header-text-hover);
}

.nav-chevron {
	width: 1rem;
	height: 1rem;
}

/* Dropdown menus */
.dropdown-menu {
	position: absolute;
	top: 100%;
	left: 0;
	background-color: var(--header-bg);
	border-radius: 0.5rem;
	box-shadow: var(--header-shadow);
	border: 1px solid var(--header-border);
	z-index: 50;
	padding-top: 0.5rem;
	max-width: calc(100vw - 72px);
	display: none; /* Ocultar dropdowns por defecto */
}

/* Clase para mostrar dropdown cuando se hace clic en botón */
.dropdown-menu.force-show {
	display: block !important;
}

.dropdown-content {
	padding: 1rem;
}

@media (min-width: 768px) {
	.dropdown-content {
		padding: 1.5rem;
	}
}

/* Mega menu para servicios */
.mega-menu {
	width: 50rem;
	margin: 0 auto;
}

@media (min-width: 1280px) {
	.mega-menu {
		width: 56.25rem;
	}
}

.mega-menu-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
	gap: 1rem;
}

@media (min-width: 768px) {
	.mega-menu-grid {
		gap: 1.5rem;
	}
}

/* Mega menú de noticias en dos columnas en desktop */
@media (min-width: 1024px) {
	.mega-menu-grid--two-cols {
		grid-template-columns: repeat(2, minmax(16rem, 1fr));
	}
}

@media (min-width: 1280px) {
	.mega-menu-grid {
		gap: 2rem;
	}
}

.mega-menu-item {
	display: block;
	padding: 0.5rem;
	border-radius: 0.5rem;
	transition: background-color 0.15s ease-in-out;
	text-decoration: none;
}

@media (min-width: 768px) {
	.mega-menu-item {
		padding: 0.75rem;
	}
}

.mega-menu-item:hover {
	background-color: var(--header-gray-light);
}

.mega-menu-title {
	font-weight: 600;
	color: var(--header-text);
	margin-bottom: 0.25rem;
	font-size: 0.875rem;
}

.mega-menu-item:hover .mega-menu-title {
	color: var(--header-text-hover);
}

@media (min-width: 768px) {
	.mega-menu-title {
		font-size: 1rem;
	}
}

.mega-menu-description {
	font-size: 0.75rem;
	color: var(--header-gray-medium);
	line-height: 1.5rem;
}

@media (min-width: 768px) {
	.mega-menu-description {
		font-size: 0.875rem;
	}
}

/* Dropdown regular */
.regular-dropdown {
	width: 32rem;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
	gap: 0.75rem;
}

@media (min-width: 768px) {
	.regular-dropdown {
		width: 36rem;
		gap: 1rem;
	}
}

.dropdown-item {
	display: block;
	padding: 0.5rem;
	border-radius: 0.5rem;
	transition: background-color 0.15s ease-in-out;
	text-decoration: none;
}

@media (min-width: 768px) {
	.dropdown-item {
		padding: 0.75rem;
	}
}

.dropdown-item:hover {
	background-color: var(--header-gray-light);
}

.dropdown-title {
	font-weight: 600;
	color: var(--header-text);
	margin-bottom: 0.25rem;
	font-size: 0.875rem;
}

.dropdown-item:hover .dropdown-title {
	color: var(--header-text-hover);
}

@media (min-width: 768px) {
	.dropdown-title {
		font-size: 1rem;
	}
}

.dropdown-description {
	font-size: 0.75rem;
	color: var(--header-gray-medium);
	line-height: 1.5rem;
}

/* Layout de una sola columna cuando está activo el menú hamburguesa (tablet/móvil) */
@media (max-width: 1279px) {
	/* Mega menús en una columna */
	.mega-menu-grid {
		grid-template-columns: 1fr;
		width: 100%;
	}

	/* Mega menú de noticias forzado también a una sola columna */
	.mega-menu-grid--two-cols {
		grid-template-columns: 1fr;
	}

	/* Dropdowns regulares en una columna */
	.regular-dropdown {
		width: 100%;
		grid-template-columns: 1fr;
	}
}

/* Mega menús en una columna en escritorios estrechos para que el desplegable baje en una sola columna */
@media (min-width: 1280px) and (max-width: 1535px) {
	.mega-menu-grid {
		grid-template-columns: 1fr;
		width: 100%;
	}

	.mega-menu-grid--two-cols {
		grid-template-columns: 1fr;
	}

	.regular-dropdown {
		width: 100%;
		grid-template-columns: 1fr;
	}
}

@media (min-width: 768px) {
	.dropdown-description {
		font-size: 0.875rem;
	}
}

/* Botones de acción */
.header-actions {
	display: none;
	align-items: center;
	gap: 1rem;
}

@media (min-width: 1280px) {
	.header-actions {
		display: flex;
		gap: 2rem;
	}
}

.search-button,
a.search-button,
.search-button:hover,
.search-button:focus,
.search-button:active {
	padding: 0.25rem;
	background: none;
	border: none;
	border-radius: 0.375rem;
	transition: background-color 0.15s ease-in-out;
	width: 3.5rem;
	height: 3.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	text-decoration: none !important;
}

.search-button:hover {
	background-color: var(--header-gray-light);
}

.action-button-primary,
a.action-button-primary {
	padding: 0.5rem 1rem;
	background-color: var(--header-blue);
	color: white;
	border: none;
	border-radius: 0.375rem;
	transition: background-color 0.15s ease-in-out;
	font-weight: 500;
	font-size: 0.875rem;
	cursor: pointer;
	text-decoration: none !important;
}

.action-button-primary:hover {
	background-color: var(--header-blue-hover);
}

@media (min-width: 1280px) {
	.action-button-primary {
		font-size: 1rem;
	}
}

.action-button-secondary,
a.action-button-secondary {
	padding: 0.5rem 1rem;
	border: 1px solid var(--header-blue);
	color: var(--header-blue);
	background: none;
	border-radius: 0.375rem;
	transition: background-color 0.15s ease-in-out;
	font-size: 0.875rem;
	cursor: pointer;
	text-decoration: none !important;
}

.action-button-secondary:hover {
	background-color: var(--header-blue-light);
}

@media (min-width: 1280px) {
	.action-button-secondary {
		font-size: 1rem;
	}
}

/* Botón menú móvil */
.mobile-menu-button {
	display: block;
}

@media (min-width: 1280px) {
	.mobile-menu-button {
		display: none;
	}
}

.mobile-menu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem;
	border-radius: 0.375rem;
	color: var(--header-gray-medium);
	background: none;
	border: none;
	transition: background-color 0.15s ease-in-out;
	cursor: pointer;
}

.mobile-menu-toggle:hover {
	background-color: var(--header-gray-light);
}

.mobile-menu-toggle:focus {
	outline: none;
	ring: 2px solid var(--header-blue);
	ring-inset: true;
}

.mobile-menu-icon {
	width: 1.5rem;
	height: 1.5rem;
}

/* Navegación móvil */
.mobile-nav {
	display: none;
	background-color: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(4px);
	border-radius: 0.5rem;
	margin-top: 0.5rem;
	box-shadow: var(--header-shadow);
	border: 1px solid var(--header-border);
}

.mobile-nav.open {
	display: block;
}

@media (min-width: 1280px) {
	.mobile-nav {
		display: none !important;
	}
}

.mobile-nav-content {
	padding: 1rem 1rem 1.5rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.mobile-nav-item {
	display: block;
}

.mobile-nav-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 0.5rem 1rem;
	color: var(--header-text);
	background: none;
	border: none;
	border-radius: 0.5rem;
	font-weight: 500;
	transition: color 0.15s ease-in-out;
	cursor: pointer;
	text-decoration: none;
}

.mobile-nav-link:hover {
	color: var(--header-text-hover);
}

.mobile-nav-link.active {
	color: var(--header-text-hover);
}

/* Estilos para cuando hay enlace y botón de dropdown juntos */
.mobile-nav-item > div {
	display: flex;
	align-items: center;
	width: 100%;
}

.mobile-nav-link-with-dropdown {
	flex: 1;
	justify-content: flex-start;
}

.mobile-nav-dropdown-toggle {
	width: auto;
	padding: 0.5rem;
	flex-shrink: 0;
}

.mobile-nav-chevron {
	width: 1rem;
	height: 1rem;
	transition: transform 0.15s ease-in-out;
}

.mobile-nav-chevron.rotated {
	transform: rotate(180deg);
}

.mobile-dropdown {
	margin-top: 0.5rem;
	margin-left: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* En el menú móvil, mostrar el desplegable en una sola columna debajo del título */
@media (max-width: 1279px) {
	.mobile-nav-item > div {
		flex-direction: column;
		align-items: stretch;
	}

	.mobile-dropdown {
		margin-left: 0;
		width: 100%;
	}
}

.mobile-dropdown-item {
	display: block;
	padding: 0.5rem 1rem;
	font-size: 0.875rem;
	color: var(--header-gray-medium);
	background: none;
	border: none;
	border-radius: 0.5rem;
	transition: all 0.15s ease-in-out;
	cursor: pointer;
	text-decoration: none;
	text-align: left;
}

.mobile-dropdown-item:hover {
	background-color: var(--header-gray-light);
	color: var(--header-text-hover);
}

.mobile-dropdown-title {
	font-weight: 500;
}

.mobile-dropdown-description {
	font-size: 0.75rem;
	color: var(--header-gray-dark);
	margin-top: 0.5rem;
}

/* Botones móviles */
.mobile-search-section {
	padding-top: 1rem;
	border-top: 1px solid var(--header-border);
}

.mobile-search-button {
	width: 100%;
	padding: 0.5rem 1rem;
	border: 1px solid var(--header-blue);
	color: var(--header-blue);
	background: none;
	border-radius: 0.5rem;
	font-weight: 500;
	transition: background-color 0.15s ease-in-out;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

.mobile-search-button:hover {
	background-color: var(--header-blue-light);
}

.mobile-actions-section {
	padding-top: 1rem;
	border-top: 1px solid var(--header-border);
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.mobile-action-button-primary {
	width: 100%;
	padding: 0.5rem 1rem;
	background-color: var(--header-blue);
	color: white;
	border: none;
	border-radius: 0.5rem;
	font-weight: 500;
	transition: background-color 0.15s ease-in-out;
	cursor: pointer;
}

.mobile-action-button-primary:hover {
	background-color: var(--header-blue-hover);
}

.mobile-action-button-secondary {
	width: 100%;
	padding: 0.5rem 1rem;
	border: 1px solid var(--header-blue);
	color: var(--header-blue);
	background: none;
	border-radius: 0.5rem;
	font-weight: 500;
	transition: background-color 0.15s ease-in-out;
	cursor: pointer;
}

.mobile-action-button-secondary:hover {
	background-color: var(--header-blue-light);
}

/* Utilidades para mostrar/ocultar elementos */
.hidden {
	display: none;
}

@media (min-width: 1280px) {
	.hidden-xl {
		display: none;
	}
}

/* Estados de hover para elementos interactivos */
.nav-item:hover .dropdown-menu {
	display: block;
}

/* Transiciones suaves */
* {
	transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

/* Header transparente en la home */
body.home .site-header,
body.front-page .site-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	background-color: transparent;
	transition: background-color 0.3s ease;
}

body.home .header-nav .nav-link,
body.front-page .header-nav .nav-link {
	color: #FFFFFF !important;
	background-color: transparent;
	border-style: none;
}

body.home .header-nav .nav-link svg,
body.front-page .header-nav .nav-link svg {
	color: #FFFFFF !important;
}

body.home .action-button-primary,
body.front-page .action-button-primary {
	color: #FFFFFF !important;
	background-color: #2563eb !important;
	border-color: #2563eb !important;
}

body.home .action-button-secondary,
body.front-page .action-button-secondary {
	color: #FFFFFF !important;
	border-color: #FFFFFF !important;
	background-color: transparent !important;
}

body.home .action-button-secondary:hover,
body.front-page .action-button-secondary:hover {
	background-color: rgba(255, 255, 255, 0.1) !important;
}

body.home .search-button svg path,
body.front-page .search-button svg path {
	stroke: #FFFFFF !important;
}

body.home .search-button:hover,
body.front-page .search-button:hover {
	background-color: rgba(0, 0, 0, 0.2) !important;
}

body.home .header-logo img,
body.front-page .header-logo img {
	filter: brightness(0) invert(1);
}

body.home .mobile-menu-icon,
body.home .mobile-menu-icon svg,
body.home .mobile-menu-icon svg path,
body.front-page .mobile-menu-icon,
body.front-page .mobile-menu-icon svg,
body.front-page .mobile-menu-icon svg path {
	color: #FFFFFF !important;
	stroke: #FFFFFF !important;
	fill: #FFFFFF !important;
}
