/**
 * CDEC Frontend – theme-adaptive + mobile-first responsive
 */

*,
*::before,
*::after {
	box-sizing: border-box;
}

.cdec-products,
.cdec-product,
.cdec-cart-table,
.cdec-checkout-form,
.cdec-account-dashboard,
.cdec-single-product-wrap,
.cdec-archive-product-wrap,
.cdec-order-received,
.cdec-single-product-summary,
.cdec-bundle-options {
	font-family: inherit;
	color: inherit;
	line-height: inherit;
	max-width: 100%;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

img {
	max-width: 100%;
	height: auto;
}

/* ---------- Product grid (mobile-first) ---------- */
.cdec-products {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
	margin: 1.25rem 0;
	width: 100%;
}

@media (min-width: 480px) {
	.cdec-products.columns-2,
	.cdec-products.columns-3,
	.cdec-products.columns-4,
	.cdec-products.columns-5 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 768px) {
	.cdec-products.columns-3 { grid-template-columns: repeat(3, 1fr); }
	.cdec-products.columns-4 { grid-template-columns: repeat(3, 1fr); }
	.cdec-products.columns-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
	.cdec-products.columns-4 { grid-template-columns: repeat(4, 1fr); }
	.cdec-products.columns-5 { grid-template-columns: repeat(5, 1fr); }
}

.cdec-product {
	border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
	padding: 1rem;
	text-align: center;
	border-radius: var(--cdec-radius, 0.35em);
	background: var(--cdec-bg, transparent);
	width: 100%;
	min-width: 0;
}

.cdec-product a {
	color: inherit;
	text-decoration: none;
	display: block;
}

.cdec-product img {
	max-width: 100%;
	height: auto;
	margin: 0 auto 0.75rem;
	display: block;
	border-radius: var(--cdec-radius, 0.25em);
}

.cdec-product h3 {
	font-size: 1.05em;
	margin: 0.5rem 0;
	color: inherit;
	overflow-wrap: anywhere;
}

.cdec-price {
	font-size: 1.1em;
	font-weight: 600;
	margin: 0.5rem 0;
	color: var(--cdec-price, inherit);
}

.cdec-price del {
	opacity: 0.55;
	font-weight: normal;
	margin-right: 0.35em;
}

.cdec-price ins {
	text-decoration: none;
}

/* ---------- Buttons ---------- */
.cdec-button {
	display: inline-block;
	background: var(--cdec-button, var(--wp--preset--color--primary, currentColor));
	color: var(--cdec-button-text, #fff) !important;
	padding: 0.65em 1.15em;
	border: none;
	border-radius: var(--cdec-radius, 0.35em);
	cursor: pointer;
	text-decoration: none !important;
	font-size: 1em;
	font-family: inherit;
	font-weight: 600;
	line-height: 1.35;
	max-width: 100%;
	touch-action: manipulation;
}

.cdec-button:hover,
.cdec-button:focus {
	filter: brightness(0.92);
	color: var(--cdec-button-text, #fff) !important;
}

.cdec-button-primary {
	background: var(--cdec-primary, var(--wp--preset--color--primary, var(--cdec-button, currentColor)));
}

.cdec-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ---------- Cart: stack on mobile, table on desktop ---------- */
.cdec-cart-table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin-bottom: 1rem;
}

.cdec-cart-table,
.cdec-orders-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1rem;
	min-width: 0;
}

.cdec-cart-table th,
.cdec-cart-table td,
.cdec-orders-table th,
.cdec-orders-table td {
	padding: 0.65rem 0.5rem;
	border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
	text-align: left;
	vertical-align: middle;
}

/* Mobile cart: card layout instead of cramped table */
@media (max-width: 640px) {
	.cdec-cart-table thead {
		display: none;
	}
	.cdec-cart-table,
	.cdec-cart-table tbody,
	.cdec-cart-table tr,
	.cdec-cart-table td {
		display: block;
		width: 100%;
	}
	.cdec-cart-table tr {
		border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
		border-radius: var(--cdec-radius, 0.35em);
		margin-bottom: 1rem;
		padding: 0.75rem;
	}
	.cdec-cart-table td {
		border: none;
		padding: 0.35rem 0;
		text-align: left !important;
	}
	.cdec-cart-table td.cdec-product-thumb {
		text-align: center !important;
		margin-bottom: 0.5rem;
	}
	.cdec-cart-table td.cdec-product-thumb img {
		max-width: 80px;
		margin: 0 auto;
	}
	.cdec-cart-totals {
		max-width: 100%;
		margin-left: 0;
	}
}

.cdec-cart-totals {
	max-width: 24rem;
	margin-left: auto;
	width: 100%;
}

.cdec-cart-totals table {
	width: 100%;
	border-collapse: collapse;
}

.cdec-cart-totals th,
.cdec-cart-totals td {
	padding: 0.5rem 0;
	border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}

.cdec-coupon-form {
	margin: 1rem 0;
}

.cdec-coupon-form form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.cdec-coupon-form input[type="text"] {
	flex: 1 1 10rem;
	min-width: 0;
	padding: 0.6em;
	border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
	border-radius: var(--cdec-radius, 0.35em);
	font: inherit;
	color: inherit;
	background: transparent;
}

/* ---------- Checkout ---------- */
.cdec-checkout-columns {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.75rem;
	width: 100%;
}

@media (min-width: 768px) {
	.cdec-checkout-columns {
		grid-template-columns: 1fr 1fr;
		gap: 2.5rem;
	}
}

.cdec-checkout-form label {
	display: block;
	margin-bottom: 0.25rem;
	font-weight: 600;
}

.cdec-checkout-form input[type="text"],
.cdec-checkout-form input[type="email"],
.cdec-checkout-form input[type="tel"],
.cdec-checkout-form input[type="number"],
.cdec-checkout-form textarea,
.cdec-checkout-form select,
.cdec-product-filters input,
.cdec-product-filters select,
.cdec-variation-select select,
.cdec-bundle-options select {
	width: 100%;
	max-width: 100%;
	padding: 0.65em 0.75em;
	border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
	border-radius: var(--cdec-radius, 0.35em);
	margin-bottom: 0.75rem;
	font-family: inherit;
	font-size: 16px; /* prevents iOS zoom */
	color: inherit;
	background: var(--cdec-input-bg, transparent);
	-webkit-appearance: none;
	appearance: none;
}

.cdec-payment-methods {
	list-style: none;
	padding: 0;
	margin: 0 0 1rem;
}

.cdec-payment-methods li {
	margin-bottom: 0.75rem;
	padding: 0.75rem;
	border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
	border-radius: var(--cdec-radius, 0.35em);
}

/* ---------- Notices ---------- */
.cdec-notice {
	padding: 0.75rem 1rem;
	margin-bottom: 1rem;
	border-radius: var(--cdec-radius, 0.35em);
	border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
	background: color-mix(in srgb, currentColor 6%, transparent);
}

.cdec-notice-success {
	border-color: color-mix(in srgb, #2e7d32 40%, currentColor);
	background: color-mix(in srgb, #2e7d32 10%, transparent);
}

.cdec-notice-error {
	border-color: color-mix(in srgb, #c62828 40%, currentColor);
	background: color-mix(in srgb, #c62828 10%, transparent);
}

/* ---------- Single product ---------- */
.cdec-single-product-wrap,
.cdec-archive-product-wrap {
	width: 100%;
	max-width: 1100px;
	margin: 1.5rem auto;
	padding: 0 1rem;
}

.cdec-single-product-summary {
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}

.cdec-single-image {
	margin-bottom: 1rem;
}

.cdec-single-image img {
	width: 100%;
	max-width: 100%;
	height: auto;
	border-radius: var(--cdec-radius, 0.35em);
	display: block;
}

/* Product gallery thumbnails */
.cdec-gallery-thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 0.5rem;
}

.cdec-gallery-thumb {
	display: block;
	padding: 0;
	border: 2px solid transparent;
	border-radius: var(--cdec-radius, 0.35em);
	background: transparent;
	cursor: pointer;
	overflow: hidden;
	width: 64px;
	height: 64px;
	flex-shrink: 0;
	transition: border-color 0.15s ease;
}

.cdec-gallery-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: calc(var(--cdec-radius, 0.35em) - 2px);
}

.cdec-gallery-thumb:hover,
.cdec-gallery-thumb.is-active {
	border-color: var(--cdec-primary, #2271b1);
}

.cdec-variation-select,
.cdec-bundle-item {
	margin-bottom: 0.85rem;
	max-width: 100%;
}

.cdec-variation-select label,
.cdec-bundle-item label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.cdec-add-to-cart-form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.cdec-add-to-cart-form input[type="number"] {
	width: 4.5rem;
	min-width: 4.5rem;
	padding: 0.65em;
	font-size: 16px;
	border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
	border-radius: var(--cdec-radius, 0.35em);
	font-family: inherit;
	color: inherit;
	background: transparent;
}

/* ---------- Filters ---------- */
.cdec-product-filters {
	margin-bottom: 1.25rem;
	padding: 1rem;
	border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
	border-radius: var(--cdec-radius, 0.35em);
	background: color-mix(in srgb, currentColor 3%, transparent);
}

.cdec-product-filters form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: flex-end;
}

.cdec-product-filters form > div {
	flex: 1 1 8rem;
	min-width: 0;
}

/* ---------- Account ---------- */
.cdec-account-dashboard {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
	width: 100%;
}

@media (min-width: 768px) {
	.cdec-account-dashboard {
		grid-template-columns: 12rem 1fr;
		gap: 2rem;
	}
}

.cdec-account-nav {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 0.4rem;
}

@media (min-width: 768px) {
	.cdec-account-nav {
		flex-direction: column;
	}
}

.cdec-account-nav a {
	padding: 0.6em 0.9em;
	border-radius: var(--cdec-radius, 0.35em);
	text-decoration: none;
	color: inherit;
	background: color-mix(in srgb, currentColor 6%, transparent);
	display: inline-block;
}

.cdec-account-nav a:hover,
.cdec-account-nav a.active {
	background: var(--cdec-primary, var(--wp--preset--color--primary, currentColor));
	color: var(--cdec-button-text, #fff);
}

.cdec-account-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 1rem 0;
}

.cdec-stat-card {
	background: color-mix(in srgb, currentColor 5%, transparent);
	padding: 1rem 1.25rem;
	border-radius: var(--cdec-radius, 0.5em);
	text-align: center;
	flex: 1 1 6.5rem;
	min-width: 0;
	border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}

.cdec-stat-number {
	display: block;
	font-size: 1.35em;
	font-weight: 700;
}

.cdec-orders-table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
	.cdec-orders-table thead { display: none; }
	.cdec-orders-table, .cdec-orders-table tbody, .cdec-orders-table tr, .cdec-orders-table td {
		display: block;
		width: 100%;
	}
	.cdec-orders-table tr {
		border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
		border-radius: var(--cdec-radius, 0.35em);
		margin-bottom: 0.75rem;
		padding: 0.75rem;
	}
	.cdec-orders-table td {
		border: none;
		padding: 0.25rem 0;
	}
}

/* ---------- Bundles ---------- */
.cdec-bundle-options {
	margin: 1rem 0;
	padding: 1rem;
	border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
	border-radius: var(--cdec-radius, 0.35em);
}

.cdec-bundle-options h4 {
	margin: 0 0 0.75rem;
}

.cdec-bundle-item {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin-bottom: 0.75rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.cdec-bundle-item:last-child {
	border-bottom: none;
}

.cdec-bundle-item img {
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 4px;
	flex-shrink: 0;
}

.cdec-bundle-item .cdec-bundle-info {
	flex: 1 1 10rem;
	min-width: 0;
}

.cdec-remove {
	font-size: 1.35em;
	color: inherit;
	opacity: 0.7;
	text-decoration: none;
	padding: 0.25rem 0.5rem;
}

/* Prevent content hiding under fixed headers on mobile */
.cdec-single-product-wrap,
.cdec-archive-product-wrap,
.cdec-account-content {
	position: relative;
	z-index: 1;
}


/* ---------- WooCommerce-style single product ---------- */
.cdec-single-product-wrap {
	width: 100%;
	max-width: 1100px;
	margin: 1.5rem auto;
	padding: 0 1rem;
}

.cdec-single-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5rem;
	align-items: start;
	width: 100%;
}

@media (min-width: 768px) {
	.cdec-single-layout {
		grid-template-columns: 1fr 1fr;
		gap: 2.5rem;
	}
}

.cdec-single-gallery,
.cdec-single-summary {
	min-width: 0;
	width: 100%;
}

.cdec-single-image img,
#cdec-main-image {
	width: 100%;
	height: auto;
	display: block;
	border-radius: var(--cdec-radius, 0.5em);
	object-fit: cover;
}

.cdec-product-title {
	margin: 0 0 0.75rem;
	font-size: 1.75rem;
	line-height: 1.25;
	color: inherit;
}

.cdec-price-hint {
	opacity: 0.7;
	font-size: 0.9em;
	margin: 0.25rem 0 0.75rem;
}

.cdec-product-short-description {
	margin: 1rem 0;
	line-height: 1.6;
}

.cdec-add-to-cart-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
	margin-top: 1rem;
}

