/*
 * Center-BOX Multi-BOX Form – front-end styles
 * Author: Łukasz Rostalski  |  v1.0.0
 */

/* ── Variables ─────────────────────────────────────────────────── */
.cbmf-wrap {
	--cbmf-accent:      #c8402a;
	--cbmf-accent-lt:   rgba(200,64,42,.08);
	--cbmf-accent-dk:   #a33220;
	--cbmf-ink:         #1a1a1a;
	--cbmf-ink-muted:   #5a5a5a;
	--cbmf-ink-faint:   #9a9a9a;
	--cbmf-border:      #dde0e5;
	--cbmf-surface:     #ffffff;
	--cbmf-surface-alt: #f6f5f1;
	--cbmf-radius:      6px;
	--cbmf-radius-lg:   12px;
	--cbmf-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

	font-family:   var(--cbmf-font);
	color:         var(--cbmf-ink);
	line-height:   1.55;
	font-size:     16px;
	box-sizing:    border-box;
}
.cbmf-wrap *, .cbmf-wrap *::before, .cbmf-wrap *::after { box-sizing: inherit; }

/* ── Inner card ─────────────────────────────────────────────────── */
.cbmf-inner {
	background:    var(--cbmf-surface);
	border:        1px solid var(--cbmf-border);
	border-radius: var(--cbmf-radius-lg);
	overflow:      hidden;
}

/* ── Header ─────────────────────────────────────────────────────── */
.cbmf-header {
	background:    var(--cbmf-accent);
	padding:       28px 32px;
	color:         #fff;
}
.cbmf-form-title {
	font-size:   24px;
	font-weight: 700;
	margin:      0 0 6px;
	color:       #fff;
	line-height: 1.2;
}
.cbmf-form-subtitle {
	font-size:   15px;
	opacity:     .85;
	margin:      0;
	line-height: 1.55;
}

/* ── Form body ──────────────────────────────────────────────────── */
.cbmf-form  { padding: 0 28px 0; }
.cbmf-sections { padding-top: 8px; }

/* ── Section ────────────────────────────────────────────────────── */
.cbmf-section {
	padding:       22px 0 4px;
	border-bottom: 1px solid var(--cbmf-border);
}
.cbmf-section:last-child { border-bottom: none; }

.cbmf-section-title {
	font-size:      13px;
	font-weight:    700;
	text-transform: uppercase;
	letter-spacing: .6px;
	color:          var(--cbmf-accent);
	margin:         0 0 16px;
	padding-bottom: 8px;
	border-bottom:  2px solid var(--cbmf-accent-lt);
}

/* ── Field wrapper ──────────────────────────────────────────────── */
.cbmf-field { margin-bottom: 16px; }
.cbmf-field:last-child { margin-bottom: 0; }

.cbmf-label {
	display:        block;
	font-size:      13px;
	font-weight:    600;
	color:          var(--cbmf-ink-muted);
	margin-bottom:  6px;
}
.cbmf-req { color: var(--cbmf-accent); }

.cbmf-hint {
	font-size:   12px;
	color:       var(--cbmf-ink-faint);
	margin-top:  5px;
	line-height: 1.45;
}

/* ── Text / email / tel / textarea ─────────────────────────────── */
.cbmf-input,
.cbmf-select,
.cbmf-textarea {
	width:       100%;
	padding:     10px 13px;
	border:      1.5px solid var(--cbmf-border);
	border-radius: var(--cbmf-radius);
	font-family: var(--cbmf-font);
	font-size:   15px;
	color:       var(--cbmf-ink);
	background:  var(--cbmf-surface);
	outline:     none;
	transition:  border-color .15s, box-shadow .15s;
	appearance:  none;
	-webkit-appearance: none;
	line-height: 1.4;
}
.cbmf-input:focus,
.cbmf-select:focus,
.cbmf-textarea:focus {
	border-color: var(--cbmf-accent);
	box-shadow:   0 0 0 3px rgba(200,64,42,.12);
}
.cbmf-input.is-error,
.cbmf-select.is-error,
.cbmf-textarea.is-error {
	border-color: #c0392b;
	box-shadow:   0 0 0 3px rgba(192,57,43,.12);
}

.cbmf-select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a5a5a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat:   no-repeat;
	background-position: right 11px center;
	padding-right: 36px;
}

.cbmf-textarea { resize: vertical; min-height: 88px; }

