/**
 * Crusty Options Quick View Popup (QuickSwish-style)
 * Layout: white modal, product image left, info/options right, yellow Add to Cart.
 */

.co-quickview-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	padding: 20px;
	box-sizing: border-box;
}

.co-quickview-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

.co-quickview-modal {
	background: #fff;
	border-radius: 16px;
	max-width: 900px;
	width: 100%;
	max-height: 90vh;
	overflow: hidden;
	position: relative;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
	display: flex;
	flex-direction: column;
}

#co-quickview-overlay .co-quickview-close,
.co-quickview-modal .co-quickview-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 36px;
	height: 36px;
	border: 1px solid #000 !important;
	background: #f0f0f0;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #000 !important;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s, color 0.2s;
}

#co-quickview-overlay .co-quickview-close:hover,
.co-quickview-modal .co-quickview-close:hover {
	background: #000 !important;
	color: #fff !important;
	border-color: #000 !important;
}

.co-quickview-content {
	overflow-y: auto;
	flex: 1;
	padding: 24px 24px 24px 24px;
}

.co-quickview-loading {
	text-align: center;
	padding: 40px 20px;
	color: #666;
}

/* Inner layout: section 1 = gallery + header, section 2 = options */
.co-quickview-inner {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* Section 1: Left 50% main image, Right 50% header + thumbs */
.co-quickview-section-product {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
	align-items: stretch;
}

.co-quickview-section-product .co-quickview-main-image {
	width: 100%;
	box-sizing: border-box;
	min-height: 0;
}

.co-quickview-section-product .co-quickview-right {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
	min-height: 0;
}

.co-quickview-section-product .co-quickview-header {
	flex: 0 0 auto;
}

/* Thumbs carousel */
.co-quickview-thumbs-carousel {
	display: flex;
	align-items: stretch;
	gap: 8px;
	width: 100%;
	min-width: 0;
	flex: 1;
	min-height: 0;
	margin-left: -20px;
}

.co-thumbs-nav {
	flex-shrink: 0;
	align-self: center;
	width: 32px;
	height: 32px;
	border: none !important;
	background: #fff;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #333;
	transition: background 0.2s, border-color 0.2s;
	padding: 0 !important;
}

.co-thumbs-nav .co-thumbs-arrow {
	width: 14px;
	height: 14px;
	color: #333;
}

.co-thumbs-nav:hover:not(:disabled) {
	background: none !important;
	border-color: none !important;
}

.co-thumbs-nav:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	background: none !important;
	border-color: none !important;
}

.co-quickview-thumbs-viewport {
	flex: 1;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	container-type: inline-size;
	container-name: co-thumbs;
}

.co-quickview-thumbs-track {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	gap: 8px;
	transition: transform 0.3s ease;
	width: max-content;
	height: 100%;
}

.co-quickview-thumbs-track .co-quickview-thumbs {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
	width: max-content;
	height: 100%;
}

@container co-thumbs (min-width: 0) {
	.co-quickview-thumbs-track .co-quickview-thumb {
		flex-shrink: 0;
		width: calc(50cqw - 4px);
		min-width: calc(50cqw - 4px);
		height: 100%;
		min-height: 80px;
	}
}

@media (max-width: 768px) {
	.co-quickview-section-product {
		grid-template-columns: 1fr;
	}
	.co-quickview-section-product .co-quickview-main-image,
	.co-quickview-section-product .co-quickview-right {
		width: 100%;
		max-width: 100%;
	}
	.co-quickview-thumbs-carousel {
		min-height: 120px;
	}
}

.co-quickview-title {
	margin: 0 0 8px 0;
	font-size: 1.5rem;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
}

.co-quickview-desc {
	margin: 0 0 8px 0;
	font-size: 0.9rem;
	color: #555;
	line-height: 1.4;
}

.co-quickview-price {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	color: #1a1a1a;
}

.co-quickview-price .woocommerce-Price-amount {
	font-weight: 600;
}

.co-quickview-main-image {
	border-radius: 8px;
	overflow: hidden;
	background: #f8f8f8;
	aspect-ratio: 4/3;
}

.co-quickview-main-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity 0.2s ease;
}

.co-quickview-thumb {
	border-radius: 8px;
	overflow: hidden;
	background: #f0f0f0;
	cursor: pointer;
	border: 2px solid transparent;
	transition: border-color 0.2s;
}

.co-quickview-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	vertical-align: middle;
}

.co-quickview-thumb.active,
.co-quickview-thumb:hover {
	border-color: #4caf50;
}

/* Section 2: Options (quickview popup + single product page + Elementor widget) */
#co-quickview-content .co-quickview-section-options,
.single-product .co-quickview-section-options,
.co-quickview-options-root .co-quickview-section-options {
	width: 100%;
}

