/**
 * Craft & Canvas Shop Enhancer - Frontend Styles
 */

/* ==========================================================================
   1. CSS Custom Properties & Variables Defaults
   ========================================================================== */
:root {
	--csl-primary: #b35d48;
	--csl-primary-hover: #9c4b37;
	--csl-secondary: #2c3e50;
	--csl-badge-sale: #d9534f;
	--csl-badge-new: #27ae60;
	--csl-badge-soldout: #7f8c8d;
	--csl-card-radius: 12px;
	--csl-desktop-columns: 3;
	--csl-card-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
	--csl-card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
	--csl-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   2. Modals & Off-Canvas Drawers: MUST BE HIDDEN BY DEFAULT
   ========================================================================== */
#csl-quick-view-modal,
.csl-modal,
#csl-cart-drawer,
.csl-drawer {
	display: none;
}

#csl-quick-view-modal.is-active,
.csl-modal.is-active {
	display: flex !important;
	opacity: 1 !important;
	visibility: visible !important;
}

#csl-cart-drawer.is-open,
.csl-drawer.is-open {
	display: block !important;
	visibility: visible !important;
}

/* ==========================================================================
   3. Product Card Thumbnail Container & Hover Swap
   ========================================================================== */
/* Applies to Kadence, standard WooCommerce, and custom theme image links */
li.product .woocommerce-loop-image-link,
li.product .csl-thumb-wrapper,
li.product > a.woocommerce-LoopProduct-link:first-child,
li.product > a:first-of-type:has(img) {
	position: relative !important;
	display: block !important;
	overflow: hidden !important;
	background-color: #f9f8f6 !important;
	border-radius: var(--csl-card-radius, 12px) var(--csl-card-radius, 12px) 0 0 !important;
	width: 100% !important;
	margin: 0 !important;
}

/* Base product image */
li.product .woocommerce-loop-image-link img,
li.product .csl-thumb-wrapper img,
li.product > a:first-of-type:has(img) img {
	display: block !important;
	width: 100% !important;
	height: auto !important;
	aspect-ratio: 1 / 1 !important;
	object-fit: cover !important;
	transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease !important;
	margin: 0 !important;
}

/* Subtle zoom on card hover */
li.product:hover .woocommerce-loop-image-link img.csl-primary-img,
li.product:hover .csl-thumb-wrapper img.csl-primary-img,
li.product:hover > a:first-of-type:has(img) img:not(.csl-secondary-img) {
	transform: scale(1.04) !important;
}

/* Secondary image hover swap (shows 2nd gallery photo on desktop hover) */
.csl-secondary-img {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	opacity: 0 !important;
	pointer-events: none !important;
	transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
	z-index: 2 !important;
}

li.product:hover .csl-secondary-img {
	opacity: 1 !important;
	transform: scale(1.04) !important;
}

li.product.csl-has-hover:hover .csl-primary-img,
li.product.csl-has-hover:hover > a:first-of-type:has(img) img:not(.csl-secondary-img) {
	opacity: 0 !important;
}

/* ==========================================================================
   4. Quick View Card Action Button
   ========================================================================== */
.csl-card-actions {
	position: absolute !important;
	bottom: 12px !important;
	left: 0 !important;
	right: 0 !important;
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
	opacity: 0 !important;
	visibility: hidden !important;
	transform: translateY(8px) !important;
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease !important;
	z-index: 10 !important;
	pointer-events: none !important;
}

li.product:hover .csl-card-actions {
	opacity: 1 !important;
	visibility: visible !important;
	transform: translateY(0) !important;
	pointer-events: auto !important;
}

.csl-quick-view-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px !important;
	background: rgba(255, 255, 255, 0.95) !important;
	color: var(--csl-secondary, #2c3e50) !important;
	border: none !important;
	padding: 8px 16px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	border-radius: 24px !important;
	cursor: pointer !important;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
	backdrop-filter: blur(4px) !important;
	transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease !important;
	text-decoration: none !important;
	line-height: 1.2 !important;
}

.csl-quick-view-btn:hover {
	background: var(--csl-primary, #b35d48) !important;
	color: #ffffff !important;
	transform: scale(1.04) !important;
}

.csl-quick-view-btn svg {
	width: 16px !important;
	height: 16px !important;
	flex-shrink: 0 !important;
}

/* ==========================================================================
   5. Dynamic Product Badges
   ========================================================================== */
.csl-badge-container {
	position: absolute !important;
	top: 12px !important;
	left: 12px !important;
	z-index: 8 !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 6px !important;
	pointer-events: none !important;
}

.csl-badge {
	display: inline-block !important;
	font-size: 11px !important;
	font-weight: 700 !important;
	text-transform: uppercase !important;
	letter-spacing: 0.5px !important;
	padding: 4px 10px !important;
	border-radius: 16px !important;
	color: #ffffff !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
	line-height: 1.2 !important;
	width: fit-content !important;
}

.csl-badge-sale {
	background-color: var(--csl-badge-sale, #d9534f) !important;
}

.csl-badge-new {
	background-color: var(--csl-badge-new, #27ae60) !important;
}

.csl-badge-soldout {
	background-color: var(--csl-badge-soldout, #7f8c8d) !important;
}

/* Hide default theme sale tag if duplicate */
li.product .onsale {
	display: none !important;
}

/* ==========================================================================
   6. List View & Excerpt Protection
   ========================================================================== */
/* Strictly hide list description on standard grids and single product related items */
.csl-list-description {
	display: none !important;
}

/* Show only when user toggles list view on shop archive */
ul.products.csl-is-list-view .csl-list-description {
	display: block !important;
	font-size: 14px !important;
	color: #666666 !important;
	line-height: 1.5 !important;
	margin: 8px 0 14px 0 !important;
}

ul.products.csl-is-list-view {
	display: flex !important;
	flex-direction: column !important;
	gap: 20px !important;
}

ul.products.csl-is-list-view li.product {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	padding: 16px !important;
	gap: 24px !important;
}

ul.products.csl-is-list-view li.product .woocommerce-loop-image-link,
ul.products.csl-is-list-view li.product .csl-thumb-wrapper,
ul.products.csl-is-list-view li.product > a:first-of-type:has(img) {
	width: 200px !important;
	min-width: 200px !important;
	aspect-ratio: 1 / 1 !important;
	border-radius: var(--csl-card-radius, 12px) !important;
}

@media (max-width: 768px) {
	ul.products.csl-is-list-view li.product {
		flex-direction: column !important;
	}
	ul.products.csl-is-list-view li.product .woocommerce-loop-image-link,
	ul.products.csl-is-list-view li.product .csl-thumb-wrapper,
	ul.products.csl-is-list-view li.product > a:first-of-type:has(img) {
		width: 100% !important;
	}
}

/* View switcher toolbar */
.csl-view-switcher {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 24px;
	justify-content: flex-end;
}

.csl-switcher-label {
	font-size: 13px;
	color: #777777;
	margin-right: 4px;
}

.csl-btn-view {
	background: #ffffff;
	border: 1px solid #e0e0e0;
	color: #777777;
	padding: 6px 10px;
	border-radius: 6px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: var(--csl-transition);
}

.csl-btn-view:hover,
.csl-btn-view.active {
	background: var(--csl-primary);
	border-color: var(--csl-primary);
	color: #ffffff;
}

/* ==========================================================================
   7. Quick View Modal Window
   ========================================================================== */
.csl-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.csl-modal.is-active {
	opacity: 1;
	visibility: visible;
}

.csl-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.65);
	backdrop-filter: blur(4px);
}

.csl-modal-dialog {
	position: relative;
	background: #ffffff;
	border-radius: var(--csl-card-radius, 12px);
	width: 90%;
	max-width: 860px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	z-index: 2;
	transform: scale(0.94);
	transition: transform 0.25s ease;
	padding: 30px;
}

.csl-modal.is-active .csl-modal-dialog {
	transform: scale(1);
}

.csl-modal-close {
	position: absolute;
	top: 14px;
	right: 18px;
	background: #f0f0f0;
	border: none;
	font-size: 24px;
	line-height: 1;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	cursor: pointer;
	color: #555555;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: var(--csl-transition);
	z-index: 10;
}

.csl-modal-close:hover {
	background: var(--csl-primary);
	color: #ffffff;
	transform: rotate(90deg);
}

.csl-modal-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 60px 0;
	color: #666666;
}

.csl-spinner,
.csl-btn-spinner,
.csl-lm-spinner {
	width: 28px;
	height: 28px;
	border: 3px solid rgba(0, 0, 0, 0.1);
	border-top-color: var(--csl-primary);
	border-radius: 50%;
	animation: csl-spin 0.8s linear infinite;
	display: inline-block;
}

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

.csl-qv-container {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 32px;
}

@media (max-width: 768px) {
	.csl-qv-container {
		grid-template-columns: 1fr;
		gap: 20px;
	}
	.csl-modal-dialog {
		padding: 20px;
	}
}

.csl-qv-gallery-col {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.csl-qv-main-image-wrap {
	border-radius: 8px;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	background: #f9f8f6;
	display: flex;
	align-items: center;
	justify-content: center;
}

.csl-qv-main-image-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.csl-qv-thumbnails {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding-bottom: 4px;
}

.csl-qv-thumb-btn {
	width: 60px;
	height: 60px;
	min-width: 60px;
	border: 2px solid transparent;
	border-radius: 6px;
	overflow: hidden;
	padding: 0;
	cursor: pointer;
	background: #eee;
	transition: var(--csl-transition);
}

.csl-qv-thumb-btn.active,
.csl-qv-thumb-btn:hover {
	border-color: var(--csl-primary);
}

.csl-qv-thumb-btn img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.csl-qv-title {
	font-size: 22px;
	font-weight: 700;
	margin: 0 0 10px 0;
	color: var(--csl-secondary);
}

.csl-qv-title a {
	color: inherit;
	text-decoration: none;
}

.csl-qv-price {
	font-size: 20px;
	font-weight: 700;
	color: var(--csl-primary);
	margin-bottom: 14px;
}

.csl-qv-description {
	font-size: 14px;
	color: #555555;
	line-height: 1.6;
	margin-bottom: 16px;
}

.csl-qv-stock-status {
	font-size: 13px;
	margin-bottom: 20px;
}

.csl-in-stock {
	color: #27ae60;
	font-weight: 600;
}

.csl-out-of-stock {
	color: #d9534f;
	font-weight: 600;
}

.csl-qv-cart-form {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
}

.csl-quantity-stepper {
	display: inline-flex;
	border: 1px solid #dcdcdc;
	border-radius: 20px;
	overflow: hidden;
	background: #ffffff;
}

.csl-qty-btn {
	background: none;
	border: none;
	padding: 8px 14px;
	cursor: pointer;
	font-weight: bold;
	font-size: 15px;
	color: #555555;
	transition: background 0.2s ease;
}

.csl-qty-btn:hover {
	background: #f0f0f0;
}

.csl-qty-input {
	width: 44px;
	border: none;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	padding: 0;
	outline: none;
	-moz-appearance: textfield;
}

.csl-qty-input::-webkit-outer-spin-button,
.csl-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.csl-qv-ajax-add-to-cart {
	background-color: var(--csl-primary) !important;
	color: #ffffff !important;
	border-radius: 24px !important;
	padding: 12px 24px !important;
	font-weight: 600 !important;
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
	cursor: pointer !important;
	border: none !important;
	transition: var(--csl-transition) !important;
}

.csl-qv-ajax-add-to-cart:hover {
	background-color: var(--csl-primary-hover) !important;
}

.csl-btn-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border-width: 2px;
	border-top-color: #ffffff;
}

.csl-qv-ajax-add-to-cart.is-loading .csl-btn-spinner {
	display: inline-block;
}

.csl-qv-meta {
	font-size: 12px;
	color: #888888;
	padding-top: 14px;
	border-top: 1px solid #eeeeee;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.csl-qv-view-full {
	margin-top: 16px;
}

.csl-full-details-link {
	font-size: 13px;
	color: var(--csl-primary);
	font-weight: 600;
	text-decoration: none;
}

.csl-full-details-link:hover {
	text-decoration: underline;
}

/* ==========================================================================
   8. Slide-Out Mini-Cart Drawer
   ========================================================================== */
.csl-drawer {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 9999999;
	visibility: hidden;
	transition: visibility 0.3s ease;
}

.csl-drawer.is-open {
	visibility: visible;
}

.csl-drawer-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.csl-drawer.is-open .csl-drawer-backdrop {
	opacity: 1;
}

.csl-drawer-panel {
	position: absolute;
	top: 0;
	right: 0;
	width: 100%;
	max-width: 400px;
	height: 100%;
	background: #ffffff;
	box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
	z-index: 2;
}

.csl-drawer.is-open .csl-drawer-panel {
	transform: translateX(0);
}

.csl-drawer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 1px solid #eeeeee;
}

.csl-drawer-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 17px;
	font-weight: 700;
	color: var(--csl-secondary);
}