/* ── 2-column grid for contact fields ──────────────────────────── */
.cbmf-field-grid {
	display:               grid;
	grid-template-columns: 1fr 1fr;
	gap:                   0 20px;
}

/* ── Range slider ───────────────────────────────────────────────── */
.cbmf-range-display {
	font-size:   28px;
	font-weight: 700;
	color:       var(--cbmf-accent);
	text-align:  center;
	line-height: 1;
	margin-bottom: 8px;
}
.cbmf-range-input {
	width:  100%;
	cursor: pointer;
	accent-color: var(--cbmf-accent);
}
.cbmf-range-labels {
	display:         flex;
	justify-content: space-between;
	font-size:       12px;
	color:           var(--cbmf-ink-faint);
	margin-top:      3px;
}

/* ── Radio / Checkbox options ───────────────────────────────────── */
.cbmf-options { display: flex; flex-direction: column; gap: 8px; }

.cbmf-option {
	display:       flex;
	align-items:   flex-start;
	gap:           10px;
	padding:       10px 14px;
	border:        1.5px solid var(--cbmf-border);
	border-radius: var(--cbmf-radius);
	cursor:        pointer;
	transition:    border-color .15s, background .15s;
	user-select:   none;
	line-height:   1.4;
}
.cbmf-option:hover       { border-color: var(--cbmf-accent); background: var(--cbmf-accent-lt); }
.cbmf-option.is-selected { border-color: var(--cbmf-accent); background: var(--cbmf-accent-lt); }

.cbmf-option input[type="radio"],
.cbmf-option input[type="checkbox"] {
	width:        16px;
	height:       16px;
	cursor:       pointer;
	flex-shrink:  0;
	margin-top:   2px;
	accent-color: var(--cbmf-accent);
}

.cbmf-option-text { font-size: 14px; font-weight: 500; }
.cbmf-option-surcharge {
	display:     block;
	font-size:   12px;
	font-weight: 400;
	color:       var(--cbmf-accent);
	margin-top:  2px;
}

/* ── RAL picker (embedded) ──────────────────────────────────────── */
.cbmf-ral-wrap {
	border:        1.5px solid var(--cbmf-border);
	border-radius: var(--cbmf-radius-lg);
	overflow:      hidden;
}
.cbmf-ral-toolbar {
	padding:  12px 14px 10px;
	display:  flex;
	flex-wrap: wrap;
	gap:      8px;
	align-items: center;
	background: var(--cbmf-surface-alt);
	border-bottom: 1px solid var(--cbmf-border);
}
.cbmf-ral-search {
	flex:         1 1 180px;
	min-width:    0;
	max-width:    300px;
	padding:      8px 12px;
	border:       1.5px solid var(--cbmf-border);
	border-radius: var(--cbmf-radius);
	font-family:  var(--cbmf-font);
	font-size:    13px;
	outline:      none;
	background:   var(--cbmf-surface);
}
.cbmf-ral-search:focus { border-color: var(--cbmf-accent); }

.cbmf-ral-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.cbmf-ral-filter {
	padding:       5px 11px;
	border-radius: 16px;
	border:        1.5px solid var(--cbmf-border);
	background:    var(--cbmf-surface);
	font-family:   var(--cbmf-font);
	font-size:     12px;
	font-weight:   600;
	color:         var(--cbmf-ink-muted);
	cursor:        pointer;
	transition:    .15s;
	white-space:   nowrap;
}
.cbmf-ral-filter:hover, .cbmf-ral-filter.active {
	background:   var(--cbmf-accent);
	border-color: var(--cbmf-accent);
	color:        #fff;
}

.cbmf-ral-grid {
	display:               grid;
	grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
	gap:                   4px;
	padding:               10px;
	max-height:            320px;
	overflow-y:            auto;
}

.cbmf-ral-swatch {
	border-radius:  5px;
	border:         2px solid transparent;
	cursor:         pointer;
	overflow:       hidden;
	transition:     transform .12s, border-color .12s;
	background:     var(--cbmf-surface);
	display:        block;
	width:          100%;
	padding:        0;
	appearance:     none;
	-webkit-appearance: none;
}
.cbmf-ral-swatch:hover      { transform: scale(1.06); border-color: var(--cbmf-accent); }
.cbmf-ral-swatch.is-selected{ border-color: var(--cbmf-accent); transform: scale(1.06); box-shadow: 0 0 0 3px rgba(200,64,42,.25); }

