/* Credit Digital Products – grid + product modal */

/* Palette (shared by the grid and the modal) */
.cdp-products,
.cdp-modal {
	--cdp-btn-bg: #1f2430;              /* buttons, title pills */
	--cdp-btn-text: #f4d9a0;            /* button text */
	--cdp-btn-bg-hover: #2e3546;        /* button hover */
	--cdp-border: #d9c9a0;              /* frames around boxes and cards */
	--cdp-surface: #fbf7ef;             /* product page + grid card background */
	--cdp-box-bg: #ffffff;              /* boxes inside the product page */
	--cdp-accent: #a8791f;              /* price, highlights, active states */
	--cdp-text: #1f2430;                /* titles and body text */
	--cdp-muted: #6b6455;               /* secondary text */
	--cdp-img-bg: #f3ecdd;              /* image area while loading */
}

.cdp-products {
	--cdp-cols: 4;
	--cdp-cols-tablet: 2;
	--cdp-cols-mobile: 1;
	--cdp-gap: 24px;
	--cdp-ratio: 1 / 1;
	--cdp-radius: 12px;
	--cdp-card-bg: var(--cdp-surface);
}

.cdp-grid {
	display: grid;
	grid-template-columns: repeat(var(--cdp-cols), minmax(0, 1fr));
	gap: var(--cdp-gap);
}

@media (max-width: 1024px) {
	.cdp-grid { grid-template-columns: repeat(var(--cdp-cols-tablet), minmax(0, 1fr)); }
}

@media (max-width: 767px) {
	.cdp-grid { grid-template-columns: repeat(var(--cdp-cols-mobile), minmax(0, 1fr)); }
}

.cdp-products--empty {
	padding: 32px;
	text-align: center;
	color: #6b6455;
	background: #fbf7ef;
	border: 1px solid #d9c9a0;
	border-radius: 12px;
}

/* Category filter chips */
.cdp-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 24px;
}

/* Scoped under .cdp-products so Elementor kit button styles don't override them. */
.cdp-products .cdp-chip {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 8px 18px;
	border: 1px solid var(--cdp-border);
	border-radius: 999px;
	background: var(--cdp-surface);
	color: var(--cdp-text);
	font: inherit;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.cdp-products .cdp-chip:hover,
.cdp-products .cdp-chip:focus-visible {
	background: var(--cdp-surface);
	border-color: var(--cdp-text);
	color: var(--cdp-text);
	outline: none;
}

.cdp-products .cdp-chip.is-active {
	background: var(--cdp-btn-bg);
	border-color: var(--cdp-btn-bg);
	color: var(--cdp-btn-text);
}

/* Results counter under the chips */
.cdp-results {
	margin: 0 0 16px;
	font-size: 14px;
	color: var(--cdp-muted);
}

.cdp-filter + .cdp-results { margin-top: -10px; }

/* Download arrow and views eye (inline SVG, currentColor) */
.cdp-dl-icon,
.cdp-views-icon {
	width: 1.1em;
	height: 1.1em;
	flex: none;
	display: inline-block;
	vertical-align: middle;
}

/* Card */
.cdp-card[hidden] { display: none; }

.cdp-card {
	display: flex;
	flex-direction: column;
	background: var(--cdp-card-bg);
	border: 1px solid var(--cdp-border);
	border-radius: var(--cdp-radius);
	overflow: hidden;
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}

.cdp-card:hover,
.cdp-card:focus-visible {
	transform: translateY(-3px);
	border-color: var(--cdp-accent);
	box-shadow: 0 10px 24px rgba(31, 36, 48, .10);
	outline: none;
}

.cdp-card:focus-visible { box-shadow: 0 0 0 3px var(--cdp-accent); }

.cdp-card__media {
	position: relative;
	aspect-ratio: var(--cdp-ratio);
	background: var(--cdp-img-bg);
	border-bottom: 1px solid var(--cdp-border);
	overflow: hidden;
}

.cdp-card__media img,
.cdp-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .35s ease;
}

