/* WooCommerce Produktdesigner
 * Alt er avgrenset til #wd-designer og skrevet med ID-spesifisitet, slik at Astras globale
 * stiler for knapper og skjemafelt ikke slår gjennom. */

#wd-designer {
	--wd-accent: #2563eb;
	--wd-accent-dark: #1d4ed8;
	--wd-ink: #0f172a;
	--wd-muted: #64748b;
	--wd-line: #e2e8f0;
	--wd-soft: #f8fafc;
	--wd-danger: #dc2626;
	--wd-radius: 10px;

	position: relative;
	width: 100%;
	flex: 0 0 100%;
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: 340px minmax(0, 1fr);
	gap: 20px;
	margin: 0 0 40px;
	color: var(--wd-ink);
	font-size: 14px;
	line-height: 1.45;
	clear: both;
}

#wd-designer *,
#wd-designer *::before,
#wd-designer *::after { box-sizing: border-box; }
#wd-designer [hidden] { display: none !important; }

/* ---------- Grunnleggende reset av knapper/felt (Astra) ---------- */
#wd-designer button {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	min-height: 0;
}
#wd-designer button:disabled { opacity: .4; cursor: not-allowed; }
#wd-designer button:focus-visible,
#wd-designer .wd-input:focus-visible { outline: 2px solid var(--wd-accent); outline-offset: 2px; }

#wd-designer .wd-input,
#wd-designer input[type="number"],
#wd-designer input[type="text"],
#wd-designer input[type="search"],
#wd-designer select,
#wd-designer textarea {
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid var(--wd-line);
	border-radius: 8px;
	background: #fff;
	color: var(--wd-ink);
	font: inherit;
	line-height: 1.35;
	box-shadow: none;
	min-height: 38px;
}
#wd-designer textarea { resize: vertical; min-height: 60px; font-size: 16px; }
#wd-designer .wd-input-sm { width: 80px; display: inline-block; min-height: 32px; padding: 5px 8px; }
#wd-designer input[type="range"] { width: 100%; accent-color: var(--wd-accent); margin: 4px 0 10px; }
#wd-designer canvas { max-width: none; }
#wd-designer img { max-width: 100%; height: auto; }

/* ---------- Knapper ---------- */
#wd-designer .wd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 12px;
	border: 1px solid var(--wd-line);
	border-radius: 8px;
	background: #fff;
	color: var(--wd-ink);
	font-size: 13px;
	transition: background .15s, border-color .15s;
}
#wd-designer .wd-btn:hover { border-color: var(--wd-accent); background: #eff6ff; }
#wd-designer .wd-btn-primary { background: var(--wd-accent); border-color: var(--wd-accent); color: #fff; font-weight: 600; }
#wd-designer .wd-btn-primary:hover { background: var(--wd-accent-dark); border-color: var(--wd-accent-dark); color: #fff; }
#wd-designer .wd-btn-danger { color: var(--wd-danger); }
#wd-designer .wd-btn-danger:hover { background: #fef2f2; border-color: var(--wd-danger); }
#wd-designer .wd-btn-block { width: 100%; margin-top: 10px; }
#wd-designer .wd-btn-lg { padding: 12px 22px; font-size: 15px; }
#wd-designer .wd-link { color: var(--wd-accent); text-decoration: underline; font-weight: 600; }

/* ---------- Sidepanel ---------- */
#wd-designer .wd-sidebar {
	position: relative;
	background: #fff;
	border: 1px solid var(--wd-line);
	border-radius: var(--wd-radius);
	overflow: hidden;
	align-self: stretch;
	min-height: 480px;
}

/* Menyen (som hos Skiltmax): ikon, tittel, hva som er valgt nå, pil. */
#wd-designer .wd-menu { display: flex; flex-direction: column; }
#wd-designer .wd-menu-item {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 14px 16px;
	border-bottom: 1px solid var(--wd-line);
	text-align: left;
	transition: background .15s;
}
#wd-designer .wd-menu-item:hover,
#wd-designer .wd-menu-item.is-active { background: var(--wd-soft); }
#wd-designer .wd-mi-icon {
	flex: 0 0 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border-radius: 10px;
	background: #eff6ff;
	color: var(--wd-accent);
	font-size: 20px;
	font-weight: 700;
}
#wd-designer .wd-mi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#wd-designer .wd-mi-text strong { font-size: 15px; font-weight: 600; }
#wd-designer .wd-mi-text small { font-size: 12px; color: var(--wd-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#wd-designer .wd-mi-arrow { font-size: 22px; color: var(--wd-muted); }