.cbmf-ral-color { display: block; width: 100%; aspect-ratio: 1; }
.cbmf-ral-label { display: block; padding: 3px 2px 4px; text-align: center; font-size: 9px; font-weight: 700; line-height: 1.25; }
.cbmf-ral-name  { display: block; font-size: 8px; font-weight: 400; color: var(--cbmf-ink-muted); margin-top: 1px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.cbmf-ral-selected {
	display:       flex;
	align-items:   center;
	gap:           12px;
	padding:       12px 14px;
	background:    var(--cbmf-accent-lt);
	border-top:    1px solid var(--cbmf-border);
}
.cbmf-ral-selected.hidden { display: none; }
.cbmf-ral-sel-swatch {
	width:         40px;
	height:        40px;
	border-radius: 8px;
	border:        1px solid rgba(0,0,0,.12);
	flex-shrink:   0;
}
.cbmf-ral-sel-name  { font-size: 14px; font-weight: 700; }
.cbmf-ral-sel-code  { font-size: 12px; color: var(--cbmf-ink-muted); }

/* ── Price summary ──────────────────────────────────────────────── */
.cbmf-price-summary {
	margin:        20px 0;
	background:    var(--cbmf-surface-alt);
	border-radius: var(--cbmf-radius);
	padding:       16px 20px;
	border:        1px solid var(--cbmf-border);
}
.cbmf-price-row {
	display:         flex;
	justify-content: space-between;
	align-items:     baseline;
	font-size:       14px;
	padding:         4px 0;
	gap:             12px;
}
.cbmf-price-row--total {
	border-top:  2px solid var(--cbmf-border);
	margin-top:  8px;
	padding-top: 10px;
	font-weight: 700;
	font-size:   17px;
	color:       var(--cbmf-accent);
}
.cbmf-price-row small { font-size: 12px; font-weight: 400; color: var(--cbmf-ink-muted); }
.cbmf-price-note { font-size: 12px; color: var(--cbmf-ink-faint); margin: 8px 0 0; }

/* ── Submit area ────────────────────────────────────────────────── */
.cbmf-submit-area {
	padding:    20px 0 28px;
}

.cbmf-consent {
	display:     flex;
	align-items: flex-start;
	gap:         10px;
	font-size:   13px;
	color:       var(--cbmf-ink-muted);
	cursor:      pointer;
	margin-bottom: 18px;
	line-height: 1.5;
}
.cbmf-consent input[type="checkbox"] {
	width:        16px;
	height:       16px;
	flex-shrink:  0;
	margin-top:   2px;
	accent-color: var(--cbmf-accent);
	cursor:       pointer;
}

.cbmf-submit-btn {
	width:         100%;
	padding:       15px 20px;
	background:    var(--cbmf-accent);
	color:         #fff;
	border:        none;
	border-radius: var(--cbmf-radius-lg);
	font-family:   var(--cbmf-font);
	font-size:     17px;
	font-weight:   700;
	cursor:        pointer;
	transition:    background .15s, transform .1s;
	letter-spacing: .2px;
}
.cbmf-submit-btn:hover   { background: var(--cbmf-accent-dk); }
.cbmf-submit-btn:active  { transform: scale(.99); }
.cbmf-submit-btn:disabled{ opacity: .65; cursor: not-allowed; }

.cbmf-privacy {
	text-align:  center;
	font-size:   12px;
	color:       var(--cbmf-ink-faint);
	margin:      10px 0 0;
}

/* ── Error / success messages ───────────────────────────────────── */
.cbmf-form-error {
	background:    #fef2f2;
	border:        1px solid #fca5a5;
	border-radius: var(--cbmf-radius);
	color:         #991b1b;
	padding:       12px 16px;
	font-size:     14px;
	margin-bottom: 16px;
}

.cbmf-success {
	padding:    40px 32px;
	text-align: center;
}
.cbmf-success-icon  { font-size: 48px; margin-bottom: 14px; }
.cbmf-success-title {
	font-size:   24px;
	font-weight: 700;
	color:       var(--cbmf-ink);
	margin:      0 0 10px;
}
.cbmf-success-msg   { font-size: 15px; color: var(--cbmf-ink-muted); margin: 0 0 16px; }
.cbmf-success-contact { font-size: 15px; color: var(--cbmf-ink-muted); }
.cbmf-success-contact a { color: var(--cbmf-accent); font-weight: 700; text-decoration: none; }

/* ── Conditional field animation ───────────────────────────────── */
.cbmf-field[data-conditional] { display: none; }
.cbmf-field[data-conditional].is-visible { display: block; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.cbmf-header  { padding: 20px 18px; }
	.cbmf-form    { padding: 0 16px; }
	.cbmf-success { padding: 28px 18px; }
	.cbmf-form-title  { font-size: 20px; }
	.cbmf-section-title { font-size: 12px; }

	.cbmf-field-grid { grid-template-columns: 1fr; gap: 0; }

	.cbmf-ral-grid  { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); max-height: 260px; }
	.cbmf-ral-search { max-width: 100%; }

	.cbmf-range-display { font-size: 24px; }
	.cbmf-submit-btn    { font-size: 16px; padding: 14px; }
}