.cdp-card:hover .cdp-card__img { transform: scale(1.04); }
.cdp-no-zoom .cdp-card:hover .cdp-card__img { transform: none; }

.cdp-card__placeholder {
	position: absolute;
	inset: 0;
	background: var(--cdp-img-bg);
}

.cdp-card__badge {
	position: absolute;
	top: 10px;
	inset-inline-start: 10px;
	background: var(--cdp-btn-bg);
	color: var(--cdp-btn-text);
	font-size: 12px;
	font-weight: 700;
	padding: 3px 10px;
	border-radius: 999px;
}

.cdp-card__badge[hidden] { display: none; }

.cdp-card__body {
	padding: 14px 16px 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
}

.cdp-card__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
	color: var(--cdp-text);
}

/* Price + downloads row at the bottom of the card */
.cdp-card__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: auto;
}

.cdp-card__stats {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.cdp-card__downloads,
.cdp-card__views {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	font-weight: 600;
	color: var(--cdp-muted);
	white-space: nowrap;
}

.cdp-card__downloads[hidden],
.cdp-card__views[hidden] { display: none; }

.cdp-card__price {
	display: flex;
	align-items: center;
	gap: 5px;
	color: var(--cdp-accent);
	font-weight: 700;
	font-size: 15px;
}

.cdp-card__price-label {
	font-weight: 600;
	font-size: .85em;
}

/* Modal */
body.cdp-modal-open { overflow: hidden; }

.cdp-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	color: var(--cdp-text);
}

.cdp-modal.is-open { display: flex; }

.cdp-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(31, 36, 48, .65); /* #1f2430 at 65% */
}

.cdp-modal__dialog {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	gap: 28px;
	width: 100%;
	max-width: 1000px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	background: var(--cdp-surface);
	border: 1px solid var(--cdp-border);
	border-radius: 14px;
	padding: 28px;
	box-shadow: 0 25px 60px rgba(0, 0, 0, .25);
}

.cdp-modal__dialog.is-no-gallery {
	grid-template-columns: 1fr;
	max-width: 620px;
}

.cdp-modal__dialog.is-no-gallery .cdp-modal__gallery { display: none; }

/* Without images the buy panel moves below the product info. */
.cdp-modal__dialog.is-no-gallery .cdp-modal__side { order: 2; }
.cdp-modal__dialog.is-no-gallery .cdp-modal__buy { margin-top: 0; }

.cdp-modal .cdp-modal__close {
	position: absolute;
	top: 10px;
	inset-inline-end: 10px;
	width: 38px;
	height: 38px;
	border: 1px solid var(--cdp-border);
	border-radius: 50%;
	background: var(--cdp-box-bg);
	color: var(--cdp-text);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
	padding: 0;
}

.cdp-modal .cdp-modal__close:hover { border-color: var(--cdp-accent); color: var(--cdp-accent); background: var(--cdp-box-bg); }

.cdp-modal__main {
	position: relative;
	aspect-ratio: 1 / 1;
	max-height: min(440px, 50vh); /* keeps the buy button visible without scrolling */
	width: 100%;
	background: var(--cdp-img-bg);
	border: 1px solid var(--cdp-border);
	border-radius: 10px;
	overflow: hidden;
}

.cdp-modal__main img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.cdp-modal .cdp-modal__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: var(--cdp-btn-bg);
	color: var(--cdp-btn-text);
	font-size: 20px;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
	padding: 0;
}

.cdp-modal .cdp-modal__nav:hover { background: var(--cdp-btn-bg-hover); color: var(--cdp-btn-text); }
.cdp-modal .cdp-modal__nav--prev { inset-inline-start: 10px; }
.cdp-modal .cdp-modal__nav--next { inset-inline-end: 10px; }
.cdp-modal .cdp-modal__nav[hidden] { display: none; }