.cdec-qty-input {
	width: 4.5rem !important;
	min-width: 4.5rem;
	padding: 0.65em !important;
	font-size: 16px !important;
	border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
	border-radius: var(--cdec-radius, 0.35em);
	font-family: inherit;
	color: inherit;
	background: transparent;
}

.cdec-add-to-cart-row .cdec-button {
	flex: 1 1 auto;
	min-width: 8rem;
	text-align: center;
}

.cdec-variation-select {
	margin-bottom: 0.85rem;
}

.cdec-variation-select select {
	width: 100%;
	max-width: 100%;
}

.cdec-variation-message {
	min-height: 1.2em;
	color: inherit;
	opacity: 0.85;
	margin: 0.5rem 0;
}

.cdec-promo-countdown {
	margin: 0.5rem 0;
	font-weight: 600;
	color: inherit;
}

.cdec-back-to-shop {
	margin-top: 2rem;
}

/* ==========================================================================
   Menu cart icon + right drawer
   ========================================================================== */
.cdec-menu-cart-item {
	list-style: none;
	display: flex;
	align-items: center;
}

.cdec-menu-cart-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: none;
	background: transparent;
	color: inherit;
	cursor: pointer;
	border-radius: 999px;
	line-height: 1;
}

.cdec-menu-cart-btn:hover,
.cdec-menu-cart-btn:focus {
	opacity: 0.85;
	outline: none;
}