/* Slide-in-paneler: legger seg over menyen. */
#wd-designer .wd-panels { position: absolute; inset: 0; pointer-events: none; }
#wd-designer .wd-panel {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	background: #fff;
	pointer-events: auto;
	animation: wd-slide-in .22s ease;
}
@keyframes wd-slide-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
#wd-designer .wd-panel-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--wd-line);
	background: #fff;
}
#wd-designer .wd-panel-head h3 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; text-align: center; padding-right: 70px; }
#wd-designer .wd-back { color: var(--wd-accent); font-weight: 600; padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
#wd-designer .wd-back:hover { background: #eff6ff; }
#wd-designer .wd-panel-body { flex: 1; overflow-y: auto; padding: 16px; }
#wd-designer .wd-label { display: block; margin: 12px 0 6px; font-size: 12px; font-weight: 600; color: var(--wd-muted); text-transform: uppercase; letter-spacing: .03em; }
#wd-designer .wd-panel > .wd-label:first-child,
#wd-designer .wd-group:first-child > .wd-label:first-child { margin-top: 0; }
#wd-designer .wd-label output { float: right; font-weight: 500; text-transform: none; color: var(--wd-ink); }
#wd-designer .wd-hint { display: block; margin: 8px 0 0; font-size: 12px; color: var(--wd-muted); }
#wd-designer .wd-group { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--wd-line); }
#wd-designer .wd-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#wd-designer .wd-grid-2 label,
#wd-designer .wd-inline { font-size: 12px; color: var(--wd-muted); }
#wd-designer .wd-inline { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
#wd-designer .wd-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; cursor: pointer; }
#wd-designer .wd-check input { width: auto; min-height: 0; margin: 0; }
#wd-designer .wd-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 4px; }
#wd-designer .wd-row .wd-label { margin: 0; }

/* Segmentknapper */
#wd-designer .wd-seg { display: inline-flex; border: 1px solid var(--wd-line); border-radius: 8px; overflow: hidden; }
#wd-designer .wd-seg button { padding: 7px 12px; border-right: 1px solid var(--wd-line); background: #fff; font-size: 15px; }
#wd-designer .wd-seg button:last-child { border-right: 0; }
#wd-designer .wd-seg button:hover { background: #eff6ff; }
#wd-designer .wd-seg button.is-active { background: var(--wd-accent); color: #fff; }
#wd-designer .wd-seg-wrap { display: grid; grid-template-columns: repeat(6, 1fr); width: 100%; }

#wd-designer .wd-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Fonter */
#wd-designer .wd-fonts {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	max-height: 210px;
	overflow-y: auto;
	padding: 2px;
	margin-top: 6px;
}
#wd-designer .wd-font {
	padding: 10px 8px;
	border: 1px solid var(--wd-line);
	border-radius: 8px;
	background: #fff;
	font-size: 18px;
	font-weight: normal;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#wd-designer .wd-font:hover { border-color: var(--wd-accent); }
#wd-designer .wd-font.is-active { border-color: var(--wd-accent); background: #eff6ff; box-shadow: inset 0 0 0 1px var(--wd-accent); }

/* Fargeknapper */
#wd-designer .wd-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
#wd-designer .wd-swatch {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--c);
	box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .18);
	transition: transform .1s;
}
#wd-designer .wd-swatch:hover { transform: scale(1.1); }
#wd-designer .wd-swatch.is-active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wd-accent); }
#wd-designer .wd-swatches-sm .wd-swatch { width: 22px; height: 22px; }
#wd-designer .wd-swatch-none { background: linear-gradient(135deg, #fff 45%, var(--wd-danger) 45%, var(--wd-danger) 55%, #fff 55%); }
#wd-designer .wd-outline { margin-top: 6px; padding: 10px; border-radius: 8px; background: var(--wd-soft); }
#wd-designer .wd-outline .wd-label { margin-top: 0; }

