/**
 * BoldForm Pro — Advanced Fields CSS
 *
 * Styles for: password_field, rich_text, date_range, nps, matrix, lookup, geolocation
 * Covers both frontend form rendering and builder canvas previews.
 */

/* =============================================================================
   1. Password Field
   ============================================================================= */

.bf-password-wrap {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.bf-password-field {
	position: relative;
}

.bf-password-field .boldform-lite-form__input {
	padding-right: 44px;
}

.bf-password-toggle {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: #9ca3af;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s;
}

.bf-password-toggle:hover {
	color: #374151;
}

.bf-password-toggle.is-visible {
	color: #6366f1;
}

.bf-password-match-msg {
	margin: 4px 0 0;
	font-size: 12px;
	font-weight: 500;
}

.bf-password-match-msg.is-match {
	color: #16a34a;
}

.bf-password-match-msg.is-mismatch {
	color: #dc2626;
}

/* =============================================================================
   2. Rich Text Editor
   ============================================================================= */

.bf-rte-wrap {
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.bf-rte-toolbar {
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 6px 8px;
	background: #f9fafb;
	border-bottom: 1px solid #e5e7eb;
	flex-wrap: wrap;
}

.bf-rte-toolbar button {
	background: none;
	border: 1px solid transparent;
	border-radius: 4px;
	padding: 4px 8px;
	cursor: pointer;
	font-size: 13px;
	color: #374151;
	line-height: 1.4;
	transition: background 0.1s, border-color 0.1s;
}

.bf-rte-toolbar button:hover {
	background: #e5e7eb;
	border-color: #d1d5db;
}

.bf-rte-toolbar button:active {
	background: #ddd6fe;
	border-color: #a5b4fc;
	color: #4f46e5;
}

.bf-rte-sep {
	display: inline-block;
	width: 1px;
	height: 18px;
	background: #d1d5db;
	margin: 0 4px;
}

.bf-rte-editor {
	flex: 1;
	padding: 10px 12px;
	outline: none;
	font-size: 14px;
	line-height: 1.6;
	color: #111827;
	background: #fff;
	overflow-y: auto;
	word-break: break-word;
}

.bf-rte-editor:empty::before {
	content: attr(data-placeholder);
	color: #9ca3af;
	pointer-events: none;
}

.bf-rte-editor.bf-rte-error {
	outline: 2px solid #ef4444;
	outline-offset: -2px;
}

/* =============================================================================
   3. Date Range Picker
   ============================================================================= */

.bf-daterange-wrap {
	position: relative;
	display: inline-block;
	width: 100%;
}

.bf-daterange-icon {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	color: #9ca3af;
	pointer-events: none;
	line-height: 1;
	display: flex;
	align-items: center;
}

.bf-daterange-input {
	padding-right: 36px;
	cursor: pointer;
}

.bf-daterange-picker {
	position: absolute;
	z-index: 999;
	top: calc(100% + 4px);
	left: 0;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
	padding: 16px;
	min-width: 560px;
}

.bf-daterange-months {
	display: flex;
	gap: 24px;
}

.bf-drp-month {
	flex: 1;
	min-width: 0;
}

.bf-drp-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.bf-drp-month-label {
	font-size: 13px;
	font-weight: 600;
	color: #111827;
}

.bf-drp-nav {
	background: none;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	width: 28px;
	height: 28px;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	color: #6b7280;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.1s, color 0.1s;
}

.bf-drp-nav:hover {
	background: #f3f4f6;
	color: #111827;
}

.bf-drp-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 2px;
}

.bf-drp-dow {
	text-align: center;
	font-size: 11px;
	font-weight: 600;
	color: #9ca3af;
	padding: 4px 0;
	text-transform: uppercase;
}

.bf-drp-day {
	text-align: center;
	padding: 6px 4px;
	font-size: 13px;
	color: #374151;
	cursor: pointer;
	border-radius: 4px;
	transition: background 0.1s, color 0.1s;
	user-select: none;
}

.bf-drp-day:hover {
	background: #ede9fe;
	color: #4f46e5;
}

.bf-drp-day.is-start,
.bf-drp-day.is-end {
	background: #6366f1;
	color: #fff;
	border-radius: 4px;
}

.bf-drp-day.is-in-range {
	background: #e0e7ff;
	color: #3730a3;
	border-radius: 0;
}

.bf-drp-day.is-start {
	border-radius: 4px 0 0 4px;
}

.bf-drp-day.is-end {
	border-radius: 0 4px 4px 0;
}

.bf-drp-day.is-start.is-end {
	border-radius: 4px;
}

.bf-daterange-footer {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid #f3f4f6;
}

.bf-drp-clear {
	background: none;
	border: 1px solid #e5e7eb;
	border-radius: 5px;
	padding: 6px 14px;
	font-size: 13px;
	color: #6b7280;
	cursor: pointer;
	transition: background 0.1s;
}

.bf-drp-clear:hover {
	background: #f3f4f6;
}

.bf-drp-apply {
	background: #6366f1;
	border: 1px solid #6366f1;
	border-radius: 5px;
	padding: 6px 14px;
	font-size: 13px;
	color: #fff;
	cursor: pointer;
	transition: background 0.1s;
}

.bf-drp-apply:hover {
	background: #4f46e5;
	border-color: #4f46e5;
}

/* =============================================================================
   4. NPS Rating
   ============================================================================= */

.bf-nps-wrap {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bf-nps-scale {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
}

.bf-nps-item {
	flex: 1;
	min-width: 0;
	cursor: pointer;
}

.bf-nps-item input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.bf-nps-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-width: 32px;
	height: 40px;
	border: 1px solid #e5e7eb;
	border-radius: 5px;
	font-size: 13px;
	font-weight: 500;
	color: #374151;
	background: #f9fafb;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
	user-select: none;
}

.bf-nps-item:hover .bf-nps-btn {
	border-color: #a5b4fc;
	background: #ede9fe;
	color: #4f46e5;
}

.bf-nps-btn.is-selected.is-detractor {
	background: #fee2e2;
	border-color: #fca5a5;
	color: #b91c1c;
}

.bf-nps-btn.is-selected.is-passive {
	background: #fef9c3;
	border-color: #fde047;
	color: #854d0e;
}

.bf-nps-btn.is-selected.is-promoter {
	background: #dcfce7;
	border-color: #86efac;
	color: #15803d;
}

.bf-nps-labels {
	display: flex;
	justify-content: space-between;
	font-size: 11px;
	color: #9ca3af;
}

/* =============================================================================
   5. Matrix / Grid
   ============================================================================= */

.bf-matrix-wrap {
	overflow-x: auto;
}

.bf-matrix-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.bf-matrix-table thead th {
	padding: 8px 12px;
	text-align: center;
	font-weight: 600;
	color: #374151;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	white-space: nowrap;
}

.bf-matrix-table thead th:first-child {
	text-align: left;
}

.bf-matrix-row-label {
	padding: 8px 12px;
	font-weight: 500;
	color: #374151;
	border: 1px solid #e5e7eb;
	background: #f9fafb;
	white-space: nowrap;
}

.bf-matrix-cell {
	padding: 8px;
	text-align: center;
	border: 1px solid #e5e7eb;
}

.bf-matrix-cell input[type="radio"],
.bf-matrix-cell input[type="checkbox"] {
	width: 16px;
	height: 16px;
	cursor: pointer;
	accent-color: #6366f1;
}

.bf-matrix-table tbody tr:hover td {
	background: #f9fafb;
}

.bf-matrix-empty {
	color: #9ca3af;
	font-style: italic;
	font-size: 13px;
}

/* =============================================================================
   6. Lookup / Autocomplete
   ============================================================================= */

.bf-lookup-wrap {
	position: relative;
}

.bf-lookup-list {
	position: absolute;
	z-index: 999;
	top: calc(100% + 2px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
	list-style: none;
	margin: 0;
	padding: 4px 0;
	max-height: 240px;
	overflow-y: auto;
}

.bf-lookup-item {
	padding: 8px 12px;
	font-size: 14px;
	color: #374151;
	cursor: pointer;
	transition: background 0.1s;
	outline: none;
}

.bf-lookup-item:hover,
.bf-lookup-item:focus {
	background: #ede9fe;
	color: #4f46e5;
}

.bf-lookup-item mark {
	background: #fde68a;
	color: inherit;
	font-weight: 600;
	border-radius: 2px;
	padding: 0 1px;
}

/* =============================================================================
   7. Geolocation
   ============================================================================= */

.bf-geo-wrap {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.bf-geo-controls {
	display: flex;
	gap: 8px;
	align-items: center;
}

.bf-geo-controls .bf-geo-address {
	flex: 1;
	min-width: 0;
}

.bf-geo-detect-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0 14px;
	height: 40px;
	background: #6366f1;
	border: 1px solid #6366f1;
	border-radius: 6px;
	color: #fff;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s, border-color 0.15s;
}

.bf-geo-detect-btn:hover {
	background: #4f46e5;
	border-color: #4f46e5;
}

.bf-geo-detect-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.bf-geo-map {
	display: none;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid #e5e7eb;
	background: #f3f4f6;
}

.bf-geo-status {
	font-size: 12px;
	color: #6b7280;
	margin: 0;
}

.bf-geo-status.is-error {
	color: #dc2626;
}

/* =============================================================================
   8. Builder canvas preview variants
   ============================================================================= */

/* Generic advanced field preview wrapper */
.bf-adv-preview {
	padding: 8px 0;
}

/* Password preview */
.bf-adv-preview .bf-password-wrap {
	pointer-events: none;
}

/* Rich text preview */
.bf-rte-preview {
	pointer-events: none;
}

.bf-rte-preview .bf-rte-toolbar {
	background: #f9fafb;
}

.bf-rte-preview .bf-rte-editor {
	color: #9ca3af;
	font-style: italic;
}

/* NPS preview */
.bf-nps-preview {
	pointer-events: none;
}

/* Matrix preview */
.bf-matrix-preview {
	pointer-events: none;
}

.bf-matrix-preview .bf-matrix-table {
	font-size: 12px;
}

/* Geolocation preview */
.bf-geo-preview {
	pointer-events: none;
}

.bf-geo-preview .bf-geo-detect-btn {
	opacity: 0.7;
}

/* Lookup preview */
.bf-lookup-preview {
	pointer-events: none;
}

/* Date range preview */
.bf-daterange-preview {
	pointer-events: none;
}
