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

/* Editor Tabs */
.wpc-editor-tabs {
	display: flex;
	border-bottom: 2px solid #ddd;
	margin-bottom: 10px;
}

.wpc-editor-tab {
	flex: 1;
	padding: 12px 20px;
	background: #f5f5f5;
	border: none;
	border-bottom: 3px solid transparent;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: #666;
	transition: all 0.3s;
}

.wpc-editor-tab:hover {
	background: #e9e9e9;
	color: #333;
}

.wpc-editor-tab.active {
	background: #fff;
	border-bottom-color: #0073aa;
	color: #0073aa;
	font-weight: 600;
}

.wpc-tab-content {
	display: none;
}

.wpc-tab-content.active {
	display: block;
}

/* Add Name and Add Year buttons */
.wpc-add-name-btn,
.wpc-add-year-btn {
	margin-top: 15px;
	margin-bottom: 10px;
}

.wpc-customize-button-wrapper {
	margin: 20px 0;
}

.wpc-open-customizer {
	padding: 12px 24px;
	font-size: 16px;
	font-weight: bold;
	background: #0073aa;
	color: #fff;
	border: none;
	cursor: pointer;
	border-radius: 4px;
	transition: background 0.3s;
}

.wpc-open-customizer:hover {
	background: #005a87;
}

/* Modal Styles */
.wpc-modal {
	display: none;
	position: fixed;
	z-index: 100000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.8);
	overflow: hidden;
}

.wpc-customizer-content {
	background-color: #fff;
	margin: 0;
	max-width: 100%;
	width: 100%;
	height: 100vh;
	display: flex;
	flex-direction: column;
	border-radius: 0;
	box-shadow: none;
}

.wpc-customizer-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px;
	border-bottom: 1px solid #ddd;
}

.wpc-customizer-header h2 {
	margin: 0;
	font-size: 24px;
}

.wpc-modal-close {
	font-size: 36px;
	font-weight: bold;
	color: #999;
	cursor: pointer;
	border: none;
	background: none;
	line-height: 1;
}

.wpc-modal-close:hover {
	color: #000;
}

.wpc-customizer-body {
	display: flex;
	flex: 1;
	overflow: hidden;
	min-height: 0;
	height: 100%;
}

/* Sidebar */
.wpc-sidebar {
	width: 350px;
	background: #f5f5f5;
	border-right: 1px solid #ddd;
	overflow-y: auto;
	padding: 20px;
}

.wpc-sidebar-section {
	margin-bottom: 30px;
	padding-bottom: 20px;
	border-bottom: 1px solid #ddd;
}

.wpc-sidebar-section:last-child {
	border-bottom: none;
}

.wpc-sidebar-section h3 {
	margin-top: 0;
	margin-bottom: 15px;
	font-size: 18px;
}

/* Category Tabs */
.wpc-categories-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 15px;
}

.wpc-category-tab {
	padding: 8px 16px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	transition: all 0.3s;
}

.wpc-category-tab:hover {
	background: #f0f0f0;
}

.wpc-category-tab.active {
	background: #0073aa;
	color: #fff;
	border-color: #0073aa;
}

/* Graphics Grid */
.wpc-graphics-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	gap: 10px;
}

.wpc-graphic-item {
	position: relative;
	cursor: pointer;
	border: 2px solid #ddd;
	border-radius: 4px;
	transition: all 0.3s;
	aspect-ratio: 1;
	background: #fff;
	display: flex;
	flex-direction: column;
}

.wpc-graphic-item:hover {
	border-color: #0073aa;
	transform: scale(1.05);
}

.wpc-graphic-item img {
	width: 100%;
	flex: 1 1 0;
	min-height: 0;
	object-fit: cover;
}

.wpc-graphic-price {
	flex-shrink: 0;
	background: #fff;
	color: #000;
	padding: 8px 4px;
	text-align: center;
	font-size: 12px;
	font-weight: 600;
	border-top: 1px solid #e0e0e0;
}

/* Text Options */
.wpc-text-options { display: flex; gap: 10px; }

.wpc-text-input {
	flex: 1;
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
}

.wpc-text-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }

.wpc-text-controls label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}