/* Clipart */
#wd-designer .wd-clipart { margin-top: 10px; }
#wd-designer .wd-clip-cat { margin-bottom: 8px; border: 1px solid var(--wd-line); border-radius: 8px; }
#wd-designer .wd-clip-cat summary { padding: 8px 10px; font-weight: 600; cursor: pointer; list-style-position: inside; }
#wd-designer .wd-count { float: right; color: var(--wd-muted); font-weight: 400; font-size: 12px; }
#wd-designer .wd-clip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 8px 8px; }
#wd-designer .wd-clip {
	aspect-ratio: 1;
	padding: 6px;
	border: 1px solid var(--wd-line);
	border-radius: 8px;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}
#wd-designer .wd-clip:hover { border-color: var(--wd-accent); background: #eff6ff; }
#wd-designer .wd-clip img { max-height: 100%; object-fit: contain; }

/* Opplasting */
#wd-designer .wd-drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 28px 16px;
	border: 2px dashed var(--wd-line);
	border-radius: var(--wd-radius);
	text-align: center;
	cursor: pointer;
	transition: border-color .15s, background .15s;
}
#wd-designer .wd-drop:hover,
#wd-designer .wd-drop.is-over { border-color: var(--wd-accent); background: #eff6ff; }
#wd-designer .wd-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
#wd-designer .wd-drop span { font-size: 12px; color: var(--wd-muted); }

/* Maler */
#wd-designer .wd-tpl-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#wd-designer .wd-tpl {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 8px;
	border: 1px solid var(--wd-line);
	border-radius: 8px;
	background: #fff;
	font-size: 12px;
}
#wd-designer .wd-tpl:hover { border-color: var(--wd-accent); }
#wd-designer .wd-tpl img { height: 70px; object-fit: contain; }

/* Lag */
#wd-designer .wd-layers { display: flex; flex-direction: column; gap: 4px; }
#wd-designer .wd-layer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border: 1px solid var(--wd-line);
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
	font-size: 13px;
}
#wd-designer .wd-layer:hover { border-color: var(--wd-accent); }
#wd-designer .wd-layer.is-active { border-color: var(--wd-accent); background: #eff6ff; }
#wd-designer .wd-layer.is-locked .wd-layer-name { color: var(--wd-muted); }
#wd-designer .wd-layer-icon { width: 22px; height: 22px; border-radius: 5px; background: var(--wd-soft); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
#wd-designer .wd-layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wd-designer .wd-layer-size { font-size: 11px; color: var(--wd-muted); }
#wd-designer .wd-icon-btn { width: 26px; height: 26px; border-radius: 6px; font-size: 12px; }
#wd-designer .wd-icon-btn:hover { background: var(--wd-soft); }

/* ---------- Hovedområde ---------- */
#wd-designer .wd-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

#wd-designer .wd-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	padding: 6px;
	border: 1px solid var(--wd-line);
	border-radius: var(--wd-radius);
	background: #fff;
}
#wd-designer .wd-tool { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 6px; font-size: 13px; color: var(--wd-ink); }
#wd-designer .wd-tool:hover { background: var(--wd-soft); }
#wd-designer .wd-tool.is-active { background: #eff6ff; color: var(--wd-accent); box-shadow: inset 0 0 0 1px #bfdbfe; }
#wd-designer .wd-tool-danger { margin-left: auto; color: var(--wd-danger); }
#wd-designer .wd-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--wd-line); }
#wd-designer .wd-bg-pick { display: flex; gap: 4px; padding: 0 6px; }
#wd-designer .wd-bg-pick button { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .2); }
#wd-designer .wd-bg-pick button.is-active { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--wd-accent); }
#wd-designer .wd-bg-checker { background: repeating-conic-gradient(#d1d5db 0 25%, #fff 0 50%) 0 0 / 8px 8px !important; }

#wd-designer .wd-canvas-wrap {
	position: relative;
	height: clamp(360px, 62vh, 680px);
	border: 1px solid var(--wd-line);
	border-radius: var(--wd-radius);
	background: #e9edf2;
	overflow: hidden;
	touch-action: none;
}
#wd-designer .wd-zoom {
	position: absolute;
	right: 10px;
	bottom: 10px;
	padding: 3px 8px;
	border-radius: 6px;
	background: rgba(15, 23, 42, .65);
	color: #fff;
	font-size: 12px;
	pointer-events: none;
}
#wd-designer .wd-loader {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: rgba(255, 255, 255, .85);
	backdrop-filter: blur(3px);
	color: var(--wd-ink);
	font-weight: 600;
	transition: opacity .25s;
}
#wd-designer .wd-loader.is-hidden { opacity: 0; pointer-events: none; }
#wd-designer .wd-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid #dbeafe;
	border-top-color: var(--wd-accent);
	border-radius: 50%;
	animation: wd-spin .9s linear infinite;
}
@keyframes wd-spin { to { transform: rotate(360deg); } }

