/* Nellca References – Frontend CSS */

/* =========================================================
   Referensgrid (shortcode)
   ========================================================= */

.nellca-references-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 2px;
	margin: 0;
}

@media (max-width: 900px) {
	.nellca-references-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.nellca-references-grid {
		grid-template-columns: 1fr;
	}
}

/* Featured-kort: spänner 2 kolumner */
.nellca-card--featured {
	grid-column: span 2;
}

@media (max-width: 600px) {
	.nellca-card--featured {
		grid-column: span 1;
	}
}

.nellca-card {
	display: block;
	text-decoration: none;
	color: inherit;
	background: #fafafa;
	overflow: hidden;
	position: relative;
}

.nellca-card:hover .nellca-card__image img {
	transform: scale(1.03);
}

.nellca-card__image {
	overflow: hidden;
	aspect-ratio: 4/3;
}

.nellca-card--featured .nellca-card__image {
	aspect-ratio: 16/9;
}

.nellca-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.5s ease;
}

.nellca-card__body {
	padding: 16px 20px 20px;
}

.nellca-card__ort {
	display: block;
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #999;
	margin-bottom: 4px;
}

.nellca-card__title {
	font-size: 16px;
	font-weight: 500;
	margin: 0 0 8px;
	line-height: 1.3;
}

.nellca-card--featured .nellca-card__title {
	font-size: 20px;
}

.nellca-card__products {
	font-size: 12px;
	color: #888;
	margin: 0;
}

.nellca-card__products a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* =========================================================
   Single projektsida
   ========================================================= */

.nellca-single-project {
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 0 80px;
}

.nellca-back-link {
	padding: 20px 40px;
}

.nellca-back-link a {
	font-size: 13px;
	color: #666;
	text-decoration: none;
	letter-spacing: 0.02em;
}

.nellca-back-link a:hover {
	color: #111;
}

/* Hero */
.nellca-hero {
	position: relative;
	width: 100%;
	aspect-ratio: 16/7;
	overflow: hidden;
}

.nellca-hero img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.nellca-hero__label {
	position: absolute;
	bottom: 20px;
	left: 32px;
	background: rgba(0,0,0,0.5);
	color: #fff;
	font-size: 12px;
	letter-spacing: 0.05em;
	padding: 6px 14px;
}

/* Projekt body */
.nellca-project-body {
	display: grid;
	grid-template-columns: 65fr 35fr;
	gap: 60px;
	padding: 48px 40px;
	align-items: start;
}

@media (max-width: 800px) {
	.nellca-project-body {
		grid-template-columns: 1fr;
		gap: 32px;
	}
}

.nellca-project-title {
	font-size: 28px;
	font-weight: 400;
	margin: 0 0 8px;
	letter-spacing: -0.01em;
}

.nellca-project-ort {
	font-size: 13px;
	color: #999;
	margin: 0 0 20px;
}

.nellca-project-description {
	font-size: 15px;
	line-height: 1.65;
	color: #333;
}

/* Info-ruta */
.nellca-project-info-box {
	border: 0.5px solid #ddd;
	padding: 24px 28px;
}

.nellca-project-roles {
	margin: 0;
}

.nellca-role-label {
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #999;
	margin: 12px 0 2px;
}

.nellca-role-label:first-child {
	margin-top: 0;
}

.nellca-role-value {
	font-size: 14px;
	color: #222;
	margin: 0;
}

/* Avdelare */
.nellca-divider {
	border: none;
	border-top: 0.5px solid #ddd;
	margin: 0 40px;
}

/* Bildgalleri */
.nellca-project-gallery,
.nellca-project-products {
	padding: 48px 40px;
}

.nellca-section-heading {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #999;
	margin: 0 0 24px;
}

.nellca-gallery-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 4px;
}

.nellca-gallery-item--first {
	grid-column: span 2;
	grid-row: span 2;
}

.nellca-gallery-item {
	overflow: hidden;
	cursor: pointer;
	aspect-ratio: 4/3;
}

