/* ==========================================================================
   CERT.pl Alerty – front-end styles
   ========================================================================== */

:root {
	--cert-pl-bg: #1a1a2e;
	--cert-pl-accent: #e94560;
	--cert-pl-accent-hover: #ff6b81;
	--cert-pl-text: #eee;
	--cert-pl-muted: #a0a0b0;
	--cert-pl-modal-bg: #ffffff;
	--cert-pl-modal-text: #1a1a2e;
	--cert-pl-radius: 10px;
	--cert-pl-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
	--cert-pl-z-ticker: 99990;
	--cert-pl-z-modal: 100000;
}

/* ---------- Ticker ---------- */
.cert-pl-ticker {
	position: fixed;
	left: 0;
	right: 0;
	z-index: var(--cert-pl-z-ticker);
	display: flex;
	align-items: stretch;
	background: var(--cert-pl-bg);
	color: var(--cert-pl-text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
	height: 42px;
	overflow: hidden;
}

.cert-pl-ticker--top {
	top: 0;
}

.cert-pl-ticker--bottom {
	bottom: 0;
	top: auto;
}

/* Push body content when ticker is at top (admin bar aware) */
body.admin-bar .cert-pl-ticker--top {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .cert-pl-ticker--top {
		top: 46px;
	}
}

.cert-pl-ticker__label {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 14px;
	background: var(--cert-pl-accent);
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	white-space: nowrap;
}

.cert-pl-ticker__icon {
	font-size: 16px;
}

.cert-pl-ticker__track-wrap {
	flex: 1 1 auto;
	overflow: hidden;
	position: relative;
	mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}

.cert-pl-ticker__track {
	display: flex;
	align-items: center;
	height: 100%;
	width: max-content;
	animation: cert-pl-marquee linear infinite;
	/* duration set via JS based on content width + speed setting */
	animation-duration: 40s;
}

.cert-pl-ticker:hover .cert-pl-ticker__track {
	animation-play-state: paused;
}

@keyframes cert-pl-marquee {
	0%   { transform: translateX(0); }
	100% { transform: translateX(-50%); }
}

.cert-pl-ticker__item {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0 28px 0 12px;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.15s ease;
}

.cert-pl-ticker__item:hover,
.cert-pl-ticker__item:focus-visible {
	color: var(--cert-pl-accent-hover);
	outline: none;
}

.cert-pl-ticker__item-title {
	font-weight: 500;
}

.cert-pl-ticker__item-cat {
	font-size: 11px;
	padding: 2px 7px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.12);
	color: var(--cert-pl-muted);
}

.cert-pl-ticker__close {
	flex: 0 0 auto;
	width: 42px;
	border: 0;
	background: transparent;
	color: var(--cert-pl-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.15s;
}

.cert-pl-ticker__close:hover {
	color: #fff;
}

/* When ticker is closed by user */
.cert-pl-ticker.is-hidden {
	display: none !important;
}

/* ---------- Modal (chmurka) ---------- */
.cert-pl-modal {
	position: fixed;
	inset: 0;
	z-index: var(--cert-pl-z-modal);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.cert-pl-modal[hidden] {
	display: none !important;
}

.cert-pl-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 20, 0.65);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	cursor: pointer;
}

.cert-pl-modal__dialog {
	position: relative;
	z-index: 1;
	width: min(680px, 100%);
	max-height: min(85vh, 900px);
	display: flex;
	flex-direction: column;
	background: var(--cert-pl-modal-bg);
	color: var(--cert-pl-modal-text);
	border-radius: var(--cert-pl-radius);
	box-shadow: var(--cert-pl-shadow);
	overflow: hidden;
	animation: cert-pl-modal-in 0.22s ease-out;
}

@keyframes cert-pl-modal-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.cert-pl-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.06);
	color: #444;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
	transition: background 0.15s;
}

.cert-pl-modal__close:hover {
	background: rgba(0, 0, 0, 0.12);
}

.cert-pl-modal__header {
	padding: 20px 48px 12px 24px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.cert-pl-modal__badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 3px 9px;
	border-radius: 999px;
	background: #fde8ec;
	color: var(--cert-pl-accent);
	margin-bottom: 8px;
}

.cert-pl-modal__title {
	margin: 0 0 6px;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
}

.cert-pl-modal__date {
	font-size: 13px;
	color: #777;
}