#wd-designer .wd-restore,
#wd-designer .wd-warnings {
	padding: 10px 14px;
	border-radius: var(--wd-radius);
	font-size: 13px;
}
#wd-designer .wd-restore { background: #eff6ff; border: 1px solid #bfdbfe; }
#wd-designer .wd-warnings { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
#wd-designer .wd-warnings p { margin: 0; }
#wd-designer .wd-warnings p + p { margin-top: 4px; }

/* ---------- Oppsummering og pris ---------- */
#wd-designer .wd-summary {
	display: grid;
	grid-template-columns: 1fr auto auto;
	align-items: center;
	gap: 20px;
	padding: 16px 18px;
	border: 1px solid var(--wd-line);
	border-radius: var(--wd-radius);
	background: #fff;
}
#wd-designer .wd-summary-info { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; }
#wd-designer .wd-summary-info span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--wd-muted); }
#wd-designer .wd-summary-info strong { font-size: 15px; }
#wd-designer .wd-summary-info .wd-check { margin: 0; flex-basis: 100%; }
#wd-designer .wd-price { text-align: right; }
#wd-designer .wd-price-label { display: block; font-size: 12px; color: var(--wd-muted); }
#wd-designer .wd-price-total { display: block; font-size: 26px; line-height: 1.1; font-weight: 700; }
#wd-designer .wd-badge { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 99px; background: #dcfce7; color: #166534; font-size: 12px; font-weight: 600; }
#wd-designer .wd-price-details { margin-top: 4px; font-size: 12px; text-align: left; }
#wd-designer .wd-price-details summary { cursor: pointer; color: var(--wd-accent); text-align: right; }
#wd-designer .wd-price-details ul { min-width: 240px; margin: 6px 0 0; padding: 0; list-style: none; }
#wd-designer .wd-price-details li { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border-bottom: 1px dashed var(--wd-line); }
#wd-designer .wd-buy { display: flex; gap: 8px; align-items: center; }
#wd-designer .wd-qty { width: 72px; text-align: center; }

/* ---------- Stilknapper, global farge ---------- */
#wd-designer .wd-style button { min-width: 38px; font-size: 15px; }
#wd-designer .wd-swatches-lg .wd-swatch { width: 40px; height: 40px; }
#wd-designer .wd-color-name { margin: 12px 0 0; font-weight: 600; }
#wd-designer .wd-hint-top { margin: 0 0 12px; }
#wd-designer .wd-label small { text-transform: none; font-weight: 400; letter-spacing: 0; }

/* ---------- Meny over valgt element ---------- */
#wd-designer .wd-objbar {
	position: absolute;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 4px;
	background: #fff;
	border: 1px solid var(--wd-line);
	border-radius: 10px;
	box-shadow: 0 6px 20px rgba(15, 23, 42, .14);
	white-space: nowrap;
}
#wd-designer .wd-objbar button {
	min-width: 36px;
	height: 36px;
	padding: 0 9px;
	border-radius: 7px;
	font-size: 17px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}
#wd-designer .wd-objbar button:hover { background: #eff6ff; }
#wd-designer .wd-objbar-edit { font-weight: 600; font-size: 14px !important; }
#wd-designer .wd-objbar-delete { color: var(--wd-danger); }
#wd-designer .wd-objbar-delete:hover { background: #fef2f2 !important; }
#wd-designer .wd-objbar-sep { width: 1px; height: 22px; background: var(--wd-line); margin: 0 3px; }

/* ---------- Avansert (tekst) ---------- */
#wd-designer .wd-advanced { margin-top: 14px; border: 1px solid var(--wd-line); border-radius: 8px; }
#wd-designer .wd-advanced > summary { padding: 9px 12px; font-weight: 600; cursor: pointer; user-select: none; }
#wd-designer .wd-advanced[open] > summary { border-bottom: 1px solid var(--wd-line); }
#wd-designer .wd-advanced-body { padding: 4px 12px 12px; }
#wd-designer .wd-advanced .wd-outline { padding: 0; background: none; }
#wd-designer .wd-reset-advanced { margin-top: 10px; font-size: 12px; }