.nellca-gallery-item--first {
	aspect-ratio: auto;
}

.nellca-gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.nellca-gallery-item:hover img {
	transform: scale(1.04);
}

/* Produktgrid */
.nellca-products-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 16px;
}

.nellca-product-card {
	display: block;
	text-decoration: none;
	color: inherit;
}

.nellca-product-card__image {
	aspect-ratio: 1/1;
	overflow: hidden;
	background: #f5f5f5;
	margin-bottom: 8px;
}

.nellca-product-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.nellca-product-card:hover .nellca-product-card__image img {
	transform: scale(1.05);
}

.nellca-product-card__body {
	padding: 0 2px;
}

.nellca-product-card__name {
	display: block;
	font-size: 13px;
	font-weight: 500;
	margin-bottom: 2px;
}

.nellca-product-card__cat {
	display: block;
	font-size: 11px;
	color: #999;
}

/* =========================================================
   Miljöbilder på produktsida
   ========================================================= */

.nellca-env-images {
	padding: 48px 0;
	border-top: 0.5px solid #ddd;
	margin-top: 40px;
}

.nellca-env-images__heading {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #999;
	margin: 0 0 24px;
}

.nellca-env-images__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 4px;
}

.nellca-env-images__item {
	position: relative;
	overflow: hidden;
	aspect-ratio: 4/3;
	cursor: pointer;
}

.nellca-env-images__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.nellca-env-images__item:hover img {
	transform: scale(1.05);
}

.nellca-env-images__label {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(0,0,0,0.5);
	color: #fff;
	font-size: 11px;
	padding: 5px 10px;
	opacity: 0;
	transition: opacity 0.2s;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nellca-env-images__item:hover .nellca-env-images__label {
	opacity: 1;
}

/* =========================================================
   Lightbox
   ========================================================= */

.nellca-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0,0,0,0.92);
	display: flex;
	align-items: center;
	justify-content: center;
}

.nellca-lightbox__inner {
	position: relative;
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.nellca-lightbox__img {
	max-width: 90vw;
	max-height: 80vh;
	object-fit: contain;
	display: block;
}

.nellca-lightbox__caption {
	color: rgba(255,255,255,0.7);
	font-size: 13px;
	margin-top: 12px;
	letter-spacing: 0.04em;
}

.nellca-lightbox__close {
	position: absolute;
	top: -36px;
	right: 0;
	background: none;
	border: none;
	color: #fff;
	font-size: 28px;
	cursor: pointer;
	line-height: 1;
	padding: 0;
}

.nellca-lightbox__prev,
.nellca-lightbox__next {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: rgba(255,255,255,0.6);
	font-size: 40px;
	cursor: pointer;
	padding: 16px;
	line-height: 1;
}

.nellca-lightbox__prev { left: 16px; }
.nellca-lightbox__next { right: 16px; }

.nellca-lightbox__prev:hover,
.nellca-lightbox__next:hover {
	color: #fff;
}

/* =========================================================
   Personal-sidor: [nellca_miljobilder] & [nellca_projekt]
   ========================================================= */

.nrp-wrap {
	max-width: 680px;
	margin: 0 auto;
	padding: 0 4px;
}

.nrp-no-access {
	color: #c00;
	padding: 20px 0;
}

.nrp-page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	gap: 12px;
}

.nrp-page-title {
	font-size: 22px;
	font-weight: 700;
	margin: 0 0 20px;
}

.nrp-page-header .nrp-page-title {
	margin-bottom: 0;
}

.nrp-subtitle {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 10px;
}

.nrp-section {
	margin-bottom: 24px;
}

.nrp-label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	color: #666;
	text-transform: uppercase;
	letter-spacing: .05em;
	margin-bottom: 6px;
}

.nrp-field {
	margin-bottom: 12px;
}

.nrp-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.nrp-input {
	width: 100%;
	padding: 11px 13px;
	font-size: 16px;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-sizing: border-box;
	-webkit-appearance: none;
	background: #fff;
}

.nrp-input:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0,115,170,.15);
}

