/* Postlista — Kvinnherad Kommune Registry Browser */

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

.skip-link {
	position: absolute;
	top: -100%;
	left: 0;
	z-index: 9999;
	padding: 0.5rem 1rem;
	background: #1a5276;
	color: white;
	text-decoration: none;
	font-weight: bold;
	border-radius: 0 0 4px 0;
}

.skip-link:focus {
	top: 0;
}

body {
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
		sans-serif;
	font-size: 14px;
	line-height: 1.6;
	color: #333;
	background: #f5f5f5;
}

header {
	background: #1a5276;
	color: white;
	padding: 1rem 2rem;
}

header h1 a {
	color: white;
	text-decoration: none;
	font-size: 1.4rem;
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.logo {
	height: 36px;
	width: auto;
}

.search-bar {
	margin-top: 0.5rem;
	display: flex;
	gap: 0.5rem;
}

.search-bar input {
	flex: 1;
	max-width: 400px;
	padding: 0.5rem 1rem;
	border: none;
	border-radius: 4px;
	font-size: 0.9rem;
}

.search-bar button {
	padding: 0.5rem 1rem;
	background: #2ecc71;
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-weight: bold;
}

.search-bar button:hover {
	background: #27ae60;
}

main {
	max-width: 1200px;
	margin: 0 auto;
	padding: 1.5rem;
}

/* Filters */
.filters {
	background: white;
	padding: 0.8rem 1rem;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	margin-bottom: 1rem;
}

.filter-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 0.5rem;
}