/* ---------- Høyreklikkmeny ---------- */
#wd-designer .wd-ctx {
	position: fixed;
	z-index: 100000;
	min-width: 220px;
	padding: 6px;
	background: #fff;
	border: 1px solid var(--wd-line);
	border-radius: 10px;
	box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
}
#wd-designer .wd-ctx button {
	display: flex;
	width: 100%;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 7px 10px;
	border-radius: 6px;
	font-size: 13px;
	text-align: left;
}
#wd-designer .wd-ctx button:hover:not(:disabled),
#wd-designer .wd-ctx button:focus-visible { background: #eff6ff; outline: none; }
#wd-designer .wd-ctx button.is-danger { color: var(--wd-danger); }
#wd-designer .wd-ctx button.is-danger:hover { background: #fef2f2; }
#wd-designer .wd-ctx kbd { font: 11px/1 system-ui, sans-serif; color: var(--wd-muted); background: none; box-shadow: none; padding: 0; }
#wd-designer .wd-ctx-sep { height: 1px; margin: 5px 4px; background: var(--wd-line); }

/* ---------- Toast ---------- */
#wd-designer .wd-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 99999;
	max-width: min(92vw, 460px);
	padding: 12px 16px;
	border-radius: 10px;
	background: var(--wd-ink);
	color: #fff;
	font-size: 14px;
	box-shadow: 0 10px 30px rgba(15, 23, 42, .25);
	transform: translate(-50%, 20px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s, transform .2s;
}
#wd-designer .wd-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
#wd-designer .wd-toast[data-type="error"] { background: var(--wd-danger); }
#wd-designer .wd-toast[data-type="warn"] { background: #b45309; }

/* ---------- Fontvelger ---------- */
#wd-designer .wd-font-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
#wd-designer .wd-font-cats button { padding: 5px 10px; border: 1px solid var(--wd-line); border-radius: 99px; background: #fff; font-size: 12px; }
#wd-designer .wd-font-cats button:hover { border-color: var(--wd-accent); }
#wd-designer .wd-font-cats button.is-active { background: var(--wd-accent); border-color: var(--wd-accent); color: #fff; }
#wd-designer #wd-font-search { margin-top: 2px; }
#wd-designer .wd-fonts { grid-template-columns: 1fr; max-height: 260px; }
#wd-designer .wd-font { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
#wd-designer .wd-font-sample { max-width: 100%; font-size: 21px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#wd-designer .wd-font-name { font: 500 11px/1.2 system-ui, -apple-system, Segoe UI, sans-serif; color: var(--wd-muted); }
#wd-designer .wd-fonts-empty { grid-column: 1 / -1; }
#wd-designer .wd-shadow { margin-top: 10px; }

/* ---------- Folietype ---------- */
#wd-designer .wd-materials { display: flex; flex-direction: column; gap: 8px; }
#wd-designer .wd-material {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 2px 10px;
	padding: 12px 14px;
	border: 1px solid var(--wd-line);
	border-radius: 10px;
	background: #fff;
	text-align: left;
}
#wd-designer .wd-material:hover { border-color: var(--wd-accent); }
#wd-designer .wd-material.is-active { border-color: var(--wd-accent); background: #eff6ff; box-shadow: inset 0 0 0 1px var(--wd-accent); }
#wd-designer .wd-material strong { font-size: 15px; }
#wd-designer .wd-material-price { font-weight: 600; color: var(--wd-accent); }
#wd-designer .wd-material small { grid-column: 1 / -1; color: var(--wd-muted); font-size: 12px; }

/* ---------- Tilbehør ---------- */
#wd-designer .wd-addons { padding: 12px 16px; border: 1px solid var(--wd-line); border-radius: var(--wd-radius); background: #fff; }
#wd-designer .wd-addons-title { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--wd-muted); }
#wd-designer .wd-addons-list { display: flex; flex-wrap: wrap; gap: 8px; }
#wd-designer .wd-addon { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border: 1px solid var(--wd-line); border-radius: 8px; cursor: pointer; font-size: 13px; }
#wd-designer .wd-addon:hover { border-color: var(--wd-accent); }
#wd-designer .wd-addon:has(input:checked) { border-color: var(--wd-accent); background: #eff6ff; }
#wd-designer .wd-addon input { width: auto; min-height: 0; margin: 0; accent-color: var(--wd-accent); }
#wd-designer .wd-addon img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
#wd-designer .wd-addon-price { color: var(--wd-muted); white-space: nowrap; }

