/**
 * VMS Product Add-Ons — Frontend Styles
 *
 * All classes use the vms-addon- prefix.
 * Typography inherits from parent (Elementor/theme).
 * Checkbox color configurable via --vms-addon-checkbox-color CSS variable.
 */

/* =========================================================================
   Wrapper
   ========================================================================= */

.vms-addon-wrapper {
	margin: 1.5em 0;
	padding: 0;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	color: inherit;
}

/* =========================================================================
   Hide WooCommerce variation price — shown in totals instead
   ========================================================================= */

.vms-addon-wrapper ~ .woocommerce-variation-price,
.woocommerce-variation.single_variation .woocommerce-variation-price {
	display: none !important;
}

/* =========================================================================
   Section heading ("Tilleggsutstyr")
   ========================================================================= */

/* Heading uses Elementor global heading typography */
.vms-addon-heading {
	font-family: var(--e-global-typography-49e810e-font-family, inherit), Sans-serif;
	font-size: var(--e-global-typography-49e810e-font-size, 1.1em);
	font-weight: var(--e-global-typography-49e810e-font-weight, 600);
	text-transform: var(--e-global-typography-49e810e-text-transform, none);
	line-height: var(--e-global-typography-49e810e-line-height, 1.3);
	color: var(--e-global-color-eda96c6, inherit);
	margin: 0 0 0.6em;
	padding: 0;
}

/* =========================================================================
   Field list — flat list, no bullets, no indentation
   ========================================================================= */

