/* ==========================================================================
   Centro de notificaciones: campana del encabezado + panel (escritorio) / hoja inferior (celular)
   Usa las variables del tema (--errd-*). Colores por tipo: En Vivo rojo, Noticias azul
   institucional, ERRD TV dorado.
   ========================================================================== */

.errd-notif-bell {
	position: relative;
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 50%;
	background: transparent;
	color: var(--errd-navy-deep, #071A42);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.errd-notif-bell:hover,
.errd-notif-bell[aria-expanded="true"] {
	background: var(--errd-gray-light, #F2F5FA);
	color: var(--errd-blue-inst, #063B82);
}

.errd-notif-bell:focus-visible,
.errd-notif-close:focus-visible,
.errd-notif-tabs button:focus-visible,
.errd-notif-item:focus-visible,
.errd-notif-foot a:focus-visible {
	outline: 3px solid var(--errd-blue-accent, #1E6BEB);
	outline-offset: 2px;
}

.errd-notif-bell.is-ring svg {
	animation: errd-notif-ring 0.9s ease both;
	transform-origin: 50% 4px;
}

.errd-notif-badge {
	position: absolute;
	top: 4px;
	right: 2px;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--errd-red-inst, #E5092D);
	color: #FFFFFF;
	font-size: 0.6875rem;
	font-weight: 800;
	line-height: 19px;
	text-align: center;
	box-shadow: 0 0 0 2px #FFFFFF;
	pointer-events: none;
}

.errd-notif-badge[hidden] {
	display: none;
}

.errd-notif-bell.is-ring .errd-notif-badge {
	animation: errd-notif-pop 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Telón de fondo: en celular oscurece; en escritorio solo captura el clic fuera */
.errd-notif-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1190;
	background: transparent;
}

.errd-notif-backdrop[hidden],
.errd-notif-panel[hidden] {
	display: none;
}

.errd-notif-panel {
	position: fixed;
	top: var(--nx-top, 72px);
	right: var(--nx-right, 16px);
	z-index: 1200;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 24px);
	max-height: min(640px, calc(100vh - var(--nx-top, 72px) - 16px));
	overflow: hidden;
	border-radius: var(--errd-radius-md, 12px);
	background: #FFFFFF;
	color: var(--errd-dark-text, #0F172A);
	box-shadow: 0 24px 60px rgba(7, 26, 66, 0.28), 0 0 0 1px rgba(7, 26, 66, 0.08);
	font-family: var(--errd-font-sans, system-ui, sans-serif);
	opacity: 0;
	transform: translateY(-8px) scale(0.98);
	transform-origin: top right;
	transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.errd-notif-panel.is-open {
	opacity: 1;
	transform: none;
}

.errd-notif-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 16px 8px 20px;
}

.errd-notif-head h2 {
	margin: 0;
	font-family: var(--errd-font-heading, inherit);
	font-size: 1.125rem;
	font-weight: 800;
	color: var(--errd-navy-deep, #071A42);
}

.errd-notif-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: -6px -4px -6px 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--errd-gray-muted, #64748B);
	cursor: pointer;
}

.errd-notif-close:hover {
	background: var(--errd-gray-light, #F2F5FA);
	color: var(--errd-navy-deep, #071A42);
}

.errd-notif-tabs {
	display: flex;
	gap: 6px;
	padding: 4px 16px 12px 20px;
	overflow-x: auto;
	scrollbar-width: none;
}

.errd-notif-tabs::-webkit-scrollbar {
	display: none;
}

.errd-notif-tabs button {
	flex: none;
	min-height: 36px;
	padding: 0 14px;
	border: 1px solid var(--errd-gray-border, #E2E8F0);
	border-radius: 999px;
	background: #FFFFFF;
	color: var(--errd-gray-dark, #334155);
	font: 700 0.8125rem/1 var(--errd-font-sans, system-ui, sans-serif);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.errd-notif-tabs button:hover {
	border-color: var(--errd-blue-inst, #063B82);
}

.errd-notif-tabs button.is-active {
	border-color: var(--errd-navy-deep, #071A42);
	background: var(--errd-navy-deep, #071A42);
	color: #FFFFFF;
}

.errd-notif-body {
	flex: 1 1 auto;
	min-height: 120px;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-top: 1px solid var(--errd-gray-border, #E2E8F0);
}

.errd-notif-body:focus {
	outline: none;
}

.errd-notif-item {
	position: relative;
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 12px 20px 12px 24px;
	border-bottom: 1px solid var(--errd-gray-border, #E2E8F0);
	color: inherit;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.errd-notif-item:hover {
	background: var(--errd-gray-light, #F2F5FA);
}

.errd-notif-item.is-new::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 9px;
	width: 8px;
	height: 8px;
	margin-top: -4px;
	border-radius: 50%;
	background: var(--errd-blue-accent, #1E6BEB);
}

.errd-notif-thumb {
	position: relative;
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	overflow: hidden;
	border-radius: 10px;
	background: var(--errd-gray-light, #F2F5FA);
	color: var(--errd-blue-inst, #063B82);
}

.errd-notif-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.errd-notif-main {
	flex: 1;
	min-width: 0;
}

.errd-notif-type {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.6875rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--errd-blue-inst, #063B82);
}

.errd-notif-item[data-tipo="vivo"] .errd-notif-type {
	color: var(--errd-red-inst, #E5092D);
}

.errd-notif-item[data-tipo="video"] .errd-notif-type,
.errd-notif-item[data-tipo="proximo"] .errd-notif-type {
	color: #8A6D12;
}

.errd-notif-pulse {
	position: relative;
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

.errd-notif-pulse::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: currentColor;
	animation: errd-notif-ping 1.6s ease-out infinite;
}

.errd-notif-title {
	display: -webkit-box;
	margin: 3px 0 2px;
	overflow: hidden;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--errd-dark-text, #0F172A);
}

.errd-notif-item.is-new .errd-notif-title {
	color: var(--errd-navy-deep, #071A42);
}

.errd-notif-meta {
	display: block;
	overflow: hidden;
	font-size: 0.8125rem;
	line-height: 1.4;
	color: var(--errd-gray-muted, #64748B);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.errd-notif-item[data-tipo="vivo"] {
	background: rgba(229, 9, 45, 0.05);
}

.errd-notif-item[data-tipo="vivo"] .errd-notif-thumb {
	box-shadow: 0 0 0 2px var(--errd-red-inst, #E5092D);
}

.errd-notif-item[data-tipo="video"] .errd-notif-thumb,
.errd-notif-item[data-tipo="proximo"] .errd-notif-thumb {
	color: #8A6D12;
	background: rgba(228, 195, 154, 0.35);
}

.errd-notif-empty {
	padding: 36px 28px 40px;
	text-align: center;
	color: var(--errd-gray-muted, #64748B);
}

.errd-notif-empty svg {
	margin-bottom: 8px;
	color: #C9A227;
}

.errd-notif-empty strong {
	display: block;
	margin-bottom: 4px;
	font-size: 1rem;
	color: var(--errd-navy-deep, #071A42);
}

.errd-notif-foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 16px;
	padding: 6px 12px;
	border-top: 1px solid var(--errd-gray-border, #E2E8F0);
	background: var(--errd-gray-light, #F2F5FA);
}

.errd-notif-foot a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 8px;
	font-size: 0.8125rem;
	font-weight: 700;
	color: var(--errd-blue-inst, #063B82);
	text-decoration: none;
}

.errd-notif-foot a:hover {
	text-decoration: underline;
}

.errd-notif-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

@keyframes errd-notif-ping {
	0% { transform: scale(0.8); opacity: 0.8; }
	100% { transform: scale(2.4); opacity: 0; }
}

@keyframes errd-notif-ring {
	0%, 100% { transform: rotate(0); }
	15% { transform: rotate(14deg); }
	35% { transform: rotate(-12deg); }
	55% { transform: rotate(8deg); }
	75% { transform: rotate(-5deg); }
}

@keyframes errd-notif-pop {
	0% { transform: scale(0.4); }
	60% { transform: scale(1.25); }
	100% { transform: scale(1); }
}

/* Debajo de 1024 px la campana queda pegada al botón de menú */
@media (max-width: 1023px) {
	.errd-notif-bell {
		margin-left: auto;
		margin-right: -4px;
	}
}

/* Celular: hoja inferior a ancho completo */
@media (max-width: 640px) {
	.errd-notif-backdrop {
		background: rgba(7, 26, 66, 0.45);
	}

	.errd-notif-panel {
		top: auto;
		right: 0;
		bottom: 0;
		left: 0;
		width: auto;
		max-width: none;
		max-height: 80vh;
		max-height: 80dvh;
		border-radius: 20px 20px 0 0;
		padding-bottom: env(safe-area-inset-bottom);
		transform: translateY(100%);
		transform-origin: bottom center;
	}

	.errd-notif-panel.is-open {
		transform: none;
	}

	.errd-notif-panel::before {
		content: "";
		display: block;
		flex: none;
		width: 40px;
		height: 4px;
		margin: 8px auto 0;
		border-radius: 4px;
		background: var(--errd-gray-border, #E2E8F0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.errd-notif-panel,
	.errd-notif-bell,
	.errd-notif-tabs button,
	.errd-notif-item {
		transition: none;
	}

	.errd-notif-bell.is-ring svg,
	.errd-notif-bell.is-ring .errd-notif-badge,
	.errd-notif-pulse::after {
		animation: none;
	}
}