.cdp-modal__thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.cdp-modal .cdp-modal__thumb {
	width: 64px;
	height: 64px;
	padding: 0;
	border: 2px solid var(--cdp-border);
	border-radius: 8px;
	overflow: hidden;
	cursor: pointer;
	background: var(--cdp-img-bg);
}

.cdp-modal .cdp-modal__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cdp-modal .cdp-modal__thumb.is-active { border-color: var(--cdp-accent); }

.cdp-modal__title {
	margin: 0 0 8px;
	font-size: 24px;
	line-height: 1.3;
	color: var(--cdp-text);
	padding-inline-end: 36px;
}

/* "מחיר - 45 [icon] (קרדיטים)" */
.cdp-modal__price {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 18px;
	font-size: 20px;
	line-height: 1.2;
}

.cdp-modal__price-label {
	font-weight: 600;
	color: var(--cdp-text);
}

.cdp-modal__price-num {
	font-weight: 700;
	color: var(--cdp-accent);
}

.cdp-modal__price-unit {
	font-size: .8em;
	font-weight: 600;
	color: var(--cdp-accent);
}

/* Views + downloads line under the price in the product window */
.cdp-modal__stats {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 16px;
	margin: -8px 0 18px;
}

.cdp-modal__stats[hidden] { display: none; }

.cdp-modal__downloads,
.cdp-modal__views {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	color: var(--cdp-muted);
}

.cdp-modal__downloads[hidden],
.cdp-modal__views[hidden] { display: none; }

.cdp-credit-icon {
	width: 1.15em;
	height: 1.15em;
	flex: none;
	display: inline-block;
	vertical-align: middle;
}

/* Framed info boxes (description / production settings) */
.cdp-modal__box {
	padding: 14px 16px;
	background: var(--cdp-box-bg);
	border: 1px solid var(--cdp-border);
	border-radius: 10px;
	font-size: 15px;
	line-height: 1.65;
	color: var(--cdp-text);
}

.cdp-modal__box + .cdp-modal__box { margin-top: 14px; }

/* The slot keeps the buy panel's confirm-step height reserved (set by JS) so nothing below it moves. */
.cdp-modal__buy-slot {
	position: relative;
	display: flow-root; /* keeps the panel's margin inside the measured height */
}

/* License terms – under the buy panel. */
.cdp-modal__buy-slot + .cdp-modal__box--license { margin-top: 20px; }

.cdp-modal__box--license {
	font-size: 14px;
	line-height: 1.6;
}
.cdp-modal__box[hidden] { display: none; }

/* Box titles are dark pills, like the section labels in the palette reference. */
.cdp-modal__box-title {
	display: inline-block;
	margin: 0 0 10px;
	padding: 5px 12px;
	border-radius: 6px;
	background: var(--cdp-btn-bg);
	color: var(--cdp-btn-text);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
}

.cdp-modal__box-title[hidden] { display: none; }

.cdp-modal__box-body > :first-child { margin-top: 0; }
.cdp-modal__box-body > :last-child { margin-bottom: 0; }

.cdp-modal__box--production {
	font-size: 14px;
	line-height: 1.6;
}

/* Buy panel – under the gallery (right column in RTL). */
.cdp-modal__buy {
	margin-top: 24px;
	padding: 18px;
	background: var(--cdp-box-bg);
	border: 1px solid var(--cdp-border);
	border-radius: 12px;
	box-shadow: 0 6px 18px rgba(31, 36, 48, .06);
}

.cdp-modal__note {
	margin: 10px 0 0;
	font-size: 13px;
	color: var(--cdp-muted);
	text-align: center;
}


.cdp-modal__confirm-text {
	margin: 0 0 10px;
	font-weight: 600;
}

.cdp-modal__confirm-text .cdp-credit-icon { margin-inline: 2px; }

/* "I agree to the license" checkbox in the confirm step. */
.cdp-modal__agree {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 14px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--cdp-text);
	cursor: pointer;
}

.cdp-modal__agree input {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 1px 0 0;
	accent-color: var(--cdp-btn-bg);
	cursor: pointer;
}