/* ---------- Se på foto ---------- */
#wd-designer .wd-tool-accent { color: var(--wd-accent); font-weight: 600; }
#wd-designer .wd-mockup {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	background: #0f172a;
}
#wd-designer .wd-mockup-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
#wd-designer .wd-mockup-photo { position: absolute; max-width: none; user-select: none; pointer-events: none; }
#wd-designer .wd-mockup-design { position: absolute; cursor: move; touch-action: none; outline: 1px dashed transparent; }
#wd-designer .wd-mockup-design:hover,
#wd-designer .wd-mockup-design.is-dragging { outline-color: rgba(255, 255, 255, .8); }
#wd-designer .wd-mockup-design img { display: block; width: 100%; height: 100%; max-width: none; user-select: none; pointer-events: none; }
#wd-designer .wd-mockup-handle {
	position: absolute;
	right: -9px;
	bottom: -9px;
	width: 18px;
	height: 18px;
	border: 2px solid var(--wd-accent);
	border-radius: 50%;
	background: #fff;
	cursor: nwse-resize;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
#wd-designer .wd-mockup-size {
	position: absolute;
	left: 50%;
	top: 10px;
	transform: translateX(-50%);
	padding: 4px 10px;
	border-radius: 99px;
	background: rgba(15, 23, 42, .75);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	pointer-events: none;
	white-space: nowrap;
}
#wd-designer .wd-mockup-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #fff; border-top: 1px solid var(--wd-line); }
#wd-designer .wd-mockup-thumbs { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; }
#wd-designer .wd-mockup-thumbs button { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 1px solid var(--wd-line); border-radius: 8px; background: #fff; font-size: 12px; }
#wd-designer .wd-mockup-thumbs button.is-active { border-color: var(--wd-accent); box-shadow: inset 0 0 0 1px var(--wd-accent); }
#wd-designer .wd-mockup-thumbs img { width: 44px; height: 32px; object-fit: cover; border-radius: 5px; }
#wd-designer .wd-mockup-fixed { width: auto; flex: 0 0 auto; }
#wd-designer .wd-mockup-hint { margin: 0; padding: 0 10px 8px; background: #fff; font-size: 12px; color: var(--wd-muted); }

/* ---------- Lagre / del ---------- */
#wd-designer .wd-modal {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(15, 23, 42, .5);
}
#wd-designer .wd-modal-box { position: relative; width: min(100%, 460px); max-height: 100%; overflow-y: auto; padding: 22px; border-radius: 14px; background: #fff; box-shadow: 0 20px 50px rgba(15, 23, 42, .3); }
#wd-designer .wd-modal-box h3 { margin: 0 30px 10px 0; font-size: 18px; }
#wd-designer .wd-modal-box p { margin: 0 0 6px; }
#wd-designer .wd-modal-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 8px; font-size: 16px; }
#wd-designer .wd-modal-close:hover { background: var(--wd-soft); }
#wd-designer .wd-share-row { display: flex; gap: 8px; }
#wd-designer .wd-share-row .wd-btn { flex: 0 0 auto; }