/* Autocomplete */
.nrp-autocomplete {
	position: relative;
}

.nrp-suggestions {
	position: absolute;
	background: #fff;
	border: 1px solid #ddd;
	border-top: none;
	border-radius: 0 0 6px 6px;
	width: 100%;
	z-index: 200;
	max-height: 260px;
	overflow-y: auto;
	box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.nrp-suggestions ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.nrp-suggestions li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	cursor: pointer;
	font-size: 14px;
	border-bottom: 1px solid #f5f5f5;
}

.nrp-suggestions li:hover,
.nrp-suggestions li:active {
	background: #f0f7ff;
}

.nrp-suggest-img {
	width: 36px;
	height: 36px;
	object-fit: cover;
	border-radius: 3px;
	flex-shrink: 0;
}

.nrp-suggest-empty {
	color: #999;
	font-style: italic;
	cursor: default !important;
}

.nrp-suggest-empty:hover {
	background: none !important;
}

/* Taggar för valda produkter */
.nrp-tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.nrp-tag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px 5px 12px;
	background: #f0f7ff;
	border: 1px solid #c4ddf5;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 500;
}

.nrp-tag button {
	background: none;
	border: none;
	cursor: pointer;
	color: #666;
	font-size: 16px;
	line-height: 1;
	padding: 0;
	display: flex;
	align-items: center;
}

/* Upload-zon */
.nrp-upload-zone {
	background: #f8f9fa;
	border: 2px dashed #d0d0d0;
	border-radius: 8px;
	padding: 24px 16px;
	text-align: center;
}

.nrp-upload-label {
	display: inline-flex !important;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	cursor: pointer;
	max-width: 320px;
	width: 100%;
}

.nrp-upload-hint {
	font-size: 12px;
	font-weight: 400;
	opacity: .75;
}

/* Uppladdningskö */
#nrp-upload-queue {
	margin-top: 12px;
}