.cdec-menu-cart-icon {
	display: flex;
	align-items: center;
	justify-content: center;
}

.cdec-menu-cart-count {
	position: absolute;
	top: 2px;
	right: 0;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--cdec-primary, #2271b1);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	box-sizing: border-box;
}

.cdec-menu-cart-count.is-empty {
	display: none;
}

.cdec-cart-drawer-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 1000000;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cdec-cart-drawer-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

.cdec-cart-drawer {
	position: fixed;
	top: 0;
	right: 0;
	width: min(400px, 100vw);
	height: 100%;
	background: #fff;
	color: #1d2327;
	z-index: 1000001;
	display: flex;
	flex-direction: column;
	box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
	transform: translateX(100%);
	transition: transform 0.28s ease;
}

.cdec-cart-drawer.is-open {
	transform: translateX(0);
}

body.cdec-cart-drawer-open {
	overflow: hidden;
}

.cdec-cart-drawer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	border-bottom: 1px solid #e2e4e7;
}

.cdec-cart-drawer-title {
	margin: 0;
	font-size: 1.15rem;
}

.cdec-cart-drawer-close {
	border: none;
	background: transparent;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: inherit;
	padding: 0 4px;
}

.cdec-cart-drawer-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 12px 18px;
}

.cdec-cart-drawer-empty {
	margin: 24px 0;
	opacity: 0.75;
	text-align: center;
}

