/**
 * Legacy Block Styles
 *
 * Styles for legacy blocks from RehUB/Greenshift themes.
 * Loaded only on posts with legacy content (meta _mca_legacy contains 'core').
 *
 * Extracted from assets/css/blocks.css
 *
 * @package MyChooz_Aesthetic
 * @version 0.0.1
 */

/* ==========================================================================
   LEGACY CAPTION [caption] / .wp-caption
   ========================================================================== */

.wp-caption {
	max-width: 100% !important;
}

.wp-caption img {
	width: 100%;
	height: auto;
}

.wp-caption-text {
	padding: 10px 16px;
	font-size: 13px;
	color: var(--mca-muted, #6b7280);
	text-align: center;
	border-top: 1px solid var(--mca-border, #e5e7eb);
}

/* Caption Card style for legacy captions with text */
.wp-caption {
	border-radius: 12px;
	overflow: hidden;
	background: #f9fafb;
	box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.wp-caption img {
	border-radius: 0;
}

/* Override inline width on mobile */
@media (max-width: 768px) {
	.wp-caption[style*="width"] {
		width: 100% !important;
	}
}

/* ==========================================================================
   LEGACY TABLES — .tabletrev, .tablet scroll wrappers
   ========================================================================== */

.tabletrev,
.tablet {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.tabletrev table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

/* Hide thead in legacy rating tables */
.tabletrev table thead {
	display: none;
}

.tabletrev table th {
	background: var(--mca-bg, #f7f8fa);
	font-weight: 600;
	text-align: left;
}

.tabletrev table th,
.tabletrev table td {
	padding: 6px 12px;
	border: 1px solid var(--mca-border, #e5e7eb);
	vertical-align: middle;
}

.tabletrev table tbody tr:hover {
	background: var(--mca-bg, #f7f8fa);
}

@media (max-width: 768px) {
	.tabletrev table {
		display: block;
		border: 1px solid var(--mca-border, #e5e7eb);
		border-radius: 8px;
		overflow: hidden;
	}

	.tabletrev table tbody {
		display: block;
	}

	.tabletrev table tr {
		display: grid;
		grid-template-columns: 2fr 1fr;
		grid-template-rows: auto auto;
		gap: 8px 12px;
		padding: 12px;
		border-bottom: 1px solid var(--mca-border, #e5e7eb);
		align-items: start;
	}

	.tabletrev table tr:last-child {
		border-bottom: none;
	}

	.tabletrev table td {
		border: none;
		padding: 0;
	}

	/* First cell: number + name + price - left column, row 1 */
	.tabletrev table td:first-child {
		grid-column: 1;
		grid-row: 1;
	}

	/* Description cell - left column, row 2 */
	.tabletrev table .table-descr,
	.tabletrev table .table-desсr {
		grid-column: 1;
		grid-row: 2;
		font-size: 14px;
		color: var(--mca-text, #1a1a1a);
	}

	/* Image cell - right column, spans 2 rows */
	.tabletrev table .table-img {
		grid-column: 2;
		grid-row: 1 / 3;
		text-align: center;
		display: flex;
		align-items: center;
		justify-content: center;
		width: auto;
		max-width: none;
	}

	.tabletrev table .table-img img {
		width: 100%;
		max-width: 100px;
		height: auto;
	}
}

/* Legacy rating tables — special elements (.cifri, .ceny, .table-img, .table-descr) */
.tabletrev table .cifri {
	color: var(--mca-text, #1a1a1a);
	font-weight: 700;
	margin-right: 8px;
}

.tabletrev table .ceny {
	color: var(--mca-primary, #e71d1d);
	font-weight: 700;
	margin-left: 8px;
}

.tabletrev table .table-img {
	width: 100px;
	max-width: 100px;
}

.tabletrev table .table-img img {
	width: 100%;
	height: auto;
	border-radius: 6px;
}

/* ==========================================================================
   LEGACY IFRAME (YouTube in <p> without wp-block-embed wrapper)
   ========================================================================== */

.single main p > iframe,
.single main > iframe {
	max-width: 100%;
	border-radius: 12px;
	aspect-ratio: 16 / 9;
	width: 100%;
	height: auto;
}

/* ==========================================================================
   CLASSIC GALLERY [gallery]
   ========================================================================== */

.gallery {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 1.5em;
	max-width: 100%;
}

.gallery .gallery-item {
	margin: 0;
	padding: 0;
	overflow: hidden;
	border-radius: 12px;
}

.gallery-columns-2 .gallery-item { width: calc(50% - 4px); }
.gallery-columns-3 .gallery-item { width: calc(33.33% - 6px); }
.gallery-columns-4 .gallery-item { width: calc(25% - 6px); }
.gallery-columns-5 .gallery-item { width: calc(20% - 7px); }
.gallery-columns-6 .gallery-item { width: calc(16.66% - 7px); }
.gallery-columns-7 .gallery-item { width: calc(14.28% - 7px); }
.gallery-columns-8 .gallery-item { width: calc(12.5% - 7px); }
.gallery-columns-9 .gallery-item { width: calc(11.11% - 7px); }

.gallery .gallery-icon img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 0;
}

.gallery-caption {
	font-size: 13px;
	color: var(--mca-muted, #6b7280);
	text-align: center;
	padding: 4px 0;
}

@media (max-width: 480px) {
	.gallery-columns-3 .gallery-item,
	.gallery-columns-4 .gallery-item { width: calc(50% - 4px); }
	.gallery-columns-5 .gallery-item { width: calc(20% - 7px); }
	.gallery-columns-6 .gallery-item,
	.gallery-columns-7 .gallery-item,
	.gallery-columns-8 .gallery-item,
	.gallery-columns-9 .gallery-item {
		width: calc(33.33% - 6px);
	}
}

/* ==========================================================================
   MODEL HEADINGS — .blockmodel, .cifry
   ========================================================================== */

.single main .blockmodel {
	font-size: 21px;
	font-weight: 700;
	margin: 32px 0 24px;
	text-align: center;
}

.single main .blockmodel .cifry {
	color: var(--mca-primary, #e71d1d);
	font-weight: 700;
	margin-right: 4px;
}

.single main .blockmodel .cifry::after {
	content: '.';
	margin-right: 0;
}

/* ==========================================================================
   GREENSHIFT ACCORDION — Outlined Chevron Circle
   ========================================================================== */

.gs-accordion-item {
	margin-bottom: 8px;
	border: 1px solid var(--mca-border, #e5e7eb);
	border-radius: 8px;
	overflow: hidden;
	background: var(--mca-surface, #fff);
}

.gs-accordion-item__title {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
	transition: background 0.15s ease;
	user-select: none;
}
.gs-accordion-item__title:hover { background: #f9fafb; }

.gs-accordion-item__heading {
	flex: 1;
}

.gs-accordion-item .iconfortoggle {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #f3f4f6;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, background 0.2s ease;
	position: relative;
}
.gs-accordion-item .iconfortoggle .gs-iconbefore,
.gs-accordion-item .iconfortoggle .gs-iconafter {
	position: absolute;
	background: var(--mca-muted, #6b7280);
	transition: background 0.2s ease, transform 0.2s ease;
}
.gs-accordion-item .iconfortoggle .gs-iconbefore {
	width: 10px;
	height: 2px;
}
.gs-accordion-item .iconfortoggle .gs-iconafter {
	width: 2px;
	height: 10px;
}

.gs-accordion-item:not(.gsclose) .iconfortoggle {
	background: var(--mca-primary, #e71d1d);
}
.gs-accordion-item:not(.gsclose) .iconfortoggle .gs-iconbefore,
.gs-accordion-item:not(.gsclose) .iconfortoggle .gs-iconafter {
	background: #fff;
}
.gs-accordion-item:not(.gsclose) .iconfortoggle .gs-iconafter {
	transform: rotate(90deg);
}

.gs-accordion-item__content {
	padding: 0 16px 16px;
	border-top: 1px solid var(--mca-border, #e5e7eb);
	padding-top: 16px;
}

.gs-accordion-item.gsclose .gs-accordion-item__content {
	display: none;
}

/* ==========================================================================
   LEGACY REHUB SLIDER — .mca-slider
   ========================================================================== */

.mca-slider {
	max-width: 100%;
	overflow: hidden;
}
.mca-slider__main {
	margin-bottom: 8px;
	text-align: center;
	background: var(--mca-bg, #f7f8fa);
	border-radius: 12px;
	padding: 16px;
}
.mca-slider__img {
	max-width: 100%;
	max-height: 280px;
	height: auto;
	display: inline-block;
	object-fit: contain;
}
.mca-slider__thumbs {
	display: flex;
	gap: 6px;
	justify-content: center;
	overflow-x: auto;
}
.mca-slider__thumb {
	width: 56px;
	height: 56px;
	min-width: 56px;
	object-fit: cover;
	border-radius: 6px;
	cursor: pointer;
	border: 2px solid var(--mca-border, #e5e7eb);
	opacity: 0.7;
	transition: opacity 0.15s ease, border-color 0.15s ease;
}
.mca-slider__thumb:hover,
.mca-slider__thumb--active {
	opacity: 1;
	border-color: var(--mca-primary, #e71d1d);
}

/* UP-block: hide dead nadavi column, center slider */
.wp-block-column:has(.nadavi-widget) {
	display: none;
}
.mca-slider {
	margin-inline: auto;
	max-width: 360px;
}

@media (max-width: 600px) {
	.mca-slider__main {
		padding: 8px;
	}
	.mca-slider__img {
		max-height: 200px;
	}
	.mca-slider__thumb {
		width: 44px;
		height: 44px;
		min-width: 44px;
	}
}
