/* style.css — v67 */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}
body {
	font-family: Arial, sans-serif;
	padding: 20px;
	padding-top: 55px; /* plass til fast topplinje */
	height: 100dvh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.language-selector {
	position: fixed;
	top: 0;
	left: 0;    /* posisjonering av fast boks — ikke logisk retning */
	right: 0;   /* posisjonering av fast boks — ikke logisk retning */
	z-index: 100;
	background: #fff;
	border-bottom: 1px solid #ddd;
	padding: 8px 20px;
	display: flex;
	flex-direction: row;
	direction: ltr;            /* frys rekkefølge uansett RTL på html */
	justify-content: flex-end;
	align-items: center;
	gap: 4px;
}
/* Interface-språkknapper øverst — aktiv markering */
.language-selector button {
	padding: 5px 12px;
	border: 1px solid #ccc;
	background: #f0f0f0;
	cursor: pointer;
	font-size: 0.85em;
	border-radius: 4px;
	margin-inline-start: 4px; /* direction:ltr på parent, så inline-start = left */
}
.language-selector button.active {
	background: #2980b9;
	color: #fff;
	border-color: #2980b9;
}
.language-selector button:hover:not(.active) {
	background: #e0e0e0;
}
.container {
	display: flex;
	gap: 20px;
	flex: 1;
	min-height: 0; /* viktig: lar flex-barn krympe under innholdshøyde */
	overflow: hidden;
}
.left-panel {
	flex: 0 0 auto;
	border: 1px solid #ccc;
	padding: 15px;
	overflow-y: auto;
}
.center-panel {
	flex: 2;
	border: 1px solid #ccc;
	padding: 15px;
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	position: relative;
}
.right-panel {
	flex: 1;
	border: 1px solid #ccc;
	padding: 15px;
	overflow-y: auto;
}
.source-item {
	display: flex;
	align-items: center;
	margin-bottom: 10px;
	padding: 10px;
	border: 1px solid #ddd;
}
.source-item img {
	width: 16px;
	height: 16px;
	margin-inline-end: 10px;
}
.source-item span:not(.status-lamp) {
	flex: 1;
}
.source-item button {
	margin-inline-start: 5px;
	padding: 5px 10px;
	cursor: pointer;
}
/* ubrukt: .btn-move-up, .btn-move-down */
.paywall-icon {
	cursor: help;
	position: relative;
}
.paywall-icon::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: 100%;
	left: 50%;                   /* sentrering av tooltip — ikke logisk retning */
	transform: translateX(-50%);
	background: #333;
	color: #fff;
	padding: 5px 10px;
	border-radius: 4px;
	white-space: nowrap;
	font-size: 12px;
	z-index: 1000;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s;
}
.paywall-icon:hover::after {
	opacity: 1;
}
.add-source {
	margin-top: 15px;
}
.add-source button {
	width: 100%;
	padding: 10px;
	cursor: pointer;
	margin-bottom: 10px;
}
.btn-restore-sources {
	background: #f0f0f0;
}
.schedule-section {
	margin-top: 10px;
	margin-bottom: 20px;
	padding-bottom: 20px;
	border-bottom: 1px solid #ccc;
	display: none;
}
.schedule-section.filter-open {
	display: block;
}
.schedule-section label {
	display: block;
	margin-bottom: 5px;
}
.schedule-section input,
.schedule-section select {
	padding: 5px;
}
/* Filter-grid elementer: ingen bunn-margin */
.filter-grid input[type="datetime-local"],
.filter-grid input[type="radio"],
.filter-grid select,
.filter-grid button {
	margin-bottom: 0;
}
/* Radioknapper i filter-grid: 8px avstand til neste element */
.filter-grid input[type="radio"] {
	margin-inline-end: 8px;
}
.schedule-section button {
	cursor: pointer;
}
/* ubrukt: .btn-toggle-language */
.news-item {
	padding: 15px;
	margin-bottom: 10px;
	border: 1px solid #ddd;
	background: #f9f9f9;
}
.news-item-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
}
.news-item-source {
	display: flex;
	align-items: center;
	font-size: 0.9em;
	color: #666;
}
.news-item-source img {
	width: 16px;
	height: 16px;
	margin-inline-end: 5px;
}
.news-item button {
	padding: 5px 10px;
	cursor: pointer;
}
/* ubrukt: .editor-toolbar, .editor-toolbar button, .editor-textarea */