.filter-cell {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.filter-label {
	font-size: 0.7rem;
	text-transform: uppercase;
	color: #888;
	letter-spacing: 0.04em;
	display: flex;
	align-items: center;
	gap: 0.25rem;
	white-space: nowrap;
}

.filter-cell select,
.filter-cell input[type="date"],
.filter-cell input[type="number"],
.filter-cell input[type="text"] {
	padding: 0.3rem 0.4rem;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 0.82rem;
	width: 100%;
}

.gnr-filter {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: flex-end;
}

.gnr-filter input[type="number"] {
	width: auto;
	flex: 1;
}

.gnr-filter input[type="text"] {
	width: auto;
	flex: 1;
}

.gnr-slash {
	color: #999;
	font-weight: bold;
	padding: 0 0.15rem;
}

.filter-actions {
	flex-direction: row;
	align-items: center;
	gap: 0.4rem;
}

.filters button {
	padding: 0.3rem 0.8rem;
	background: #1a5276;
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.82rem;
	font-weight: 600;
}

.filters button:hover {
	background: #154360;
}

.reset-link {
	color: #e74c3c;
	text-decoration: none;
	font-size: 0.82rem;
	font-weight: 500;
}

.reset-link:hover {
	text-decoration: underline;
}

/* Collapsible Filter Panel */
.filter-panel {
	margin-bottom: 1rem;
}

.filter-panel details {
	background: white;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-panel summary {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.6rem 1rem;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.9rem;
	color: #1a5276;
	list-style: none;
	user-select: none;
}

.filter-panel summary::-webkit-details-marker {
	display: none;
}

.filter-panel summary:hover {
	background: #f8f9fa;
}

.filter-chevron {
	margin-left: auto;
	transition: transform 0.2s ease;
	font-size: 0.8rem;
	color: #888;
}

.filter-panel details[open] .filter-chevron {
	transform: rotate(180deg);
}

.filter-panel .filter-grid {
	padding: 0.8rem 1rem 1rem;
}

.search-cell input[type="text"] {
	min-width: 0;
}

/* Results info */
.results-info {
	padding: 0.5rem 0;
	color: #666;
	font-size: 0.9rem;
}

/* Tables */
.entry-table,
.detail-table,
.doc-table {
	width: 100%;
	background: white;
	border-collapse: collapse;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 1.5rem;
}

.entry-table th,
.entry-table td,
.detail-table th,
.detail-table td,
.doc-table th,
.doc-table td {
	padding: 0.7rem 1rem;
	text-align: left;
	border-bottom: 1px solid #eee;
}

.entry-table th,
.doc-table th {
	background: #f8f9fa;
	font-weight: 600;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #555;
}

.detail-table th {
	width: 180px;
	background: #f8f9fa;
	font-weight: 600;
	color: #555;
}

.entry-table tbody tr:hover,
.doc-table tbody tr:hover {
	background: #f8f9fa;
}

/* Direction badges */
.dir-I {
	color: #2980b9;
	font-weight: bold;
}
.dir-U {
	color: #e67e22;
	font-weight: bold;
}

/* Pagination */
.pagination {
	padding: 1rem;
}
.pagination-buttons {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 1rem;
}

.pagination a {
	padding: 0.5rem 1rem;
	background: #1a5276;
	color: white;
	text-decoration: none;
	border-radius: 4px;
	font-size: 0.9rem;
}

.pagination a:hover {
	background: #154360;
}

.pagination span {
	color: #666;
}

/* Detail page */
/* Case status backgrounds */
.detail-table.status-open {
	background: #fff8e7;
}
.detail-table.status-open th {
	background: #fff0d0;
}
.detail-table.status-closed {
	background: #f5f5f5;
}
.detail-table.status-closed th {
	background: #e8e8e8;
}

.detail-page h1 {
	font-size: 1.3rem;
	margin: 0.5rem 0 0.6rem;
	color: #1a5276;
}

.detail-page h2 {
	font-size: 1rem;
	margin: 0.5rem 0 0.4rem;
	color: #2c3e50;
}

.breadcrumb {
	font-size: 0.8rem;
	color: #666;
	margin-bottom: 0.4rem;
}

.breadcrumb a {
	color: #1a5276;
	text-decoration: none;
}

/* Compact metadata grid */
.meta-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 0.3rem 1rem;
	background: white;
	padding: 0.8rem 1rem;
	border-radius: 6px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	margin-bottom: 0.6rem;
	font-size: 0.82rem;
}

.meta-item {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding-bottom: 0.3rem;
	border-bottom: 1px solid #f0f0f0;
}

.meta-label {
	font-size: 0.7rem;
	text-transform: uppercase;
	color: #888;
	letter-spacing: 0.04em;
}

.meta-value {
	color: #333;
	font-weight: 500;
}

.meta-value a {
	color: #1a5276;
	text-decoration: none;
}

.meta-item.dir-I .meta-value {
	color: #2980b9;
}
.meta-item.dir-U .meta-value {
	color: #e67e22;
}
.meta-item.pub-True .meta-value {
	color: #27ae60;
}
.meta-item.pub-False .meta-value {
	color: #95a5a6;
}

/* Parties row */
.parties-row {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	background: white;
	padding: 0.5rem 1rem;
	border-radius: 6px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	margin-bottom: 0.6rem;
	font-size: 0.82rem;
}

.party-group {
	display: flex;
	align-items: baseline;
	gap: 0.3rem;
	flex: 1;
	min-width: 200px;
}

.party-label {
	font-weight: 600;
	color: #555;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
}

.party-names {
	color: #333;
}

.kommune-logo {
	height: 16px;
	width: auto;
	vertical-align: middle;
}

.party-cell {
	max-width: 180px;
}

.party-cell a {
	color: #1a5276;
	text-decoration: none;
	font-weight: 500;
}

.party-cell a:hover {
	text-decoration: underline;
	color: #2980b9;
}

/* Documents section */
.docs-section {
	margin-top: 0.6rem;
}

.doc-table {
	font-size: 0.82rem;
	margin-bottom: 0.6rem;
}

.doc-table th,
.doc-table td {
	padding: 0.4rem 0.6rem;
}

/* Buttons */
.btn-download {
	display: inline-block;
	padding: 0.4rem 0.8rem;
	background: #2ecc71;
	color: white;
	text-decoration: none;
	border-radius: 4px;
	font-size: 0.85rem;
	font-weight: bold;
}

.btn-download:hover {
	background: #27ae60;
}

.btn-inline {
	text-decoration: none;
	margin-left: 0.3rem;
	font-size: 1rem;
	opacity: 0.5;
	transition: opacity 0.15s;
}

.btn-inline:hover {
	opacity: 1;
}

.access-req {
	color: #e74c3c;
	font-style: italic;
	font-size: 0.85rem;
}

.unpublished {
	color: #95a5a6;
	font-size: 0.85rem;
}

.info {
	padding: 1rem;
	background: #e8f4f8;
	border-left: 4px solid #2980b9;
	margin: 1rem 0;
	border-radius: 0 4px 4px 0;
}

.main-doc-link {
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px solid #eee;
}

/* Image thumbnails in document table */
.doc-thumbnail {
	max-width: 80px;
	max-height: 80px;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 3px;
	border: 1px solid #ddd;
	cursor: pointer;
	transition: transform 0.15s;
}

.doc-thumbnail:hover {
	transform: scale(1.05);
}

/* Small thumbnail for list view */
.list-thumbnail {
	max-width: 32px;
	max-height: 32px;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 2px;
	border: 1px solid #ddd;
	vertical-align: middle;
	margin-left: 0.3rem;
	opacity: 0.7;
	transition: opacity 0.15s;
}

.list-thumbnail:hover {
	opacity: 1;
}

/* Image preview in main doc link area */
.main-doc-preview {
	text-align: center;
	margin-top: 0.5rem;
}

.main-doc-preview img {
	max-width: 160px;
	max-height: 160px;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	border: 1px solid #ddd;
	cursor: pointer;
}

.main-doc-preview img:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Error page */
.error-page {
	text-align: center;
	padding: 3rem;
}

.error-page h1 {
	font-size: 2rem;
	color: #e74c3c;
	margin-bottom: 1rem;
}

.error-page a {
	display: inline-block;
	margin-top: 1rem;
	padding: 0.5rem 1.5rem;
	background: #1a5276;
	color: white;
	text-decoration: none;
	border-radius: 4px;
}

/* Property list */
.property-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0.5rem 0 1rem;
}