.cdec-cart-drawer-items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cdec-cart-drawer-item {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 12px 0;
	border-bottom: 1px solid #eee;
	position: relative;
}

.cdec-cart-drawer-thumb img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 6px;
	display: block;
}

.cdec-cart-drawer-info {
	flex: 1 1 auto;
	min-width: 0;
}

.cdec-cart-drawer-name {
	font-weight: 600;
	text-decoration: none;
	color: inherit;
	display: block;
	margin-bottom: 4px;
}

.cdec-cart-drawer-meta {
	font-size: 0.9em;
	opacity: 0.85;
}

.cdec-cart-drawer-line {
	margin-top: 4px;
	font-weight: 600;
}

.cdec-cart-drawer-remove {
	border: none;
	background: transparent;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #b32d2e;
	padding: 0 4px;
	flex-shrink: 0;
}

.cdec-cart-drawer-footer {
	padding: 16px 18px 20px;
	border-top: 1px solid #e2e4e7;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cdec-cart-drawer-subtotal {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 1.05rem;
}

.cdec-cart-drawer-checkout {
	display: block;
	text-align: center;
	text-decoration: none;
	width: 100%;
	box-sizing: border-box;
}

.cdec-cart-drawer-view-cart {
	text-align: center;
	font-size: 0.95em;
	color: inherit;
	opacity: 0.8;
}

.cdec-menu-cart-btn--elementor {
	width: auto;
	height: auto;
	gap: 6px;
	padding: 6px 10px;
}

.cdec-menu-cart-label {
	font-size: 0.95em;
	font-weight: 600;
}