#co-quickview-content .co-quickview-options,
.single-product .co-quickview-options,
.co-quickview-options-root .co-quickview-options {
	font-family: inherit;
}

#co-quickview-content .co-quickview-option-header,
.single-product .co-quickview-option-header,
.co-quickview-options-root .co-quickview-option-header {
	background: #f0f0f0;
	border: 1px solid #e8e8e8;
	border-bottom: none;
	border-radius: 10px 10px 0 0;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 0;
}

#co-quickview-content .co-quickview-option-header--alone,
.single-product .co-quickview-option-header--alone,
.co-quickview-options-root .co-quickview-option-header--alone {
	border-bottom: 1px solid #e8e8e8;
	border-radius: 10px;
}

#co-quickview-content .co-quickview-option-header-left,
.single-product .co-quickview-option-header-left,
.co-quickview-options-root .co-quickview-option-header-left {
	flex: 1;
	min-width: 0;
}

#co-quickview-content .co-quickview-choose,
.single-product .co-quickview-choose,
.co-quickview-options-root .co-quickview-choose {
	margin: 0 0 4px 0;
	font-size: 0.95rem;
	font-weight: 600;
	color: #1a1a1a;
	line-height: 1.3;
}

#co-quickview-content .co-quickview-option-desc,
.single-product .co-quickview-option-desc,
.co-quickview-options-root .co-quickview-option-desc {
	margin: 0;
	font-size: 0.85rem;
	color: #666;
	line-height: 1.3;
}

#co-quickview-content .co-quickview-option-header-right,
.single-product .co-quickview-option-header-right,
.co-quickview-options-root .co-quickview-option-header-right {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

#co-quickview-content .co-quickview-option-current,
.single-product .co-quickview-option-current,
.co-quickview-options-root .co-quickview-option-current {
	font-size: 0.95rem;
	font-weight: 600;
	color: #1a1a1a;
}

#co-quickview-content .co-quickview-option-group,
.single-product .co-quickview-option-group,
.co-quickview-options-root .co-quickview-option-group {
	margin-bottom: 20px;
}

#co-quickview-content .co-quickview-option-list,
.single-product .co-quickview-option-list,
.co-quickview-options-root .co-quickview-option-list {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e8e8e8;
	border-radius: 0 0 10px 10px;
	overflow: hidden;
}

#co-quickview-content .co-quickview-option-list .co-quickview-radio,
.single-product .co-quickview-option-list .co-quickview-radio,
.co-quickview-options-root .co-quickview-option-list .co-quickview-radio {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	cursor: pointer;
	border-bottom: 1px solid #eee;
	font-size: 0.95rem;
	color: #1a1a1a;
	margin: 0;
}

#co-quickview-content .co-quickview-option-list .co-quickview-radio:last-child,
.single-product .co-quickview-option-list .co-quickview-radio:last-child,
.co-quickview-options-root .co-quickview-option-list .co-quickview-radio:last-child {
	border-bottom: none;
}

#co-quickview-content .co-quickview-radio-text,
.single-product .co-quickview-radio-text,
.co-quickview-options-root .co-quickview-radio-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

#co-quickview-content .co-quickview-radio-name,
.single-product .co-quickview-radio-name,
.co-quickview-options-root .co-quickview-radio-name {
	font-weight: 500;
	color: #1a1a1a;
}

#co-quickview-content .co-quickview-option-price,
.single-product .co-quickview-option-price,
.co-quickview-options-root .co-quickview-option-price {
	font-size: 0.85rem;
	color: #666;
	font-weight: 400;
}

#co-quickview-content .co-quickview-option-price .woocommerce-Price-amount,
.single-product .co-quickview-option-price .woocommerce-Price-amount,
.co-quickview-options-root .co-quickview-option-price .woocommerce-Price-amount {
	font-size: inherit;
	color: inherit;
}

#co-quickview-content .co-quickview-radio input[type="radio"],
.single-product .co-quickview-radio input[type="radio"],
.co-quickview-options-root .co-quickview-radio input[type="radio"] {
	appearance: none;
	width: 20px;
	height: 20px;
	border: 2px solid #4caf50;
	border-radius: 50%;
	flex-shrink: 0;
	position: relative;
	margin: 0;
	cursor: pointer;
}

#co-quickview-content .co-quickview-radio input[type="radio"]:checked,
.single-product .co-quickview-radio input[type="radio"]:checked,
.co-quickview-options-root .co-quickview-radio input[type="radio"]:checked {
	background: #4caf50;
	box-shadow: inset 0 0 0 3px #fff;
}

#co-quickview-content .co-quickview-actions,
.single-product .co-quickview-actions,
.co-quickview-options-root .co-quickview-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 20px;
	padding-top: 20px;
}