.property-badge {
	display: inline-block;
	padding: 0.2rem 0.6rem;
	background: #e8f4f8;
	color: #1a5276;
	text-decoration: none;
	border-radius: 4px;
	font-size: 0.82rem;
	font-weight: 600;
	border: 1px solid #b0d0e0;
}

.property-badge:hover {
	background: #d0e8f0;
}

.title-cell {
	min-width: 200px;
}

/* Title linkified GNR/BNR */
.title-cell a {
	color: #2980b9;
	font-weight: 600;
	text-decoration: none;
}

.title-cell a:hover {
	text-decoration: underline;
}

.entry-link {
	opacity: 0.6;
	margin-left: 0.3rem;
	transition: opacity 0.15s;
	font-size: 0.85rem;
	text-decoration: none;
	color: #1a5276;
}

.entry-link:hover {
	opacity: 1;
}

.planid-link {
	color: #e67e22;
	font-weight: 600;
	text-decoration: none;
}

.planid-link:hover {
	text-decoration: underline;
}

footer {
	text-align: center;
	padding: 1.5rem;
	color: #999;
	font-size: 0.8rem;
	border-top: 1px solid #eee;
	margin-top: 2rem;
}

/* SVG sprite icons */
.icon {
	display: inline-block;
	width: 1em;
	height: 1em;
	vertical-align: -0.125em;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.icon.icon-sm {
	width: 0.85em;
	height: 0.85em;
}

.icon.icon-md {
	width: 1.1em;
	height: 1.1em;
}

.icon.icon-lg {
	width: 1.4em;
	height: 1.4em;
}

/* Date section headers */
.date-header-row {
	background: #f7f8fa;
	border-bottom: 2px solid #dde1e6;
}

.date-header {
	font-weight: 700;
	font-size: 0.9rem;
	color: #444;
	padding: 0.5rem 1rem;
	letter-spacing: 0.02em;
}

/* Link column — narrow, leftmost */
.link-col {
	width: 36px;
	visibility: hidden;
}

.link-cell {
	width: 36px;
	text-align: center;
	vertical-align: middle;
}

.entry-link {
	color: #666;
	text-decoration: none;
}

.entry-link:hover {
	color: #1a5276;
}

/* Collapsible entry rows */
.entry-row {
	cursor: pointer;
	transition: background-color 0.15s;
	border-left: 4px solid transparent;
}

.entry-row[data-direction="I"] {
	border-left-color: #f1c40f;
}

.entry-row[data-direction="U"] {
	border-left-color: #2980b9;
}

.entry-row:hover {
	background: #fafbfd;
}

.entry-row.expanded {
	background: #f0f4f8;
}

.entry-detail {
	display: none;
}

.entry-detail.visible {
	display: table-row;
}

.detail-expand {
	padding: 0;
	margin: 0;
}

.doc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.82rem;
}