.cdp-modal__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* Buttons – scoped under .cdp-modal so Elementor kit button styles don't override them. */
.cdp-modal .cdp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 22px;
	border: 1px solid var(--cdp-btn-bg);
	border-radius: 8px;
	background: var(--cdp-btn-bg);
	color: var(--cdp-btn-text);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
}

.cdp-modal .cdp-btn:hover,
.cdp-modal .cdp-btn:focus-visible {
	background: var(--cdp-btn-bg-hover);
	border-color: var(--cdp-btn-bg-hover);
	color: var(--cdp-btn-text);
	text-decoration: none;
	outline: none;
}

.cdp-modal .cdp-btn:focus-visible { box-shadow: 0 0 0 3px var(--cdp-border); }

.cdp-modal .cdp-btn[disabled] { opacity: .6; cursor: not-allowed; }
.cdp-modal .cdp-btn.is-loading { cursor: wait; }

.cdp-modal .cdp-btn .cdp-credit-icon { margin-inline-start: -2px; }

/* Secondary buttons share the same palette. */
.cdp-modal .cdp-btn--ghost { background: var(--cdp-btn-bg); color: var(--cdp-btn-text); }

.cdp-modal__buy .cdp-btn { flex: 1 1 100%; }

/* Main call-to-action: large, full width, lifted. */
.cdp-modal .cdp-btn--cta {
	width: 100%;
	min-height: 60px;
	padding: 14px 24px;
	border-radius: 10px;
	font-size: 19px;
	letter-spacing: .01em;
	box-shadow: 0 10px 22px rgba(31, 36, 48, .28);
	transition: background-color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.cdp-modal .cdp-btn--cta:hover,
.cdp-modal .cdp-btn--cta:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 14px 28px rgba(31, 36, 48, .34);
}

.cdp-modal .cdp-btn--cta:focus-visible { box-shadow: 0 0 0 3px var(--cdp-border), 0 14px 28px rgba(31, 36, 48, .34); }
.cdp-modal .cdp-btn--cta[disabled] { transform: none; box-shadow: none; }
.cdp-modal .cdp-btn--cta .cdp-credit-icon { width: 1.25em; height: 1.25em; }

.cdp-modal .cdp-btn.is-loading::after {
	content: "";
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: cdp-spin .7s linear infinite;
}

@keyframes cdp-spin { to { transform: rotate(360deg); } }

.cdp-modal__msg {
	margin-top: 12px;
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.5;
}

.cdp-modal__msg:empty { display: none; }
.cdp-modal__msg.is-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.cdp-modal__msg.is-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

@media (max-width: 767px) {
	.cdp-modal { padding: 0; align-items: stretch; }
	.cdp-modal__dialog {
		grid-template-columns: 1fr;
		gap: 18px;
		max-height: 100vh;
		height: 100%;
		border: 0;
		border-radius: 0;
		padding: 56px 16px 24px;
	}
	.cdp-modal__title { font-size: 20px; }
	.cdp-modal__buttons .cdp-btn { flex: 1 1 100%; }

	/* Mobile order: images → name + price → buy panel → description boxes. */
	.cdp-modal__dialog { display: flex; flex-direction: column; gap: 14px; }
	.cdp-modal__side,
	.cdp-modal__info { display: contents; }
	.cdp-modal__gallery { order: 1; }
	.cdp-modal__title { order: 2; margin: 0; }
	.cdp-modal__price { order: 3; margin: 0; }
	.cdp-modal__stats { order: 3; margin: -6px 0 0; }
	.cdp-modal__buy-slot { order: 4; }
	.cdp-modal__buy { margin-top: 0; }
	.cdp-modal__box { order: 6; }
	.cdp-modal__box--license { order: 5; }
	.cdp-modal__box + .cdp-modal__box,
	.cdp-modal__buy-slot + .cdp-modal__box--license { margin-top: 0; }
	.cdp-modal .cdp-btn--cta { font-size: 18px; min-height: 56px; }
}