/* Modal/Dialog styles */
.modal-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;     /* posisjonering av fast boks */
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 1000;
}
.modal-overlay.active {
	display: flex;
	justify-content: center;
	align-items: center;
}
.modal {
	background: white;
	padding: 30px;
	border-radius: 8px;
	max-width: 500px;
	width: 90%;
}
.modal h3 {
	margin-bottom: 20px;
}
.modal-option {
	margin: 15px 0;
	padding: 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
}
.modal-option:hover {
	background: #f0f0f0;
}
.modal-option input[type="radio"] {
	margin-inline-end: 10px;
}
.modal-buttons {
	margin-top: 20px;
	text-align: right;
}
.modal-buttons button {
	margin-inline-start: 10px;
	padding: 8px 20px;
	cursor: pointer;
}
.modal-form label {
	display: block;
	margin-top: 15px;
	margin-bottom: 5px;
	font-weight: bold;
}
.modal-form input[type="text"],
.modal-form input[type="url"] {
	width: 100%;
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
}
.modal-form input[type="checkbox"] {
	margin-inline-end: 5px;
}
.modal-checkbox-list {
	max-height: 400px;
	overflow-y: auto;
	margin: 20px 0;
}
.modal-checkbox-item {
	padding: 10px;
	border: 1px solid #ddd;
	margin-bottom: 10px;
	border-radius: 4px;
}
.modal-checkbox-item:hover {
	background: #f5f5f5;
}
.modal-checkbox-item input[type="checkbox"] {
	margin-inline-end: 10px;
}
.modal-checkbox-item label {
	cursor: pointer;
	display: inline-block;
	width: calc(100% - 30px);
}
.english-name {
	font-size: 0.9em;
	color: #666;
}
[dir="rtl"] .english-name {
	display: none;
}

/* Nyhetskontroller-rad: språkvalg, visningsvalg, oppdateringslenke */
.news-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 15px;
	flex-wrap: wrap;
}

/* Knappgruppe med aktiv-markering */
.btn-group {
	display: flex;
}
.btn-group .btn-lang,
.btn-group .btn-view {
	padding: 6px 12px;
	cursor: pointer;
	background: #f0f0f0;
	border: 1px solid #ccc;
	font-size: 0.85em;
}
.btn-group .btn-lang:first-child,
.btn-group .btn-view:first-child {
	border-radius: 4px 0 0 4px;
	border-right: none;
}
.btn-group .btn-lang:last-child,
.btn-group .btn-view:last-child {
	border-radius: 0 4px 4px 0;
}
.btn-group .btn-lang.active,
.btn-group .btn-view.active {
	background: #333;
	color: #fff;
	border-color: #333;
}

/* Scrollbar nyhetsliste — fyller tilgjengelig plass via flex */
.news-list-scroll {
	flex: 1;
	min-height: 0; /* viktig: lar flex-barn krympe under innholdshøyde */
	overflow-y: auto;
	padding-right: 14px;
}

/* Debug-id per innslag */
.news-debug-id {
	font-size: 0.72em;
	color: #bbb;
	margin-inline-start: auto;
}