.csl-drawer-close {
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #888888;
	padding: 4px;
}

.csl-drawer-close:hover {
	color: #000000;
}

.csl-drawer-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}

.csl-drawer-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 60px 24px;
	text-align: center;
	gap: 12px;
	flex: 1;
}

.csl-empty-icon {
	font-size: 42px;
}

.csl-drawer-items {
	flex: 1;
	overflow-y: auto;
	padding: 16px 24px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.csl-drawer-item {
	display: flex;
	gap: 14px;
	padding-bottom: 16px;
	border-bottom: 1px solid #f2f2f2;
	align-items: center;
}

.csl-item-thumb {
	width: 65px;
	height: 65px;
	min-width: 65px;
	border-radius: 8px;
	overflow: hidden;
	background: #f9f8f6;
}

.csl-item-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.csl-item-info {
	flex: 1;
}

.csl-item-title {
	font-size: 14px;
	font-weight: 600;
	margin: 0 0 4px 0;
	line-height: 1.3;
}

.csl-item-title a {
	color: var(--csl-secondary);
	text-decoration: none;
}

.csl-item-price {
	font-size: 13px;
	color: var(--csl-primary);
	font-weight: 700;
	margin-bottom: 8px;
}

.csl-item-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.csl-drawer-qty-stepper {
	display: inline-flex;
	align-items: center;
	border: 1px solid #e0e0e0;
	border-radius: 14px;
	overflow: hidden;
}

.csl-dqty-btn {
	background: none;
	border: none;
	padding: 2px 8px;
	font-size: 13px;
	cursor: pointer;
}

.csl-dqty-val {
	font-size: 12px;
	font-weight: 600;
	padding: 0 6px;
}

.csl-item-remove {
	background: none;
	border: none;
	color: #999999;
	cursor: pointer;
	padding: 4px;
	transition: color 0.2s ease;
}

.csl-item-remove:hover {
	color: #d9534f;
}

.csl-drawer-footer {
	padding: 20px 24px;
	border-top: 1px solid #eeeeee;
	background: #fafafa;
}

.csl-drawer-subtotal {
	display: flex;
	justify-content: space-between;
	font-size: 16px;
	font-weight: 700;
	color: var(--csl-secondary);
	margin-bottom: 6px;
}

.csl-subtotal-val {
	color: var(--csl-primary);
}

.csl-tax-shipping-note {
	font-size: 11px;
	color: #888888;
	margin-bottom: 16px;
}

.csl-drawer-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.csl-btn-checkout {
	background-color: var(--csl-primary) !important;
	color: #ffffff !important;
	border-radius: 24px !important;
	text-align: center !important;
	padding: 13px 20px !important;
	font-weight: 700 !important;
	text-decoration: none !important;
	border: none !important;
	transition: var(--csl-transition) !important;
}

.csl-btn-checkout:hover {
	background-color: var(--csl-primary-hover) !important;
}

.csl-link-cart {
	text-align: center;
	font-size: 13px;
	color: #666666;
	text-decoration: underline;
}

/* ==========================================================================
   9. AJAX Pagination & Load More
   ========================================================================== */
.csl-pagination-wrapper {
	text-align: center;
	margin: 30px 0 50px 0;
	clear: both;
}

.csl-load-more-btn {
	background: #ffffff !important;
	color: var(--csl-secondary) !important;
	border: 2px solid var(--csl-primary) !important;
	border-radius: 28px !important;
	padding: 12px 36px !important;
	font-size: 15px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	transition: var(--csl-transition) !important;
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
}

.csl-load-more-btn:hover {
	background: var(--csl-primary) !important;
	color: #ffffff !important;
}

.csl-lm-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border-width: 2px;
	border-top-color: var(--csl-primary);
}

.csl-load-more-btn.is-loading .csl-lm-spinner {
	display: inline-block;
}

.csl-no-more-notice {
	font-size: 14px;
	color: #888888;
	font-style: italic;
	padding: 10px;
}