.doc-row {
	border-bottom: 1px solid #eee;
}

.doc-row:last-child {
	border-bottom: none;
}

.doc-row:hover {
	background: #f8f9fa;
}

.doc-row-main {
	background: #fef9f3;
}

.doc-row-main:hover {
	background: #fdf3e6;
}

.doc-type-cell {
	width: 70px;
	padding: 0.4rem 0.5rem;
	text-align: left;
	vertical-align: middle;
}

.doc-desc-cell {
	padding: 0.4rem 0.5rem;
	color: #333;
	font-weight: 500;
}

.doc-format-cell {
	width: 70px;
	padding: 0.4rem 0.5rem;
	color: #888;
	font-size: 0.75rem;
	font-family: monospace;
	white-space: nowrap;
}

.doc-actions-cell {
	padding: 0.4rem 0.5rem;
	white-space: nowrap;
}

.doc-type-badge {
	display: inline-block;
	padding: 0.1rem 0.4rem;
	background: #e8f4f8;
	color: #1a5276;
	border-radius: 3px;
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.btn-download {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.25rem 0.6rem;
	background: #f0f0f0;
	color: #333;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 0.78rem;
	text-decoration: none;
	cursor: pointer;
}

.btn-download:hover {
	background: #e0e0e0;
	border-color: #ccc;
}

.btn-download.btn-primary {
	background: #e67e22;
	color: white;
	border-color: #d35400;
}

.btn-download.btn-primary:hover {
	background: #d35400;
	border-color: #ba4a00;
}

/* Expand icon on entry row */
.entry-row .expand-hint {
	opacity: 0;
	transition: opacity 0.15s;
	margin-left: 0.3rem;
	font-size: 0.8rem;
	color: #1a5276;
}

.entry-row:hover .expand-hint {
	opacity: 0.6;
}

.entry-row.expanded .expand-hint {
	opacity: 1;
	transform: rotate(180deg);
}

/* Text render page */
.text-render-page {
	max-width: 720px;
	margin: 0 auto;
}

.text-render-page h1 {
	font-size: 1.2rem;
	color: #1a5276;
	margin: 0.5rem 0 1rem;
}

.email-headers {
	background: white;
	padding: 1rem 1.2rem;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	margin-bottom: 1rem;
	font-size: 0.9rem;
}

.header-row {
	display: flex;
	gap: 0.5rem;
	padding: 0.15rem 0;
}

.header-label {
	font-weight: 600;
	color: #555;
	min-width: 70px;
	flex-shrink: 0;
}

.header-value {
	color: #333;
	word-break: break-word;
}

.header-spacer {
	height: 0.6rem;
}

.email-body {
	background: white;
	padding: 1.2rem 1.5rem;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	line-height: 1.7;
	font-size: 0.95rem;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.btn-text-preview {
	background: #e67e22;
	color: white;
	border-color: #d35400;
}

.btn-text-preview:hover {
	background: #d35400;
	border-color: #ba4a00;
}