/* ---------- Mobil / nettbrett (Astras brytpunkt 921px) ---------- */
@media (max-width: 921px) {
	#wd-designer .wd-mockup-bar { flex-wrap: wrap; }
	#wd-designer .wd-mockup-bar .wd-btn { flex: 1 0 100%; }
	#wd-designer { grid-template-columns: 1fr; padding-bottom: 84px; }
	#wd-designer .wd-main { order: -1; }

	/* Menyen blir en fast ikonlinje nederst; panelene glir opp over den (bunnark). */
	#wd-designer .wd-sidebar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 9990;
		min-height: 0;
		border: 0;
		border-top: 1px solid var(--wd-line);
		border-radius: 0;
		overflow: visible;
		box-shadow: 0 -4px 18px rgba(15, 23, 42, .08);
	}
	#wd-designer .wd-menu { flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; }
	#wd-designer .wd-menu-item {
		flex: 1 0 auto;
		flex-direction: column;
		gap: 3px;
		width: auto;
		min-width: 66px;
		padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
		border-bottom: 0;
		text-align: center;
	}
	#wd-designer .wd-mi-icon { flex: 0 0 auto; width: 34px; height: 34px; font-size: 17px; }
	#wd-designer .wd-mi-text strong { font-size: 11px; }
	#wd-designer .wd-mi-text small,
	#wd-designer .wd-mi-arrow { display: none; }

	#wd-designer .wd-panels { inset: auto 0 100% 0; height: 0; overflow: visible; }
	#wd-designer .wd-panel {
		inset: auto 0 0 0;
		max-height: 50vh;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -10px 30px rgba(15, 23, 42, .18);
		animation-name: wd-slide-up;
	}
	@keyframes wd-slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
	#wd-designer .wd-panel-head h3 { padding-right: 0; text-align: left; }

	#wd-designer .wd-tool-label,
	#wd-designer .wd-objbar-edit span { display: none; }
	#wd-designer .wd-toolbar { gap: 2px; }
	#wd-designer .wd-canvas-wrap { height: clamp(300px, 55vh, 520px); }
	#wd-designer .wd-summary { grid-template-columns: 1fr; text-align: left; }
	#wd-designer .wd-price { text-align: left; }
	#wd-designer .wd-price-details summary { text-align: left; }
	#wd-designer .wd-buy .wd-btn { flex: 1; }
	#wd-designer .wd-tool-danger { margin-left: 0; }
}

/* ---------- Produktsiden: sammendraget i full bredde under designeren ---------- */
.wd-designer-page div.product div.summary,
.wd-designer-page.woocommerce div.product div.summary,
.wd-designer-page.woocommerce-js div.product div.summary,
.wd-designer-page .ast-woocommerce-container div.product div.summary {
	float: none !important;
	width: 100% !important;
	max-width: 100% !important;
	clear: both;
	margin-left: 0 !important;
}
.wd-designer-page div.product div.images { display: none !important; }

/* Child-tema/blokkmaler som deler produktsiden i kolonner (bilde | sammendrag):
   stable kolonnene slik at sammendraget får full bredde under designeren. */
body.wd-designer-page .ast-woocommerce-container > .wp-block-columns,
body.wd-designer-page .wp-block-columns:has(.summary) {
	flex-wrap: wrap !important;
}
/* Høy spesifisitet: child-temaet låser kolonnene til 45 % / 50 % med !important. */
body.wd-designer-page.single-product .wp-block-columns.wp-block-columns > .wp-block-column.wp-block-column,
body.wd-designer-page .wp-block-columns.wp-block-columns:has(.summary) > .wp-block-column.wp-block-column {
	flex-basis: 100% !important;
	width: 100% !important;
	max-width: 100% !important;
	flex-grow: 1 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}
/* Bildekolonnen er tom når galleriet er fjernet (sammendraget ligger i en annen kolonne). */
body.wd-designer-page .wp-block-column.wp-block-column:has(> div.product):not(:has(.summary)) {
	display: none !important;
}
.wd-from { font-size: .85em; font-weight: 400; }

/* Designersider: designeren har egen kjøpsknapp og antall, så WooCommerce sine skjules.
   Tittel, pris, variantvalg og andre felt i skjemaet (f.eks. tilleggsvalg) vises fortsatt.
   Knappen ligger skjult i DOM-en og trykkes av designeren. */
body.wd-designer-page form.cart .quantity,
body.wd-designer-page form.cart .single_add_to_cart_button,
body.wd-designer-page form.cart .qty_and_buybtn,
.wd-cart-form form.cart .quantity,
.wd-cart-form form.cart .single_add_to_cart_button {
	display: none !important;
}

/* Redigering fra handlekurven: skjul produktinfo, antall, kjøpsknapp, faner og relaterte
   produkter. Skjemaet er fortsatt i DOM-en – designerens «Oppdater i handlekurven» bruker det. */
body.wd-editing div.product div.summary,
body.wd-editing .summary.entry-summary,
body.wd-editing .wp-block-column.wp-block-column:has(.summary),
body.wd-editing .woocommerce-tabs,
body.wd-editing .related.products,
body.wd-editing .upsells.products {
	display: none !important;
}

/* Kortkode på vanlig side: enkle produkter bruker designerens egen kjøpsknapp. */
.wd-cart-form--hidden { display: none !important; }
.wd-cart-form { margin: 0 0 40px; }
