/* Cybrius Product Fields Pro – frontend */
.cpf-wrap {
	--cpf-accent: #1f6feb;
	--cpf-accent-contrast: #fff;
	--cpf-border: #d0d5dd;
	--cpf-radius: 8px;
	--cpf-bg: #fff;
	--cpf-text: inherit;
	--cpf-muted: #667085;
	--cpf-error: #d92d20;
	--cpf-gap: 16px;
	--cpf-swatch-size: 30px;
	--cpf-item-w: 90px;
	--cpf-cols: 3;
	--cpf-cols-t: 3;
	--cpf-cols-m: 3;
	margin: 0 0 1.25em;
	width: 100%;
	clear: both;
	color: var(--cpf-text);
}
.cpf-wrap *, .cpf-wrap *::before, .cpf-wrap *::after { box-sizing: border-box; }

.cpf-group, .cpf-section-body { display: flex; flex-wrap: wrap; gap: var(--cpf-gap) 2%; align-items: flex-start; }
.cpf-group + .cpf-group { margin-top: var(--cpf-gap); }
.cpf-field-wrap { width: 100%; min-width: 0; }
.cpf-hidden { display: none !important; }

.cpf-label { display: block; font-weight: 600; margin: 0 0 6px; line-height: 1.35; }
.cpf-req { color: var(--cpf-error); text-decoration: none; border: 0; cursor: help; }
.cpf-hint { color: var(--cpf-muted); font-weight: 400; font-size: .9em; white-space: nowrap; }
.cpf-desc { color: var(--cpf-muted); font-size: .88em; margin: 4px 0 0; line-height: 1.45; }
.cpf-desc-label .cpf-desc { margin: 0 0 6px; }
.cpf-labels-left .cpf-field:not(.cpf-field--true-false) { display: grid; grid-template-columns: 32% 1fr; column-gap: 12px; align-items: start; }
.cpf-labels-left .cpf-field > .cpf-desc, .cpf-labels-left .cpf-field > .cpf-error { grid-column: 2; }
.cpf-labels-hide .cpf-label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.cpf-wrap input[type=text], .cpf-wrap input[type=email], .cpf-wrap input[type=url], .cpf-wrap input[type=number],
.cpf-wrap select, .cpf-wrap textarea {
	width: 100%; max-width: 100%; border: 1px solid var(--cpf-border); border-radius: var(--cpf-radius);
	background: var(--cpf-bg); padding: 10px 12px; font: inherit; line-height: 1.4; min-height: 44px;
}
.cpf-wrap input:focus-visible, .cpf-wrap select:focus-visible, .cpf-wrap textarea:focus-visible {
	outline: 2px solid var(--cpf-accent); outline-offset: 1px; border-color: var(--cpf-accent);
}
.cpf-has-error input, .cpf-has-error select, .cpf-has-error textarea, .cpf-has-error .cpf-dropzone { border-color: var(--cpf-error) !important; }
.cpf-error { color: var(--cpf-error); font-size: .85em; margin-top: 4px; }
.cpf-error:empty { display: none; }
.cpf-counter { text-align: right; color: var(--cpf-muted); font-size: .8em; margin-top: 2px; }

/* Choices */
.cpf-choices { display: flex; flex-direction: column; gap: 8px; }
.cpf-choice, .cpf-check { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; font-weight: 400; }
.cpf-choice input, .cpf-check input { margin: 0; width: 18px; height: 18px; accent-color: var(--cpf-accent); flex: none; }
.cpf-choice.is-disabled { opacity: .5; cursor: not-allowed; }