#co-quickview-content .co-quickview-qty,
.single-product .co-quickview-qty,
.co-quickview-options-root .co-quickview-qty {
	display: flex;
	align-items: center;
	gap: 0;
	border: none;
	background: transparent;
}

#co-quickview-content .co-quickview-qty .co-qty-minus,
.single-product .co-quickview-qty .co-qty-minus,
.co-quickview-options-root .co-quickview-qty .co-qty-minus {
	width: 44px;
	height: 44px;
	border: 2px solid #ffc107;
	background: #fff;
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	color: #1a1a1a;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

#co-quickview-content .co-quickview-qty .co-qty-minus:hover,
.single-product .co-quickview-qty .co-qty-minus:hover,
.co-quickview-options-root .co-quickview-qty .co-qty-minus:hover {
	background: #fffbf0;
}

#co-quickview-content .co-quickview-qty .co-qty-input,
.single-product .co-quickview-qty .co-qty-input,
.co-quickview-options-root .co-quickview-qty .co-qty-input {
	width: 56px;
	height: 44px;
	border: 1px solid #ddd;
	background: #fff;
	text-align: center;
	font-size: 1rem;
	font-weight: 500;
	color: #1a1a1a;
	margin: 0 4px;
	border-radius: 6px;
	-moz-appearance: textfield;
}

#co-quickview-content .co-quickview-qty .co-qty-input::-webkit-outer-spin-button,
#co-quickview-content .co-quickview-qty .co-qty-input::-webkit-inner-spin-button,
.single-product .co-quickview-qty .co-qty-input::-webkit-outer-spin-button,
.single-product .co-quickview-qty .co-qty-input::-webkit-inner-spin-button,
.co-quickview-options-root .co-quickview-qty .co-qty-input::-webkit-outer-spin-button,
.co-quickview-options-root .co-quickview-qty .co-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

#co-quickview-content .co-quickview-qty .co-qty-plus,
.single-product .co-quickview-qty .co-qty-plus,
.co-quickview-options-root .co-quickview-qty .co-qty-plus {
	width: 44px;
	height: 44px;
	border: 2px solid #4caf50;
	background: #fff;
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	color: #1a1a1a;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

#co-quickview-content .co-quickview-qty .co-qty-plus:hover,
.single-product .co-quickview-qty .co-qty-plus:hover,
.co-quickview-options-root .co-quickview-qty .co-qty-plus:hover {
	background: #f0f9f0;
}

#co-quickview-content .co-quickview-add-to-cart,
.single-product .co-quickview-add-to-cart,
.co-quickview-options-root .co-quickview-add-to-cart {
	background: #ffc107 !important;
	color: #1a1a1a !important;
	border: none !important;
	padding: 14px 32px !important;
	font-size: 1rem !important;
	font-weight: 600 !important;
	border-radius: 10px !important;
	cursor: pointer !important;
	transition: background 0.2s, filter 0.2s !important;
	box-shadow: none !important;
	width: 100%;
}

#co-quickview-content .co-quickview-add-to-cart:hover,
.single-product .co-quickview-add-to-cart:hover,
.co-quickview-options-root .co-quickview-add-to-cart:hover {
	background: #e6ac00 !important;
	filter: brightness(1.05);
}

#co-quickview-content .co-quickview-add-to-cart.co-loading,
.single-product .co-quickview-add-to-cart.co-loading,
.co-quickview-options-root .co-quickview-add-to-cart.co-loading {
	pointer-events: none;
	opacity: 0.85;
}

#co-quickview-content .co-quickview-error,
.single-product .co-quickview-error,
.co-quickview-options-root .co-quickview-error {
	margin: 10px 0 0 0;
	padding: 10px 12px;
	background: #fff3f3;
	border: 1px solid #f5c6cb;
	border-radius: 6px;
	color: #721c24;
	font-size: 0.9rem;
	line-height: 1.4;
}

.co-quickview-options-root .co-quickview-placeholder {
	display: block;
	padding: 12px 16px;
	background: #f5f5f5;
	border: 1px dashed #ccc;
	border-radius: 8px;
	color: #666;
	font-size: 0.9rem;
}

#co-quickview-content .co-btn-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(26, 26, 26, 0.3);
	border-top-color: #1a1a1a;
	border-radius: 50%;
	animation: co-spin 0.6s linear infinite;
	vertical-align: middle;
	margin-right: 6px;
}

@keyframes co-spin {
	to { transform: rotate(360deg); }
}

/* Quick View button on product loop */
.co-quickview-btn {
	display: inline-block;
	text-align: center;
	margin-top: 6px;
}