.wpc-text-controls .wpc-field { flex: 0 0 auto; }
.wpc-text-controls .wpc-field-font-family { flex: 1 1 200px; min-width: 160px; }
.wpc-text-controls .wpc-field-font-size { flex: 0 0 auto; }
.wpc-text-controls .wpc-field-color { flex: 0 0 auto; }
.wpc-text-controls .wpc-field-style { flex: 0 0 auto; }
.wpc-text-controls .wpc-field-align { flex: 0 0 auto; }

.wpc-text-controls input,
.wpc-text-controls select {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.wpc-text-controls select.wpc-font-select {
    font-size: 12px;
    width: 100%;
}

.wpc-text-controls .wpc-field-font-size input[type="number"] { width: 80px; }
.wpc-text-controls .wpc-field-color input[type="color"] { width: 40px; padding: 0; border: none; }

/* Field spacing in Name and Year tabs */
.wpc-name-options .wpc-field,
.wpc-year-options .wpc-field {
	margin-bottom: 15px;
}

.wpc-name-options .wpc-field:last-child,
.wpc-year-options .wpc-field:last-child {
	margin-bottom: 0;
}

.wpc-year-format-group .wpc-field {
	margin-bottom: 15px;
}

.wpc-year-format-group .wpc-field:last-child {
	margin-bottom: 0;
}

/* Floating text controls above selection */
.wpc-floating-controls {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 20;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
}

.wpc-align-group {
	display: inline-flex;
	gap: 6px;
}

.wpc-style-group, .wpc-align-group {
    white-space: nowrap;
}

.wpc-toggle-btn {
    padding: 4px 8px;
    line-height: 1.2;
    font-size: 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: inherit;
    cursor: pointer;
}

.wpc-toggle-btn:hover {
    background: #f7f7f7;
}

.wpc-toggle-btn:focus {
    outline: 2px solid #66afe9;
    outline-offset: 1px;
}

.wpc-toggle-btn.is-active {
	background: #0073aa;
	color: #fff;
	border-color: #0073aa;
}

/* Floating toolbar layout: two rows where first row = Font Family, second row = size/color/style/align */
.wpc-floating-controls { padding: 8px; max-width: calc(100% - 16px); overflow: hidden; }
.wpc-floating-controls .wpc-text-controls { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 36px; gap: 6px; align-items: stretch; }
.wpc-floating-controls .wpc-field-font-family { grid-column: 1 / -1; }
.wpc-floating-controls label { display: flex; flex-direction: column; gap: 0; font-size: 0; line-height: 0; }
.wpc-floating-controls input,
.wpc-floating-controls select { padding: 4px 6px; font-size: 12px; height: 32px; }
.wpc-floating-controls select.wpc-font-select { width: 100%; }
.wpc-floating-controls .wpc-field-font-size input[type="number"] { width: 100%; height: 32px; }
.wpc-floating-controls .wpc-field-color input[type="color"] { width: 32px; height: 32px; padding: 0; border: none; }
.wpc-floating-controls .wpc-style-group,
.wpc-floating-controls .wpc-align-group { display: flex; gap: 6px; width: 100%; height: 32px; align-items: stretch; justify-content: center; }
.wpc-floating-controls .wpc-style-group .wpc-toggle-btn,
.wpc-floating-controls .wpc-align-group .wpc-toggle-btn { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.wpc-floating-controls .wpc-toggle-btn { font-size: 12px; }

/* (Font preview removed) */

/* (Checkboxes for bold/italic removed) */

/* Price Display */
.wpc-price-display { display: inline-flex; align-items: center; gap: 8px; background: #fff; padding: 10px 12px; border-radius: 4px; border: 2px solid #0073aa; }
.wpc-price-display strong { margin: 0; font-size: 16px; font-weight: 600; display: inline; }
.wpc-price-display #wpc-total-price { font-size: 16px; color: #0073aa; font-weight: 600; }

/* Canvas Wrapper */
.wpc-canvas-wrapper {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: stretch;
	overflow: hidden;
	padding: 0;
	background: #fafafa;
	position: relative;
	width: 100%;
	height: 100%;
}

#wpc-canvas {
	border: none;
	background: #fff;
	cursor: crosshair;
	margin: 0;
	box-shadow: none;
	display: block;
	width: 100% !important;
	height: 100% !important;
}

.wpc-canvas-tools {
	margin-top: 15px;
	display: flex;
	gap: 10px;
	justify-content: center;
}

.wpc-canvas-tools .button {
	padding: 8px 16px;
}

/* Footer */
.wpc-customizer-footer {
	padding: 20px;
	border-top: 1px solid #ddd;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.wpc-customizer-footer .button {
	padding: 12px 24px;
	font-size: 16px;
}

.wpc-footer-left { display: flex; align-items: center; gap: 12px; }
.wpc-footer-right { display: flex; gap: 10px; }

/* Layers */
.wpc-layers-list { list-style: none; margin: 0; padding: 0; }
.wpc-layers-list li.wpc-layer-item { 
	display: flex; 
	align-items: center; 
	gap: 8px; 
	padding: 10px 12px; 
	border: 1px solid #ddd; 
	border-radius: 4px; 
	background: #fff; 
	cursor: move; 
	margin-bottom: 6px; 
	transition: all 0.2s ease;
	position: relative;
}
.wpc-layers-list li.wpc-layer-item:hover { 
	border-color: #0073aa; 
	box-shadow: 0 2px 4px rgba(0, 115, 170, 0.1);
}
.wpc-layers-list li.wpc-layer-item.wpc-layer-selected { 
	border-color: #0073aa; 
	background-color: #e6f2f8; 
	font-weight: 500;
}
.wpc-layers-list li.wpc-layer-item.wpc-dragging { 
	opacity: 0.5; 
	transform: scale(1.05);
	z-index: 1000;
}
.wpc-layers-list li.wpc-layer-item.wpc-drag-over { 
	border-color: #0073aa; 
	background-color: #f0f8ff; 
	border-width: 2px;
	margin-top: 4px;
	margin-bottom: 8px;
}
.wpc-layers-list li .wpc-drag-handle { 
	cursor: grab; 
	color: #666; 
	font-size: 16px; 
	padding: 2px 4px; 
	user-select: none;
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
}
.wpc-layers-list li .wpc-drag-handle:active { 
	cursor: grabbing; 
}
.wpc-layers-list li .wpc-layer-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0; /* Allow text truncation */
}
.wpc-layers-list li .wpc-layer-name { 
	font-size: 14px;
	color: #333;
	overflow: hidden; 
	text-overflow: ellipsis; 
	white-space: nowrap; 
	cursor: pointer;
	line-height: 1.3;
}
.wpc-layers-list li .wpc-layer-price {
	font-size: 13px;
	color: #0073aa;
	font-weight: 600;
	cursor: pointer;
	line-height: 1.2;
}

/* Items & Prices Panel */
.wpc-layers-sidebar {
	background: #f5f5f5;
	border-left: 1px solid #ddd;
	overflow-y: auto;
	padding: 20px;
}

.wpc-price-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpc-price-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px;
	margin-bottom: 8px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	transition: all 0.2s ease;
	cursor: pointer;
}