.nrp-queue-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	background: #fff;
	border-radius: 6px;
	margin-bottom: 6px;
	box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.nrp-queue-name {
	flex: 1;
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nrp-queue-progress {
	width: 60px;
	height: 4px;
	background: #eee;
	border-radius: 2px;
	overflow: hidden;
	flex-shrink: 0;
}

.nrp-queue-bar {
	height: 100%;
	background: currentColor;
	width: 0;
	transition: width .2s;
}

.nrp-queue-status {
	font-size: 12px;
	color: #999;
	white-space: nowrap;
}

.nrp-queue-status--ok  { color: #5a9e6f; }
.nrp-queue-status--err { color: #c00; }

/* Bildgrid */
.nrp-image-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	gap: 6px;
	min-height: 20px;
}

.nrp-image-item {
	position: relative;
	aspect-ratio: 1;
	border-radius: 4px;
	overflow: hidden;
	background: #f0f0f0;
}

.nrp-image-item--editable {
	cursor: pointer;
}

.nrp-image-item--editable:hover .nrp-image-overlay {
	background: rgba(0,0,0,.65);
}

.nrp-image-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.nrp-image-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 3px 5px;
	background: rgba(0,0,0,.5);
}

.nrp-image-overlay span {
	display: block;
	font-size: 9px;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nrp-image-remove {
	position: absolute;
	top: 3px;
	right: 3px;
	width: 22px;
	height: 22px;
	background: rgba(0,0,0,.55);
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

/* Projektkort */
.nrp-create-form {
	background: #f8f9fa;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 16px;
}

#nrp-project-list {
	margin-top: 20px;
}

.nrp-project-card {
	background: #fff;
	border: 1px solid #d0d0d0;
	border-radius: 8px;
	margin-bottom: 12px;
	overflow: hidden;
	transition: opacity .3s;
	box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.nrp-project-card__header {
	/* block element — innehåll staplas vertikalt */
}

.nrp-project-thumb {
	display: block;
	width: 100%;
	height: 130px;
	object-fit: cover;
}

.nrp-project-thumb--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 60px;
	background: #f5f5f5;
	font-size: 22px;
}

.nrp-project-card__body {
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.nrp-project-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}

.nrp-project-meta {
	font-size: 12px;
	color: #666;
}

.nrp-project-stats {
	font-size: 12px;
	color: #999;
}

.nrp-project-card__body .nrp-status {
	align-self: flex-start;
}

.nrp-project-card__body .nrp-edit-btn {
	width: 100%;
	text-align: center;
	margin-top: 4px;
}

.nrp-edit-form {
	padding: 16px;
	border-top: 2px solid #eee;
	background: #fafafa;
}

.nrp-thumbnail-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.nrp-edit-thumb-preview {
	max-width: 64px;
	border-radius: 4px;
}

textarea.nrp-input {
	resize: vertical;
	line-height: 1.5;
}

.nrp-gallery-add-btn {
	cursor: pointer;
	display: inline-flex;
	margin-top: 8px;
	margin-bottom: 8px;
}

.nrp-image-item--uploading {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f0f0f0;
}

.nrp-gallery-spinner {
	width: 20px;
	height: 20px;
	border: 2px solid #ddd;
	border-top-color: #666;
	border-radius: 50%;
	animation: nrp-spin .7s linear infinite;
}

@keyframes nrp-spin {
	to { transform: rotate(360deg); }
}

.nrp-thumb-change-btn {
	cursor: pointer;
}

/* Produktlista i redigering */
.nrp-edit-product-list {
	margin: 0 0 8px;
	padding: 0;
	list-style: none;
}

.nrp-edit-product-list li {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	padding: 3px 0;
}

.nrp-list-remove {
	background: none;
	border: none;
	cursor: pointer;
	color: #c00;
	font-size: 16px;
	padding: 0;
	line-height: 1;
	flex-shrink: 0;
}

/* Formulärknappar */
.nrp-form-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid #e0e0e0;
}

.nrp-form-msg {
	font-size: 13px;
	margin: 6px 0 0;
	min-height: 16px;
}

.nrp-text-btn {
	background: #fff;
	border: 1px solid #ccc;
	border-radius: 4px;
	color: #444;
	cursor: pointer;
	font-size: 14px;
	padding: 8px 14px;
	text-decoration: none;
}

.nrp-text-btn:hover {
	background: #f5f5f5;
	border-color: #aaa;
	color: #111;
}

.nrp-danger-btn {
	background: #fff;
	border: 1px solid #e57373;
	border-radius: 4px;
	color: #c00;
	cursor: pointer;
	font-size: 13px;
	padding: 8px 14px;
	margin-left: auto;
}

.nrp-danger-btn:hover {
	background: #fff0f0;
	border-color: #c00;
}

/* Statusmärken */
.nrp-status {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
}

.nrp-status--pub   { background: #e8f5e9; color: #2e7d32; }
.nrp-status--draft { background: #fff3e0; color: #e65100; }

.nrp-placeholder {
	color: #aaa;
	font-size: 13px;
	font-style: italic;
}

@media (max-width: 480px) {
	.nrp-field-row {
		grid-template-columns: 1fr;
	}
	.nrp-field-row,
	.nrp-project-card__top {
		flex-wrap: wrap;
	}
}

/* ── Bildredigeringsmodal ─────────────────────────────────── */
#nrp-img-editor {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.nrp-img-editor__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,.55);
}

.nrp-img-editor__panel {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 12px 12px 0 0;
	width: 100%;
	max-width: 480px;
	height: 85vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 -4px 24px rgba(0,0,0,.2);
}

.nrp-img-editor__preview {
	width: 100%;
	height: 200px;
	object-fit: cover;
	display: block;
	flex-shrink: 0;
}

.nrp-img-editor__body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	-webkit-overflow-scrolling: touch;
}

@media (min-width: 600px) {
	#nrp-img-editor {
		align-items: center;
	}
	.nrp-img-editor__panel {
		border-radius: 12px;
		height: auto;
		max-height: 80vh;
	}
}
