/*
 * Wallex Advanced Carousel – frontend styles
 *
 * Accordion-style vertical carousel (RTL). Colors resolve from the Wallex theme
 * CSS variables where present, and fall back to a self-contained dark palette so
 * the widget looks correct outside the theme too.
 */

.wallex-ac-wrap {
	box-sizing: border-box;
	width: 100%;
	margin-inline: auto;
	direction: rtl;
}

.wallex-ac-wrap *,
.wallex-ac-wrap *::before,
.wallex-ac-wrap *::after {
	box-sizing: border-box;
}

.wallex-ac {
	display: flex;
	flex-direction: column;
	gap: 14px;
	width: 100%;
}

/* ---------------------------------- Item ---------------------------------- */
.wallex-ac__item {
	padding: 18px 22px;
	background: var(--color-bg, #12141c);
	border: 1px solid var(--color-stroke-2, rgba(255, 255, 255, 0.06));
	border-radius: var(--cornerRadiusXL, 16px);
	transition: border-color 0.2s ease, background 0.2s ease;
}

/* ---------------------------------- Head ---------------------------------- */
.wallex-ac__head {
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: 44px;
	align-content: center;
	justify-content: space-between;
}

.wallex-ac__title {
	justify-self: start;
	min-width: 0;
	width: 33%;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.6;
	color: var(--color-text-1, #ffffff);
	overflow-wrap: anywhere;
}

.wallex-ac__media {
	position: relative;
	justify-self: center;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	width: 33%;
}

.wallex-ac__img {
	display: block;
	position: relative;
	width: 172px !important;
	height: 32px !important;
	object-fit: contain;
}

/* --------------------------------- Toggle --------------------------------- */
.wallex-ac__toggle {
	justify-self: end;
	display: inline-flex;
	justify-content: flex-end;
	align-items: center;
	gap: 6px;
	width: 33%;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--color-gradPirmaryBrand, #9aa4b2);
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.2s ease, opacity 0.2s ease;
}

.wallex-ac__toggle:hover,
.wallex-ac__toggle:focus-visible {
	color: var(--color-gradPirmaryBrandDark, #ffffff);
	outline: none;
}

/* Placeholder keeps the 3-column grid balanced for items with no details. */
.wallex-ac__toggle--empty {
	cursor: default;
	pointer-events: none;
}

/* -------------------------------- Details --------------------------------- */
/* grid-template-rows 0fr -> 1fr gives a smooth height transition without JS. */
.wallex-ac__details {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.32s ease;
}

.wallex-ac__item.is-open .wallex-ac__details {
	grid-template-rows: 1fr;
}

.wallex-ac__details-inner {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 0;
}

.wallex-ac__text {
	margin: 16px 0 0;
	font-size: 0.95rem;
	line-height: 2;
	color: var(--color-text-2, rgba(255, 255, 255, 0.72));
	text-align: justify;
}

/* --------------------------------- Button --------------------------------- */
.wallex-ac__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 18px auto 4px;
	padding: 8px 16px;
	background: var(--color-negativeGlassBg, #ffffff);
	border: 1px solid var(--color-stroke-3, rgba(255, 255, 255, 0.18));
	border-radius: var(--cornerRadiusPill, 999px);
	font-size: 0.75rem;
	font-weight: 400;
	color: var(--color-text-1, #ffffff);
	text-decoration: none;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wallex-ac__btn:hover,
.wallex-ac__btn:focus-visible {
	background: var(--color-negativeGlassBg-2, #2f6bff);
	outline: none;
}

/* ------------------------------- Responsive ------------------------------- */
@media (max-width: 600px) {
	.wallex-ac__item {
		padding: 16px 16px;
	}

	.wallex-ac__head {
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: center;
		gap: 10px 12px;
	}

	.wallex-ac__title {
		font-size: 0.98rem;
	}

	/* Toggle drops to its own full-width row and centers under the header. */
	.wallex-ac__toggle {
		grid-column: 1 / -1;
		justify-self: center;
	}

	.wallex-ac__toggle--empty {
		display: none;
	}

	.wallex-ac__title,
	.wallex-ac__media,
	.wallex-ac__btn {
		width: 100%;
		text-align: center;
	}
}

/* ========================================================================== */
/* Card mode                                                                  */
/* ========================================================================== */
/*
 * Light-themed horizontal grid of cards. Reuses the same markup as the
 * accordion: the head becomes `display:contents` so image / title / toggle sit
 * directly in the card's flex column and can be reordered. A card shows its
 * image while collapsed and swaps it for the text while expanded. Single-open
 * behaviour is unchanged (handled in JS). All rules are scoped to
 * `.wallex-ac--card` so accordion mode is untouched.
 */
.wallex-ac--card .wallex-ac {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 22px;
	align-items: stretch;
}

.wallex-ac--card .wallex-ac__item {
	display: flex;
	flex-direction: column;
	padding: 26px 24px;
	background: var(--color-bg, #ffffff);
	border: 1px solid var(--color-stroke-2, rgba(20, 20, 43, 0.10));
	border-radius: var(--cornerRadiusXL, 16px);
	box-shadow: 0 6px 22px rgba(20, 20, 43, 0.05);
}

/* Let head children flow into the card's flex column so `order` can arrange
   image → title → details → toggle vertically. */
.wallex-ac--card .wallex-ac__head {
	display: contents;
}

.wallex-ac--card .wallex-ac__media {
	order: 1;
	width: 100%;
	min-height: 120px;
	margin-bottom: 18px;
}

.wallex-ac--card .wallex-ac__img {
	max-height: 150px;
	height: auto !important;
	width: auto !important;
}

.wallex-ac--card .wallex-ac__title {
	order: 2;
	margin-bottom: 12px;
	text-align: center;
	font-size: 1.1rem;
	width: 100%;
}

.wallex-ac--card .wallex-ac__details {
	order: 3;
}

.wallex-ac--card .wallex-ac__text {
	margin: 0 0 4px;
	color: var(--color-text-2, #6b7280);

}

.wallex-ac--card .wallex-ac__toggle {
	order: 4;
	margin-top: auto;
	padding-top: 16px;
	align-self: center;
	color: var(--color-primary, #2f6bff);
}

.wallex-ac--card .wallex-ac__toggle:hover,
.wallex-ac--card .wallex-ac__toggle:focus-visible {
	color: var(--color-primaryHover, #1d4fd7);
}

.wallex-ac__details-inner.wallex-ac--card {
	max-height: 150px;
	overflow: auto;
	padding-left: 5px;
}

/* Expanded card: switch the card to a grid so the image can shrink and sit
   beside the title (image + title on the top row, then the text, then the
   toggle at the bottom). Head is `display:contents`, so its children take part
   in this grid directly. */
.wallex-ac--card .wallex-ac__item.is-open {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-areas:
		"media title"
		"details details"
		"toggle toggle";
	column-gap: 12px;
	align-items: center;
}

.wallex-ac--card .wallex-ac__item.is-open .wallex-ac__media {
	grid-area: media;
	width: auto;
	min-height: 0;
	margin-bottom: 0;
}

.wallex-ac--card .wallex-ac__item.is-open .wallex-ac__img {
	max-width: 46px;
	max-height: 46px;
}

.wallex-ac--card .wallex-ac__item.is-open .wallex-ac__title {
	grid-area: title;
	justify-self: start;
	margin-bottom: 0;
	text-align: right;
}

.wallex-ac--card .wallex-ac__item.is-open .wallex-ac__details {
	grid-area: details;
	margin-top: 14px;
}

.wallex-ac--card .wallex-ac__item.is-open .wallex-ac__toggle {
	grid-area: toggle;
	justify-self: center;
}

/* Card CTA button stays full-width inside the card, on the light theme. */
.wallex-ac--card .wallex-ac__btn {
	width: 100%;
	background: transparent;
	color: var(--color-primary, #2f6bff);
	border-color: var(--color-stroke-2, rgba(20, 20, 43, 0.18));
}

.wallex-ac--card .wallex-ac__btn:hover,
.wallex-ac--card .wallex-ac__btn:focus-visible {
	background: var(--color-primary, #2f6bff);
	border-color: var(--color-primary, #2f6bff);
	color: #ffffff;
}

/* Card mode responsive: 2 columns on tablet, 1 on mobile. */
@media (max-width: 900px) {
	.wallex-ac--card .wallex-ac {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.wallex-ac--card .wallex-ac {
		grid-template-columns: minmax(0, 1fr);
	}
}