.wpc-price-item:hover {
	border-color: #0073aa;
	box-shadow: 0 2px 6px rgba(0, 115, 170, 0.15);
	transform: translateY(-1px);
}

.wpc-price-item-name {
	flex: 1;
	font-size: 14px;
	color: #333;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpc-price-item-amount {
	font-size: 15px;
	font-weight: 600;
	color: #0073aa;
	min-width: 60px;
	text-align: right;
}

/* Editor buttons base class */
.wpc-editor-button { border: 1px solid #ddd; background: #fff; color: inherit; }

/* Responsive */
@media (max-width: 1200px) {
	.wpc-customizer-content {
		width: 100%;
		height: 100vh;
		margin: 0;
		border-radius: 0;
	}

	.wpc-sidebar,
	.wpc-layers-sidebar {
		width: 300px;
	}
}

@media (max-width: 768px) {
	.wpc-customizer-body {
		flex-direction: column;
	}

	.wpc-sidebar,
	.wpc-layers-sidebar {
		width: 100%;
		max-height: 40vh;
	}

	.wpc-canvas-wrapper {
		flex: 1;
	}

	.wpc-price-item {
		padding: 10px;
	}

	.wpc-price-item-name {
		font-size: 13px;
	}

	.wpc-price-item-amount {
		font-size: 14px;
	}
}

