/**
 * Cunnekt Fragrance Gift - Frontend Styles
 * Author: Neeraj Shree
 */

.cfg-configurator-container {
	margin: 1.5rem 0 2rem 0;
	padding: 1.5rem;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
	font-family: inherit;
}

.cfg-section-title {
	margin: 0 0 0.5rem 0;
	font-size: 1.25rem;
	font-weight: 600;
	color: #1f2937;
	letter-spacing: -0.01em;
}

.cfg-section-description {
	margin: 0 0 1.25rem 0;
	font-size: 0.9375rem;
	color: #6b7280;
	line-height: 1.5;
}

/* Selectors Grid */
.cfg-selectors-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
	margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
	.cfg-selectors-grid {
		grid-template-columns: 1fr;
	}
}

.cfg-selector-wrapper {
	display: flex;
	flex-direction: column;
}

.cfg-label {
	display: flex;
	align-items: center;
	margin-bottom: 0.375rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: #374151;
}

.cfg-required-star {
	color: #dc2626;
	margin-left: 0.25rem;
}

.cfg-select-control {
	position: relative;
	width: 100%;
}

.cfg-select {
	display: block;
	width: 100%;
	padding: 0.625rem 2.25rem 0.625rem 0.875rem;
	font-size: 0.9375rem;
	line-height: 1.4;
	color: #111827;
	background-color: #ffffff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
	background-position: right 0.75rem center;
	background-repeat: no-repeat;
	background-size: 1.25rem 1.25rem;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.cfg-select:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.cfg-select:disabled {
	background-color: #f3f4f6;
	color: #9ca3af;
	cursor: not-allowed;
}

/* Custom Select with Product Thumbnails */
.cfg-custom-select {
	position: relative;
	width: 100%;
	user-select: none;
}

.cfg-custom-select-trigger {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.45rem 0.75rem;
	background: #ffffff;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	min-height: 52px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.cfg-custom-select-trigger:hover {
	border-color: #9ca3af;
}

.cfg-custom-select.is-open .cfg-custom-select-trigger,
.cfg-custom-select-trigger:focus {
	outline: none;
	border-color: #3b2a24;
	box-shadow: 0 0 0 3px rgba(59, 42, 36, 0.12);
}

.cfg-trigger-content {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	flex: 1;
	min-width: 0;
}

.cfg-option-thumb {
	width: 38px;
	height: 38px;
	border-radius: 6px;
	object-fit: cover;
	flex-shrink: 0;
	background-color: #f3f4f6;
	border: 1px solid #e5e7eb;
}

.cfg-option-thumb-placeholder {
	display: inline-block;
	background: #e5e7eb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E") center no-repeat;
}

.cfg-option-text {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cfg-option-title {
	font-size: 0.9375rem;
	font-weight: 500;
	color: #1f2937;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cfg-option-price {
	font-size: 0.85rem;
	font-weight: 600;
	color: #3b2a24;
	flex-shrink: 0;
}

.cfg-trigger-arrow {
	display: flex;
	align-items: center;
	color: #6b7280;
	margin-left: 0.5rem;
	transition: transform 0.2s ease;
	flex-shrink: 0;
}

.cfg-custom-select.is-open .cfg-trigger-arrow {
	transform: rotate(180deg);
}

/* Custom Options Dropdown Menu */
.cfg-custom-options {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
	max-height: 250px;
	overflow-y: auto;
	z-index: 70;
	padding: 0.25rem 0;
}

.cfg-custom-option {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem 0.75rem;
	cursor: pointer;
	transition: background-color 0.12s ease;
}

.cfg-custom-option:hover:not(.disabled) {
	background-color: #fdfaf7;
}

.cfg-custom-option.selected {
	background-color: #fbf5ef;
}

.cfg-custom-option.selected .cfg-option-name {
	font-weight: 600;
	color: #3b2a24;
}

.cfg-custom-option.disabled {
	opacity: 0.4;
	cursor: not-allowed;
	background-color: #fafafa;
}

.cfg-option-info {
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
	flex: 1;
	min-width: 0;
}

.cfg-option-name {
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cfg-custom-option .cfg-option-price {
	font-size: 0.8125rem;
	color: #6b7280;
}

.cfg-option-check {
	display: none;
	color: #3b2a24;
	margin-left: auto;
	flex-shrink: 0;
}

.cfg-custom-option.selected .cfg-option-check {
	display: flex;
	align-items: center;
}

/* Visually hide native select while keeping it in the DOM for forms and accessibility */
.cfg-select.cfg-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* Validation Alert */
.cfg-validation-alert {
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	font-size: 0.875rem;
	color: #991b1b;
	background-color: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 6px;
	line-height: 1.4;
}

.cfg-alert-warning {
	padding: 0.875rem 1rem;
	background-color: #fffbeb;
	border: 1px solid #fde68a;
	color: #92400e;
	border-radius: 6px;
	font-size: 0.9375rem;
}

/* Hide native price if theme renders simple product price above configurator or if no scent is chosen */
.cstm-product-smry p.price:empty,
.product-summary p.price:empty,
.cstm-product-smry p.price.cfg-hidden,
.product-summary p.price.cfg-hidden {
	display: none !important;
}
