/**
 * Frontend styles for Product Customizer.
 */

/* Product Image Wrapper */
.pc-product-image-wrapper {
	position: relative;
	display: inline-block;
	width: 100%;
}

/* Overlay Container */
.pc-overlay-container {
	position: absolute;
	top: 10px;
	left: 10px;
	width: 200px;
	height: 200px;
	z-index: 999;
	border: 2px dashed #0073aa;
	box-sizing: border-box;
	cursor: move;
	background: rgba(255, 255, 255, 0.1);
	pointer-events: auto;
}

.pc-overlay-container:hover {
	border-color: #005a87;
	background: rgba(255, 255, 255, 0.2);
}

.pc-overlay-image {
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;
	background: transparent;
	display: block;
	user-select: none;
	-webkit-user-drag: none;
}

/* Resize Handle - Single handle in bottom-right corner */
.pc-resize-handle {
	position: absolute;
	bottom: -6px;
	right: -6px;
	width: 16px;
	height: 16px;
	background: #0073aa;
	border: 2px solid #fff;
	box-sizing: border-box;
	z-index: 11;
	cursor: se-resize;
	transition: background-color 0.2s ease, transform 0.2s ease;
	border-radius: 0 0 0 4px;
}

.pc-resize-handle:hover {
	background: #005a87;
	transform: scale(1.2);
}

/* Delete Handle */
.pc-delete-handle {
	position: absolute;
	top: -15px;
	right: -15px;
	width: 30px;
	height: 30px;
	background: #dc3232;
	color: #fff;
	border: 2px solid #fff;
	border-radius: 50%;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 12;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
	transition: background-color 0.2s ease;
}

.pc-delete-handle:hover {
	background: #a00;
}

.pc-delete-handle:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* Accordion Menu */
.pc-customizer-accordion {
	margin: 20px 0;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
}

.pc-accordion-item {
	border-bottom: 1px solid #eee;
}

.pc-accordion-item:last-child {
	border-bottom: none;
}

.pc-accordion-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 20px;
	cursor: pointer;
	background: #f9f9f9;
	transition: background-color 0.2s ease;
	user-select: none;
}

.pc-accordion-header:hover {
	background: #f0f0f0;
}

.pc-accordion-header:focus {
	outline: 2px solid #0073aa;
	outline-offset: -2px;
}

.pc-accordion-title {
	font-weight: 600;
	color: #333;
	flex: 1;
}

.pc-accordion-icon {
	font-size: 20px;
	font-weight: bold;
	color: #666;
	width: 24px;
	text-align: center;
	transition: transform 0.3s ease;
}

.pc-accordion-content {
	padding: 0;
	overflow: hidden;
}

/* Nested levels */
.pc-accordion-item.pc-level-1 .pc-accordion-header {
	padding-left: 30px;
	background: #fafafa;
}

.pc-accordion-item.pc-level-2 .pc-accordion-header {
	padding-left: 40px;
	background: #fcfcfc;
}

.pc-accordion-item.pc-level-3 .pc-accordion-header {
	padding-left: 50px;
	background: #fefefe;
}

/* Attribute items */
.pc-accordion-attribute .pc-accordion-header {
	background: #fff;
	border-left: 3px solid #0073aa;
}

.pc-accordion-attribute .pc-accordion-content {
	padding: 15px 20px;
	background: #fafafa;
}

/* Attribute Terms */
.pc-attribute-terms {
	display: flex;
	flex-wrap: nowrap;
	gap: 15px;
	margin-top: 10px;
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: thin;
	scrollbar-color: #0073aa #f0f0f0;
	padding-bottom: 10px;
	-webkit-overflow-scrolling: touch;
}

/* Webkit scrollbar styling */
.pc-attribute-terms::-webkit-scrollbar {
	height: 8px;
}

.pc-attribute-terms::-webkit-scrollbar-track {
	background: #f0f0f0;
	border-radius: 4px;
}

.pc-attribute-terms::-webkit-scrollbar-thumb {
	background: #0073aa;
	border-radius: 4px;
}

.pc-attribute-terms::-webkit-scrollbar-thumb:hover {
	background: #005a87;
}

.pc-attribute-term {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 12px;
	border: 2px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	background: #fff;
	transition: all 0.3s ease;
	min-width: 100px;
	flex-shrink: 0;
	text-align: center;
}

.pc-attribute-term:hover {
	border-color: #0073aa;
	box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
	transform: translateY(-2px);
}

.pc-attribute-term:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.pc-attribute-term.selected {
	border-color: #0073aa;
	background: #e6f4fa;
	box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.pc-term-image {
	max-width: 80px;
	max-height: 80px;
	object-fit: contain;
	margin-bottom: 8px;
	border-radius: 3px;
}

.pc-term-name {
	font-size: 13px;
	font-weight: 500;
	text-align: center;
	margin-bottom: 5px;
	color: #333;
}

.pc-term-price {
	font-size: 12px;
	color: #0073aa;
	font-weight: bold;
}

/* Legacy overlay styles (for backward compatibility) */
.pc-customizer-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 10;
}

.pc-attribute-group {
	margin-bottom: 20px;
}

.pc-attribute {
	margin-bottom: 15px;
}

.pc-attribute-label {
	display: block;
	font-weight: bold;
	margin-bottom: 8px;
	color: #333;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.pc-accordion-header {
		padding: 12px 15px;
		font-size: 14px;
	}

	.pc-accordion-item.pc-level-1 .pc-accordion-header {
		padding-left: 25px;
	}

	.pc-accordion-item.pc-level-2 .pc-accordion-header {
		padding-left: 35px;
	}

	.pc-attribute-terms {
		gap: 10px;
		padding-bottom: 8px;
	}
	
	.pc-attribute-terms::-webkit-scrollbar {
		height: 6px;
	}

	.pc-attribute-term {
		min-width: 80px;
		padding: 10px;
	}

	.pc-term-image {
		max-width: 60px;
		max-height: 60px;
	}

	.pc-term-name {
		font-size: 12px;
	}
}