@media (max-width: 400px) {
	.cbmf-ral-grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
}

/* ── Option image thumbnail ─────────────────────────────────────── */
.cbmf-option {
	gap: 12px;
}
.cbmf-option-img-wrap {
	flex-shrink:   0;
	width:         64px;
	height:        64px;
	border-radius: 6px;
	overflow:      hidden;
	border:        1px solid var(--cbmf-border);
	background:    var(--cbmf-surface-alt);
	display:       flex;
	align-items:   center;
	justify-content: center;
}
.cbmf-option-img {
	width:      100%;
	height:     100%;
	object-fit: cover;
	display:    block;
}
.cbmf-option.is-selected .cbmf-option-img-wrap {
	border-color: var(--cbmf-accent);
}
.cbmf-option-icon-wrap {
	font-size:   28px;
	line-height: 1;
}

/* ── Option text block ──────────────────────────────────────────── */
.cbmf-option-text-block {
	display:        flex;
	flex-direction: column;
	gap:            2px;
	flex:           1;
	min-width:      0;
}
.cbmf-option-label {
	font-size:   14px;
	font-weight: 600;
	color:       var(--cbmf-ink);
	line-height: 1.3;
}
.cbmf-option-sublabel {
	font-size:   12px;
	font-weight: 400;
	color:       var(--cbmf-ink-muted);
	line-height: 1.4;
}
.cbmf-option-surcharge {
	font-size:   12px;
	font-weight: 600;
	color:       var(--cbmf-accent);
	margin-top:  2px;
}

/* ── RAL swatch label parts ─────────────────────────────────────── */
.cbmf-ral-code {
	display:     block;
	font-size:   9.5px;
	font-weight: 700;
	line-height: 1.2;
}
.cbmf-ral-name {
	display:     block;
	font-size:   8.5px;
	font-weight: 400;
	color:       var(--cbmf-ink-muted);
	margin-top:  1px;
	overflow:    hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* ── Selected RAL info ──────────────────────────────────────────── */
.cbmf-ral-sel-info {
	display:        flex;
	flex-direction: column;
	gap:            2px;
}
.cbmf-ral-sel-name {
	font-size:   14px;
	font-weight: 700;
}
.cbmf-ral-sel-code {
	font-size:  12px;
	color:      var(--cbmf-ink-muted);
}

/* ── Error highlight on radio groups ───────────────────────────── */
.cbmf-options.is-error {
	border:        2px solid #e74c3c;
	border-radius: var(--cbmf-radius);
	padding:       4px;
}

/* ── Responsive: option images smaller on mobile ────────────────── */
@media (max-width: 480px) {
	.cbmf-option-img-wrap {
		width:  48px;
		height: 48px;
	}
	.cbmf-option-label   { font-size: 13px; }
	.cbmf-option-sublabel{ font-size: 11px; }
}

/* ── Select sublabel (shown after choice) ───────────────────────── */
.cbmf-select-sublabel {
	font-size:   12px;
	color:       var(--cbmf-accent);
	font-weight: 600;
	margin:      5px 0 0;
	padding:     5px 10px;
	background:  var(--cbmf-accent-lt);
	border-radius: var(--cbmf-radius);
	border-left: 3px solid var(--cbmf-accent);
}

/* ── Price summary tweaks ───────────────────────────────────────── */
.cbmf-price-row--total .cbmf-price-brutto-note {
	font-size:   11px;
	font-weight: 400;
	color:       var(--cbmf-ink-muted);
	margin-left: 4px;
}