.cert-pl-modal__body {
	padding: 16px 24px;
	overflow-y: auto;
	flex: 1 1 auto;
	font-size: 15px;
	line-height: 1.6;
}

.cert-pl-modal__body img {
	max-width: 100%;
	height: auto;
	border-radius: 6px;
	margin: 12px 0;
}

.cert-pl-modal__body a {
	color: var(--cert-pl-accent);
}

.cert-pl-modal__body table {
	width: 100%;
	margin: 12px 0;
}

.cert-pl-modal__footer {
	padding: 14px 24px 18px;
	border-top: 1px solid #eee;
	flex-shrink: 0;
	background: #fafafa;
}

.cert-pl-modal__link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-weight: 600;
	font-size: 14px;
	color: var(--cert-pl-accent);
	text-decoration: none;
}

.cert-pl-modal__link:hover {
	color: var(--cert-pl-accent-hover);
	text-decoration: underline;
}

.cert-pl-modal__credit {
	margin: 10px 0 0;
	font-size: 12px;
	color: #888;
}

.cert-pl-modal__credit a {
	color: inherit;
}

/* Body scroll lock when modal open */
body.cert-pl-modal-open {
	overflow: hidden;
}

/* ---------- List (shortcode) & Widget ---------- */
.cert-pl-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cert-pl-list__item {
	margin: 0;
}

.cert-pl-list__btn,
.cert-pl-widget-list__btn {
	display: block;
	width: 100%;
	text-align: left;
	padding: 12px 14px;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s;
	font: inherit;
	color: inherit;
}

.cert-pl-list__btn:hover,
.cert-pl-list__btn:focus-visible,
.cert-pl-widget-list__btn:hover,
.cert-pl-widget-list__btn:focus-visible {
	border-color: var(--cert-pl-accent);
	box-shadow: 0 2px 10px rgba(233, 69, 96, 0.12);
	outline: none;
}

.cert-pl-list__title,
.cert-pl-widget-list__title {
	display: block;
	font-weight: 600;
	font-size: 15px;
	margin-bottom: 4px;
}

.cert-pl-list__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 12px;
	color: #777;
	margin-bottom: 6px;
}

.cert-pl-list__cat {
	background: #fde8ec;
	color: var(--cert-pl-accent);
	padding: 1px 7px;
	border-radius: 999px;
	font-weight: 600;
}

.cert-pl-list__excerpt {
	margin: 0;
	font-size: 13px;
	color: #555;
	line-height: 1.45;
}

.cert-pl-widget-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cert-pl-widget-list__item {
	margin: 0 0 8px;
}

.cert-pl-widget-list__date {
	display: block;
	font-size: 12px;
	color: #888;
	margin-top: 2px;
}

.cert-pl-empty {
	color: #888;
	font-style: italic;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.cert-pl-ticker__track {
		animation: none !important;
	}
	.cert-pl-modal__dialog {
		animation: none;
	}
}

.cert-pl-modal__cve {
	margin-top: 10px;
	font-size: 13px;
	line-height: 1.5;
}
.cert-pl-modal__cve a {
	color: var(--cert-pl-accent);
	font-weight: 600;
	text-decoration: none;
}
.cert-pl-modal__cve a:hover {
	text-decoration: underline;
}
.cert-pl-modal__cve-mitre {
	font-weight: 400 !important;
	font-size: 11px;
	color: #888 !important;
}
.cert-pl-ticker__item-cat[data-cat="CVE"],
.cert-pl-list__cat {
	/* default ok */
}

/* NVD severity badges */
.cert-pl-sev {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	padding: 2px 8px;
	border-radius: 4px;
	background: #eee;
	color: #333;
}
.cert-pl-sev--critical { background: #7f1d1d; color: #fff; }
.cert-pl-sev--high     { background: #e94560; color: #fff; }
.cert-pl-sev--medium   { background: #f59e0b; color: #111; }
.cert-pl-sev--low      { background: #22c55e; color: #111; }
.cert-pl-sev--none     { background: #94a3b8; color: #fff; }
.cert-pl-modal__nvd-meta { margin-top: 8px; }
.cert-pl-nvd-status { font-size: 12px; color: #666; margin-left: 6px; }
.cert-pl-nvd-vector { margin-top: 4px; font-size: 11px; word-break: break-all; }
.cert-pl-nvd-notice { margin: 8px 0 0; font-size: 10px; color: #999; font-style: italic; }