/* "Også:"-rad med andre kilder i merged-visning */
.cluster-also-in {
	margin-top: 8px;
	padding-top: 7px;
	border-top: 1px solid #e0e0e0;
	font-size: 0.82em;
	color: #666;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}
.cluster-also-in .source-line {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.cluster-also-in .source-line img {
	width: 14px;
	height: 14px;
}
.cluster-also-in a {
	color: #2980b9;
	text-decoration: none;
}
.cluster-also-in a:hover {
	text-decoration: underline;
}

/* Kildelinje øverst i merged-item */
.merged-primary-source {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.9em;
	color: #666;
	margin-bottom: 8px;
}
.merged-primary-source img {
	width: 16px;
	height: 16px;
}
.merged-primary-source a {
	color: #333;
	text-decoration: none;
	font-weight: 500;
}
.merged-primary-source a:hover {
	text-decoration: underline;
}

/* Oppdater-knapp */
.btn-process-link {
	display: inline-block;
	padding: 6px 12px;
	background: #f0f0f0;
	border: 1px solid #ccc;
	border-radius: 4px;
	text-decoration: none;
	color: #333;
	font-size: 0.85em;
	cursor: pointer;
}
.btn-process-link:hover {
	background: #e0e0e0;
}

/* Tittel — fet på egen linje */
.news-title {
	font-size: 1em;
	font-weight: bold;
	line-height: 1.4;
	margin-top: 6px;
	margin-bottom: 5px;
	display: block;
}

/* Undertittel/brødtekst */
.news-subtitle {
	font-size: 0.88em;
	color: #444;
	line-height: 1.4;
	margin-bottom: 6px;
}

/* ubrukt: .news-link */

/* Melding når ingen headlines er lastet */
.no-headlines {
	color: #888;
	font-size: 0.9em;
	padding: 20px 0;
}
.no-headlines a {
	color: #2980b9;
}

/* Dato-rad: brukes på Maks-raden */
.date-row {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}
.date-row input[type="datetime-local"],
.date-row input[type="search"] {
	padding: 4px 6px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 0.9em;
}
#date-preset,
#tz-select,
.btn-now {
	padding: 4px 6px;
	font-size: 0.85em;
	border: 1px solid #ccc;
	border-radius: 4px;
	justify-self: start;
	margin-bottom: 0;
	line-height: normal;
}
.btn-now {
	background: #f0f0f0;
	cursor: pointer;
}
.btn-now:hover {
	background: #e0e0e0;
}

/* Debug-id ved siden av kilde */
.source-debug-id {
	font-size: 0.72em;
	color: #bbb;
}

/* Cluster-innslag: stablet korteffekt med CSS box-shadow */
.news-item.news-merged {
	position: relative;
	cursor: zoom-in;
	box-shadow:
		4px 4px 0 -1px #fff,
		4px 4px 0 1px #7aaacc,
		8px 8px 0 -1px #fff,
		8px 8px 0 1px #5588aa;
	margin-bottom: 22px;
	margin-inline-end: 8px; /* plass til skygger */
}
/* Pointer på lenker inni cluster-item */
.news-item.news-merged a {
	cursor: pointer;
}

/* Statuslampe per kilde — wrapper-span med ::before (ytre) og ::after (indre kjerne) */
.status-lamp {
	position: relative;
	display: block;
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	margin-inline-end: 12px;
}
.status-lamp::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: #9f9f9f;
	box-shadow: 0 0 2px 1px rgba(159, 159, 159, 0.5);
}
.status-lamp::after {
	content: "";
	position: absolute;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #333;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

/* Blå — aktiv */
.status-active .status-lamp::before {
	background: #005fa3;
	box-shadow: 0 0 3px 1px rgba(0, 95, 163, 0.7), 0 0 6px 2px rgba(0, 95, 163, 0.35);
}
.status-active .status-lamp::after  { background: #4cffdd; width: 8px; height: 8px; }

/* Rød — feil */
.status-error .status-lamp::before {
	background: #cd0000;
	box-shadow: 0 0 3px 1px rgba(205, 0, 0, 0.7), 0 0 6px 2px rgba(205, 0, 0, 0.35);
}
.status-error .status-lamp::after   { background: #fff079; width: 8px; height: 8px; }

/* Grå — inaktiv */
.status-inactive .status-lamp::before {
	background: #9f9f9f;
	box-shadow: 0 0 2px 1px rgba(159, 159, 159, 0.5);
}
.status-inactive .status-lamp::after { background: #333; width: 10px; height: 10px; }

/* Admin-knapper i language-selector */
.btn-admin-login,
.btn-admin-logout {
	padding: 5px 12px;
	border: 1px solid #ccc;
	background: #f0f0f0;
	cursor: pointer;
	font-size: 0.85em;
	border-radius: 4px;
	margin-inline-start: 4px; /* direction:ltr på parent */
}
.btn-admin-logout {
	background: #eaf4fb;
	border-color: #2980b9;
	color: #2980b9;
}
.btn-admin-login:hover  { background: #e0e0e0; }
.btn-admin-logout:hover { background: #d0eaf7; }

/* Kilde-checkboks ved siden av trafikklyset */
.source-checkbox {
	margin-inline-end: 6px;
	cursor: pointer;
	width: 15px;
	height: 15px;
	flex-shrink: 0;
}
.source-checkbox:disabled {
	cursor: not-allowed;
	opacity: 0.4;
}

/* news-item-source som lenke når innslaget har artikkel-URL */
a.news-item-source {
	text-decoration: none;
	display: flex;
	align-items: center;
	font-size: 0.9em;
	color: #2980b9;
	border-radius: 4px;
	padding: 2px 6px;
	background: #eaf4fb;
	border: 1px solid #b8d9ee;
}
a.news-item-source:hover {
	background: #d0eaf7;
}
a.news-item-source img {
	width: 16px;
	height: 16px;
	margin-inline-end: 5px;
}

/* Kildegrupper — kollapsbar seksjon */
.source-group {
	margin-bottom: 6px;
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
}
.source-group-header {
	padding: 8px 10px;
	background: #f5f5f5;
	cursor: pointer;
	font-weight: bold;
	font-size: 0.9em;
	user-select: none;
	display: flex;
	align-items: center;
	gap: 6px;
}
.source-group-header:hover {
	background: #eaeaea;
}
.source-group-items {
	border-top: 1px solid #ddd;
}
.source-group-items .source-item {
	border: none;
	border-bottom: 1px solid #f0f0f0;
	padding-inline-start: 20px;
}
.source-group-items .source-item:last-child {
	border-bottom: none;
}
.source-group.collapsed .source-group-items {
	display: none;
}

/* Trekant-indikator — bytter retning via CSS, ingen JS nødvendig */
.group-triangle::before {
	content: "▲";
}
.source-group.collapsed .group-triangle::before {
	content: "▼";
}

/* Gruppe-statuslampe — samme ::before/::after-struktur som .status-lamp, men 10px */
/* Logikk: rød=minst én valgt kilde har feil, blå=minst én valgt aktiv, grå=ingen aktive/valgte */
/* Statusklassen (.group-status-active/error/inactive) settes på .source-group-header (forelder) */
.group-status-lamp {
	position: relative;
	display: inline-block;
	width: 10px;
	height: 10px;
	flex-shrink: 0;
}
.group-status-lamp::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: #9f9f9f;
	box-shadow: 0 0 2px 1px rgba(159, 159, 159, 0.5);
}
.group-status-lamp::after {
	content: "";
	position: absolute;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #333;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

/* Blå — minst én valgt kilde er aktiv */
.group-status-active .group-status-lamp::before {
	background: #005fa3;
	box-shadow: 0 0 3px 1px rgba(0, 95, 163, 0.7), 0 0 6px 2px rgba(0, 95, 163, 0.35);
}
.group-status-active .group-status-lamp::after  { background: #4cffdd; width: 5px; height: 5px; }

/* Rød — minst én valgt kilde har feil */
.group-status-error .group-status-lamp::before {
	background: #cd0000;
	box-shadow: 0 0 3px 1px rgba(205, 0, 0, 0.7), 0 0 6px 2px rgba(205, 0, 0, 0.35);
}
.group-status-error .group-status-lamp::after   { background: #fff079; width: 5px; height: 5px; }

/* Grå — ingen valgte eller alle inactive */
.group-status-inactive .group-status-lamp::before {
	background: #9f9f9f;
	box-shadow: 0 0 2px 1px rgba(159, 159, 159, 0.5);
}
.group-status-inactive .group-status-lamp::after { background: #333; width: 6px; height: 6px; }

/* Kildenavn som lenke til hjemmeside */
.source-homepage-link {
	color: inherit;
	text-decoration: none;
}
.source-homepage-link:hover {
	text-decoration: underline;
}

/* Bilde til inline-start, tekst wrapper rundt */
.news-item-content {
	display: block;
}
.news-item-content.has-image::after {
	content: "";
	display: table;
	clear: both;
}
.news-item-text {
	display: block;
}
.news-image {
	float: inline-start;
	margin-inline-end: 12px;
	margin-bottom: 4px;
	width: 120px;
	height: 80px;
	object-fit: cover;
	border-radius: 4px;
}

/* Kategori-badge ved siden av kildelinje */
.category-badge {
	display: inline-block;
	font-size: 0.75em;
	padding: 1px 7px;
	border-radius: 10px;
	background: #eaf4fb;
	color: #2980b9;
	border: 1px solid #b8d9ee;
	margin-inline-start: 6px;
	vertical-align: middle;
}

/* Lukk-knapp øverst i skuff — kun synlig når skuffen er åpen */
.btn-drawer-close {
	display: none;
	position: absolute;
	top: 12px;
	inset-inline-start: 12px;
	background: none;
	border: none;
	font-size: 1.4em;
	cursor: pointer;
	color: #666;
	padding: 4px 8px;
	line-height: 1;
}
.btn-drawer-close:hover {
	color: #000;
}
.drawer-open .btn-drawer-close {
	display: block;
}

/* Lange/korte labels — korte skjult som standard */
.btn-label-short { display: none; }
.btn-label-long  { display: inline; }

@media (max-width: 900px) {
	/* Korte knapp-labels */
	.btn-label-short { display: inline; }
	.btn-label-long  { display: none; }
}

/* ── Responsive: skuffer for sidepaneler på små skjermer ─────────────────── */

/* Logo i topplinja */
.top-logo {
	height: 40px;
	width: 40px;
	margin-inline-end: auto; /* skyv resten til høyre — direction:ltr på parent */
}

/* Skjul drawer-toggle-knapper på store skjermer — unntatt filter-toggle */
.btn-drawer-toggle:not(.btn-filter-toggle) {
	display: none;
	align-items: center;
	justify-content: center;
	background: none;
	border: 1px solid #ccc;
	border-radius: 4px;
	padding: 4px 10px;
	cursor: pointer;
	font-size: 1.1em;
}
/* Filter-toggle — absolutt posisjonert øverst til høyre i .center-panel */
.btn-filter-toggle {
	position: absolute;
	top: 12px;
	inset-inline-end: 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 1px solid #ccc;
	border-radius: 4px;
	padding: 4px 10px;
	cursor: pointer;
	font-size: 1.1em;
	z-index: 5;
}

/* Backdrop */
.drawer-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.4);
	z-index: 499;
}
.drawer-backdrop.active {
	display: block;
}

@media (max-width: 900px) {
	/* Vis andre toggle-knapper på mobil */
	.btn-drawer-toggle:not(.btn-filter-toggle) {
		display: flex;
	}
	/* Skjul sidepaneler i normal layout */
	.left-panel,
	.right-panel {
		display: none;
	}
	/* Skuff-oppførsel når .drawer-open er satt av JS */
	.left-panel.drawer-open,
	.right-panel.drawer-open {
		display: block;
		position: fixed;
		top: 0;
		height: 100%;
		width: 85vw;
		background: #fff;
		z-index: 500;
		overflow-y: auto;
		padding: 60px 15px 15px;
		border: 1px solid #ccc;
	}
	/* Skuffer: fysisk posisjonering — left/right er korrekt her */
	.left-panel.drawer-open  { left: 0;  border-left: none;  }
	.right-panel.drawer-open { right: 0; border-right: none; }
}

/* Filter-grid: vertikal justering av alle direkte barn */
.filter-grid > * {
	align-self: center;
}
/* Flex-celle med dato-felt og Nå-knapp */
.filter-grid > div {
	display: flex;
	align-items: center;
	gap: 4px;
}

/* Filter-grid: på mobil brytes til 2 kolonner, spacer-kolonner skjules */
@media (max-width: 900px) {
	.filter-grid {
		grid-template-columns: min-content min-content min-content !important;
	}
	.filter-grid .filter-spacer {
		display: none;
	}
	/* radio G og E: hopp til kolonne 1 på ny rad */
	#from-mode-preset,
	#to-mode-latest {
		grid-column: 1;
	}
}

/* Laster-melding — gul bakgrunn som cluster-highlight */
.loading-news {
	background: #fffbe6;
	border-left: 3px solid #f0c040;
	padding: 8px 12px;
	font-size: 0.9em;
	color: #666;
}

/* Oppdater-knapp: gul=laster, grønn=ok, svart=tom, rød=nye innslag */
#btn-refresh {
	border: 3px solid #f0c040;
}
#btn-refresh.btn-refresh-ready {
	border: 3px solid #27ae60;
}
#btn-refresh.btn-refresh-empty {
	border: 3px solid #333;
}
#btn-refresh.btn-refresh-pending {
	border: 3px solid red;
}

/* Scroll-til-topp-knapp — absolutt posisjon nede til høyre i senterpanelet */
.btn-scroll-top {
	display: none;
	position: absolute;
	bottom: 24px;
	inset-inline-end: 55px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #333;
	border: none;
	cursor: pointer;
	opacity: 0.5;
	z-index: 10;
	padding: 0;
	align-items: center;
	justify-content: center;
}
.btn-scroll-top:hover {
	opacity: 1;
}
.btn-scroll-top.visible {
	display: flex;
}

/* Ikonknapp — fast størrelse, sentrert symbol */
.btn-icon {
	width: 28px;
	height: 28px;
	padding: 0;
	display: inline-flex;
	justify-content: center;
	font-size: 1.4em;
	line-height: 1;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #f0f0f0;
	cursor: pointer;
}
.btn-icon:hover {
	background: #e0e0e0;
}

/* style.css — v67 */