/* Number */
.cpf-stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--cpf-border); border-radius: var(--cpf-radius); overflow: hidden; }
.cpf-stepper input[type=number] { border: 0 !important; border-radius: 0; width: 80px; text-align: center; -moz-appearance: textfield; }
.cpf-stepper input::-webkit-outer-spin-button, .cpf-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cpf-step { border: 0; background: #f2f4f7; width: 44px; font-size: 18px; cursor: pointer; color: inherit; padding: 0; }
.cpf-step:hover { background: #e4e7ec; }
.cpf-range-wrap { display: flex; align-items: center; gap: 12px; }
.cpf-range { flex: 1; accent-color: var(--cpf-accent); }
.cpf-range-out { min-width: 3ch; font-weight: 600; }

/* Swatches */
.cpf-sr { position: absolute !important; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.cpf-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.cpf-swatch { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; margin: 0; font-weight: 400; text-align: center; }
.cpf-swatch.is-disabled { opacity: .45; cursor: not-allowed; }
.cpf-swatch:focus-within { outline: 2px solid var(--cpf-accent); outline-offset: 2px; border-radius: var(--cpf-radius); }
.cpf-swatch-caption { font-size: .85em; line-height: 1.3; }

.cpf-swatches--image.cpf-grid-fixed .cpf-swatch { width: var(--cpf-item-w); }
.cpf-swatches--image.cpf-grid-flexible { display: grid; grid-template-columns: repeat(var(--cpf-cols), minmax(0, 1fr)); }
@media (max-width: 1024px) { .cpf-swatches--image.cpf-grid-flexible { grid-template-columns: repeat(var(--cpf-cols-t), minmax(0, 1fr)); } }
@media (max-width: 600px) { .cpf-swatches--image.cpf-grid-flexible { grid-template-columns: repeat(var(--cpf-cols-m), minmax(0, 1fr)); } }
.cpf-swatches--image .cpf-swatch-img { display: block; width: 100%; border: 2px solid var(--cpf-border); border-radius: var(--cpf-radius); overflow: hidden; background: #f9fafb; aspect-ratio: 1; }
.cpf-swatches--image .cpf-swatch-img img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; }
.cpf-swatches--image .is-selected .cpf-swatch-img { border-color: var(--cpf-accent); box-shadow: 0 0 0 2px var(--cpf-accent); }
.cpf-swatches--image.cpf-lp-default .cpf-swatch { border: 2px solid var(--cpf-border); border-radius: var(--cpf-radius); padding: 4px 4px 6px; }
.cpf-swatches--image.cpf-lp-default .cpf-swatch-img { border: 0; }
.cpf-swatches--image.cpf-lp-default .is-selected { border-color: var(--cpf-accent); }
.cpf-swatches--image.cpf-lp-default .is-selected .cpf-swatch-img { box-shadow: none; }

.cpf-swatches--color .cpf-swatch-color { display: block; width: var(--cpf-swatch-size); height: var(--cpf-swatch-size); border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .15s; }
.cpf-shape-square .cpf-swatch-color { border-radius: 0; }
.cpf-shape-rounded .cpf-swatch-color { border-radius: 6px; }
.cpf-swatches--color .is-selected .cpf-swatch-color { outline-color: var(--cpf-accent); }

.cpf-swatches--text .cpf-swatch { flex-direction: row; }
.cpf-swatch-text { display: inline-block; padding: 8px 14px; border: 1px solid var(--cpf-border); border-radius: var(--cpf-radius); background: var(--cpf-bg); min-width: 44px; line-height: 1.3; }
.cpf-swatches--text .is-selected .cpf-swatch-text { background: var(--cpf-accent); color: var(--cpf-accent-contrast); border-color: var(--cpf-accent); }

/* Upload */
.cpf-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 22px 16px; border: 2px dashed var(--cpf-border); border-radius: var(--cpf-radius); cursor: pointer; text-align: center; background: #fcfcfd; margin: 0; font-weight: 400; }
.cpf-dropzone.is-over, .cpf-dropzone:hover { border-color: var(--cpf-accent); background: #f5f8ff; }
.cpf-dropzone input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cpf-dropzone:focus-within { outline: 2px solid var(--cpf-accent); outline-offset: 2px; }
.cpf-dropzone-meta { font-size: .8em; color: var(--cpf-muted); }
.cpf-file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cpf-file-list li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--cpf-border); border-radius: var(--cpf-radius); font-size: .9em; }
.cpf-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpf-file-bar { display: none; width: 80px; height: 4px; background: #eaecf0; border-radius: 2px; overflow: hidden; }
.cpf-file-bar i { display: block; height: 100%; width: 0; background: var(--cpf-accent); transition: width .2s; }
.is-uploading .cpf-file-bar { display: block; }
.cpf-file-remove { text-decoration: none; color: var(--cpf-muted); font-size: 18px; line-height: 1; padding: 0 4px; }
.cpf-upload-login { color: var(--cpf-muted); font-style: italic; }

/* Content, calc */
.cpf-content > :last-child { margin-bottom: 0; }
.cpf-img { max-width: 100%; height: auto; border-radius: var(--cpf-radius); }
.cpf-calc { padding: 10px 12px; background: #f9fafb; border-radius: var(--cpf-radius); }

/* Sections & repeaters */
.cpf-section { padding: 0; }
.cpf-section-title { font-weight: 700; font-size: 1.05em; margin: 0 0 10px; }
.cpf-section[data-repeat], .cpf-section.cpf-clone { border: 1px solid var(--cpf-border); border-radius: var(--cpf-radius); padding: 14px; }
.cpf-clone { position: relative; }
.cpf-repeat-add { margin-top: 2px; }
.cpf-repeat-del { position: absolute; top: 8px; right: 8px; border: 0; background: none; color: var(--cpf-error); cursor: pointer; font-size: .85em; text-decoration: underline; padding: 2px 4px; }
.cpf-field.cpf-clone { padding-right: 70px; }

/* Summary */
.cpf-summary { margin-top: calc(var(--cpf-gap) + 4px); border: 1px solid var(--cpf-border); border-radius: var(--cpf-radius); padding: 12px 14px; background: var(--cpf-bg); }
.cpf-summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.cpf-summary-total { border-top: 1px solid var(--cpf-border); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 1.08em; }

/* Date picker */
.cpf-dp { position: absolute; z-index: 99999; background: #fff; border: 1px solid #d0d5dd; border-radius: 10px; box-shadow: 0 12px 32px rgba(16,24,40,.16); padding: 10px; width: 280px; font-size: 14px; color: #101828; }
.cpf-dp-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.cpf-dp-head button { border: 0; background: #f2f4f7; border-radius: 6px; width: 32px; height: 32px; cursor: pointer; font-size: 18px; line-height: 1; color: inherit; padding: 0; }
.cpf-dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cpf-dp-wd { font-size: 11px; color: #667085; padding: 4px 0; text-transform: uppercase; }
.cpf-dp-day { border: 0; background: none; border-radius: 6px; height: 34px; cursor: pointer; color: inherit; padding: 0; font: inherit; }
.cpf-dp-day:hover:not(:disabled) { background: #f2f4f7; }
.cpf-dp-day.is-today { box-shadow: inset 0 0 0 1px #98a2b3; }
.cpf-dp-day.is-selected { background: var(--cpf-accent, #1f6feb); color: #fff; }
.cpf-dp-day:disabled { color: #d0d5dd; cursor: not-allowed; }
.cpf-dp-foot { text-align: right; margin-top: 6px; }
.cpf-dp-clear { border: 0; background: none; color: #667085; cursor: pointer; text-decoration: underline; font: inherit; }

/* Cart */
.cpf-cart-edit { display: inline-block; margin-top: 4px; font-size: .85em; }

@media (max-width: 600px) {
	.cpf-field-wrap { width: 100% !important; }
	.cpf-labels-left .cpf-field:not(.cpf-field--true-false) { display: block; }
}
@media (prefers-reduced-motion: reduce) { .cpf-wrap * { transition: none !important; } }