.vms-addon-wrapper,
.vms-addon-wrapper ul,
.vms-addon-wrapper li {
	list-style: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

/* =========================================================================
   Collapse container
   ========================================================================= */

.vms-addon-group-content {
	position: relative;
	overflow: hidden;
	transition: max-height 0.5s ease-in-out;
}

.vms-addon-group-content.collapsed {
	max-height: 250px;
}

.vms-addon-group-content.expanded {
	max-height: none;
}

/* Gradient overlay */
.vms-addon-fade-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 120px;
	background: linear-gradient(transparent, rgba(255, 255, 255, 0.3) 30%, rgba(255, 255, 255, 0.8) 60%, white);
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.vms-addon-fade-overlay.hidden {
	opacity: 0;
}

/* Toggle button */
.vms-addon-toggle-btn {
	display: flex !important;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: -10px auto 0;
	padding: 8px 16px;
	background: transparent !important;
	border: none !important;
	color: #666 !important;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: color 0.3s ease;
	position: relative;
	z-index: 10;
}

.vms-addon-toggle-btn:hover {
	color: #333 !important;
}

.vms-addon-toggle-icon {
	transition: transform 0.3s ease;
	font-size: 16px;
}

.vms-addon-toggle-btn.expanded .vms-addon-toggle-icon {
	transform: rotate(180deg);
}

/* =========================================================================
   Fields — spacing
   ========================================================================= */

.vms-addon-field {
	margin-bottom: 12px;
	padding: 0;
	transition: opacity 0.2s ease;
}

.vms-addon-field.vms-addon-hidden {
	display: none !important;
}

/* =========================================================================
   Checkbox — PEWC-style custom checkmark (hidden native input)
   Uses high specificity to override theme styles.
   ========================================================================= */

.vms-addon-wrapper .vms-addon-checkbox-label {
	padding-left: 30px !important;
	position: relative;
	cursor: pointer;
	font-size: inherit;
	line-height: 1.5;
	display: block;
	margin-bottom: 0;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

/* Hide native checkbox — must win over theme styles */
.vms-addon-wrapper .vms-addon-checkbox-label input[type="checkbox"] {
	position: absolute !important;
	opacity: 0 !important;
	cursor: pointer;
	height: 0 !important;
	width: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* Custom checkmark box — 20px to match PEWC live size */
.vms-addon-wrapper .vms-addon-checkmark {
	content: "";
	position: absolute;
	top: 2px;
	left: 0;
	height: 20px;
	width: 20px;
	background: #eee;
	cursor: pointer;
	transition: background 0.2s;
	display: block;
	border: none;
	border-radius: 0;
}

.vms-addon-wrapper .vms-addon-checkbox-label:hover .vms-addon-checkmark {
	background: #ddd;
}

/* Checked state — color from CSS variable (configurable in WooCommerce settings) */
.vms-addon-wrapper .vms-addon-checkbox-label input:checked ~ .vms-addon-checkmark {
	background: var(--vms-addon-checkbox-color, #bfa775);
}

/* Checkmark icon (white tick) — sized for 20px box */
.vms-addon-wrapper .vms-addon-checkmark:after {
	content: "";
	position: absolute;
	display: none;
	left: 7px;
	top: 3px;
	width: 4px;
	height: 9px;
	border: solid white;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.vms-addon-wrapper .vms-addon-checkbox-label input:checked ~ .vms-addon-checkmark:after {
	display: block;
}

.vms-addon-checkbox-text {
	display: inline;
}

/* =========================================================================
   Radio
   ========================================================================= */

.vms-addon-wrapper .vms-addon-radio-label {
	padding-left: 25px;
	position: relative;
	cursor: pointer;
	font-size: inherit;
	line-height: 1.5;
	display: block;
}

.vms-addon-wrapper .vms-addon-radio-label input[type="radio"] {
	position: absolute;
	left: 0;
	top: 3px;
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: auto;
}

.vms-addon-radio-text {
	display: inline;
}

/* =========================================================================
   Select
   ========================================================================= */

.vms-addon-select-wrapper label {
	display: block;
	font-size: inherit;
	font-weight: 500;
	margin-bottom: 0.3em;
}

.vms-addon-select-wrapper select {
	width: 100%;
	max-width: 400px;
}

/* =========================================================================
   Price display — normal weight, not bold
   ========================================================================= */

.vms-addon-price-display {
	font-weight: normal;
	white-space: nowrap;
}

/* "kr" and price amount must match label text — use Elementor body typography */
.vms-addon-wrapper .woocommerce-Price-amount,
.vms-addon-wrapper .woocommerce-Price-currencySymbol {
	font-family: var(--e-global-typography-3990cb1-font-family, inherit), Sans-serif !important;
	font-size: var(--e-global-typography-3990cb1-font-size, inherit) !important;
	font-weight: var(--e-global-typography-3990cb1-font-weight, normal) !important;
	line-height: var(--e-global-typography-3990cb1-line-height, inherit) !important;
}

/* =========================================================================
   Description
   ========================================================================= */

.vms-addon-description {
	display: block;
	color: #888;
	font-size: 0.85em;
	margin-top: 0.2em;
	padding-left: 30px;
}

/* =========================================================================
   Required — "(påkrevd)" in normal text color
   ========================================================================= */

.vms-addon-required {
	color: inherit;
	font-weight: inherit;
}

/* =========================================================================
   Totals — PEWC-style: 280px, padding, NO border/bg/shadow
   ========================================================================= */

.vms-addon-totals {
	width: 280px;
	max-width: 100%;
	padding: 1em 0;
	margin-bottom: 1em;
	border: none !important;
	background: none !important;
	box-shadow: none !important;
	border-radius: 0 !important;
}

.vms-addon-totals .vms-addon-totals-row {
	display: flex;
	justify-content: space-between;
	padding: 4px 0;
	margin: 0;
}

.vms-addon-totals .vms-addon-totals-row:last-child {
	margin-bottom: 0;
}

.vms-addon-totals .vms-addon-grand-total {
	font-weight: bold;
	border-top: 1px solid #ddd;
	padding-top: 8px;
	margin-top: 4px;
}

/* Totals typography — inherit from Elementor CSS variables */
.vms-addon-total-label,
.vms-addon-total-value {
	font-family: var(--e-global-typography-404ba0e-font-family, inherit), Sans-serif;
	font-size: var(--e-global-typography-49e810e-font-size, inherit);
	font-weight: var(--e-global-typography-404ba0e-font-weight, inherit);
	line-height: var(--e-global-typography-404ba0e-line-height, inherit);
	color: var(--e-global-color-eda96c6, inherit);
}

.vms-addon-total-value {
	text-align: right;
	margin-left: 10px;
}

/* Override font-weight for grand total values */
.vms-addon-grand-total .vms-addon-total-label,
.vms-addon-grand-total .vms-addon-total-value {
	font-weight: bold;
}

/* =========================================================================
   Variation spacing
   ========================================================================= */

.woocommerce-variation.single_variation {
	margin-bottom: 30px;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 768px) {
	.vms-addon-toggle-btn {
		justify-content: flex-start !important;
		margin-left: 0 !important;
	}
}

@media (max-width: 600px) {
	.vms-addon-wrapper .vms-addon-checkbox-label,
	.vms-addon-wrapper .vms-addon-radio-label {
		font-size: 0.9em;
	}

	.vms-addon-description {
		padding-left: 0;
	}

	.vms-addon-totals {
		width: 100%;
	}
}
