/**
 * WP Core Blocks Styles
 *
 * Overrides and fixes for WordPress core blocks.
 * Loaded on: single posts, pages, archives (where post content is rendered)
 *
 * Legacy block styles (tabletrev, wp-caption, gs-accordion, gallery, blockmodel,
 * slider) are in legacy/css/blocks.css — loaded conditionally per post.
 *
 * @package MyChooz_Aesthetic
 * @version 0.1.0
 */

/* WP image alignment */
img.alignright {
	float: right;
	margin: 0 0 16px 16px;
	width: auto;
	max-width: 150px;
	height: auto;
}
img.alignleft {
	float: left;
	margin: 0 16px 16px 0;
	width: auto;
	max-width: 150px;
	height: auto;
}
img.aligncenter {
	display: block;
	margin: 0 auto 16px;
}

/* ==========================================================================
   LIST BLOCK
   ========================================================================== */

/* All lists in post content — consistent style */
.single main ul,
.single main ol,
.wp-block-list,
ul.wp-block-list {
	padding-left: 1.5em;
	margin-left: 0;
	margin-top: 1em;
	margin-bottom: 1em;
	list-style-position: outside;
}

.single main ul li,
.single main ol li,
.wp-block-list li {
	margin-bottom: 0.3em;
	line-height: 1.5;
}

/* Sub-items separated by <br> inside list items */
.single main ol li br,
.single main ul li br {
	display: block;
	margin-bottom: 6px;
}

/* ==========================================================================
   IMAGES — Clean Minimal
   ========================================================================== */

.single main img {
	max-width: 100%;
	height: auto;
	border-radius: 12px;
}
.single main figure:not(.aligncenter) img,
.single main .wp-block-image:not(.aligncenter) img {
	width: 100%;
}

/* Centered images — no width override, HTML width attr takes effect */
.single main figure.wp-block-image.aligncenter {
	margin-left: auto;
	margin-right: auto;
}
.single main p > a > img {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

/* ==========================================================================
   IMAGES — Caption Card (auto when figcaption present)
   ========================================================================== */

.single main figure:has(figcaption) {
	border-radius: 12px;
	overflow: hidden;
	background: #f9fafb;
	box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.single main figure:has(figcaption) img {
	border-radius: 0;
}

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

/* WP block image with caption */
.wp-block-image figcaption {
	padding: 10px 16px;
	font-size: 13px;
	color: var(--mca-muted, #6b7280);
	text-align: center;
}

/* ==========================================================================
   AUDIO PLAYLIST — Compact Player
   ========================================================================== */

/* Playlist wrapper */
.wp-playlist {
	margin-bottom: 1.5em;
	background: var(--mca-bg, #f7f8fa);
	border: 1px solid var(--mca-border, #e5e7eb);
	border-radius: var(--mca-radius, 12px);
	padding: 16px;
	overflow: hidden;
}

/* Current item — compact inline */
.wp-playlist-current-item {
	display: flex;
	align-items: center;
	gap: 8px;
	height: auto;
	margin-bottom: 10px;
	overflow: visible;
}

.wp-playlist-current-item img {
	width: 20px;
	height: 20px;
	float: none;
	margin: 0;
	border-radius: 0;
}

.wp-playlist-caption {
	font-size: 13px;
}

.wp-playlist-item-title {
	font-size: 13px;
	font-weight: 500;
	color: var(--mca-text, #1a1a1a);
}

/* Hide prev/next nav */
.wp-playlist-next,
.wp-playlist-prev {
	display: none;
}

/* MediaElement.js controls bar — rounded */
.wp-playlist .mejs-container {
	border-radius: 8px !important;
	overflow: hidden;
}

/* Softer progress bar */
.mejs-time-total.mejs-time-slider,
span.mejs-time-total,
span.mejs-time-loaded,
span.mejs-time-current,
span.mejs-time-hovered {
	border-radius: 4px !important;
}

/* Hide volume on mobile — save space */
@media (max-width: 480px) {
	.wp-playlist .mejs-volume-button,
	.wp-playlist .mejs-horizontal-volume-slider {
		display: none !important;
	}
}

/* ---- Standalone audio (wp-audio-shortcode) ---- */
.single main .wp-audio-shortcode.mejs-container {
	border-radius: 8px !important;
	overflow: hidden;
}

.single main .wp-audio-shortcode .mejs-time-total,
.single main .wp-audio-shortcode .mejs-time-loaded,
.single main .wp-audio-shortcode .mejs-time-current,
.single main .wp-audio-shortcode .mejs-time-hovered {
	border-radius: 4px !important;
}

@media (max-width: 480px) {
	.single main .wp-audio-shortcode .mejs-volume-button,
	.single main .wp-audio-shortcode .mejs-horizontal-volume-slider {
		display: none !important;
	}
}

/* Playlist tracks */
.wp-playlist-tracks {
	border-top: 1px solid var(--mca-border, #e5e7eb);
}

.wp-playlist-tracks .wp-playlist-item {
	display: flex;
	align-items: center;
	padding: 8px 16px;
	font-size: 13px;
	color: var(--mca-muted, #6b7280);
	cursor: pointer;
	transition: background 0.15s ease;
}

.wp-playlist-tracks .wp-playlist-item:hover {
	background: var(--mca-surface, #ffffff);
}

.wp-playlist-tracks .wp-playlist-item.wp-playlist-playing {
	color: var(--mca-text, #1a1a1a);
	font-weight: 500;
}

.wp-playlist-tracks .wp-playlist-caption {
	flex: 1;
	text-decoration: none;
	color: inherit;
}

.wp-playlist-tracks .wp-playlist-item-length {
	font-size: 12px;
	color: var(--mca-muted, #6b7280);
	font-variant-numeric: tabular-nums;
	flex-shrink: 0;
	margin-left: auto;
}

/* ==========================================================================
   TABLES — WP Block Table (current)
   ========================================================================== */

/* Scrollable wrapper for wide tables */
.single main .wp-block-table {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.single main table:not(.rating-table) {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

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

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

.single main table:not(.rating-table) tbody tr:hover {
	background: var(--mca-bg, #f7f8fa);
}

@media (max-width: 768px) {
	/* Transform table into grid cards on mobile (NOT rating-table) */
	.single main table:not(.rating-table) {
		display: block;
		border: 1px solid var(--mca-border, #e5e7eb);
		border-radius: 8px;
		overflow: hidden;
	}

	.single main table:not(.rating-table) tbody {
		display: block;
	}

	.single main table:not(.rating-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;
	}

	.single main table:not(.rating-table) tr:last-child {
		border-bottom: none;
	}

	.single main table:not(.rating-table) td {
		border: none;
		padding: 0;
	}

	/* First cell: number + name + price - left column, row 1 */
	.single main table:not(.rating-table) td:first-child {
		grid-column: 1;
		grid-row: 1;
	}

	/* Description cell - left column, row 2 */
	.single main table:not(.rating-table) .table-descr,
	.single main table:not(.rating-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 */
	.single main table:not(.rating-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;
	}

	.single main table:not(.rating-table) .table-img img {
		width: 100%;
		max-width: 100px;
		height: auto;
	}
}

/* Rating tables — special elements */
.single main table:not(.rating-table) .cifri {
	color: var(--mca-text, #1a1a1a);
	font-weight: 700;
	margin-right: 8px;
}

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

.single main table:not(.rating-table) .table-img {
	width: 100px;
	max-width: 100px;
}

.single main table:not(.rating-table) .table-img img {
	width: 100%;
	height: auto;
	border-radius: 6px;
}

/* ==========================================================================
   EMBEDS (YouTube, etc.) — Clean Minimal
   ========================================================================== */

.wp-block-embed .wp-block-embed__wrapper {
	border-radius: 12px;
	overflow: hidden;
}

.wp-block-embed .wp-block-embed__wrapper iframe {
	width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	display: block;
}

/* ==========================================================================
   BLOCKQUOTE — Quotation Marks
   ========================================================================== */

.single main blockquote {
	position: relative;
	margin: 0 0 1.5em;
	padding: 24px 20px 24px 48px;
	font-style: italic;
	color: var(--mca-text, #1a1a1a);
	border: none;
}

.single main blockquote::before {
	content: '\201C';
	position: absolute;
	left: 8px;
	top: 8px;
	font-size: 48px;
	line-height: 1;
	color: var(--mca-border, #e5e7eb);
	font-family: Georgia, serif;
}

.single main blockquote p {
	margin: 0;
}

/* ==========================================================================
   HEADINGS — Clean Minimal
   ========================================================================== */

.single main h1 {
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
	margin: 0 0 24px;
}

@media (max-width: 768px) {
	.single main h1 { font-size: 24px; }
}

.single main h2 {
	font-size: 21px;
	font-weight: 700;
	line-height: 1.3;
	margin: 2em 0 0.75em;
}

.single main h3 {
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
	margin: 1.5em 0 0.5em;
}

.single main h4 {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	margin: 1.25em 0 0.5em;
}

.single main h5 {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	margin: 1em 0 0.5em;
}

.single main h6 {
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
	margin: 1em 0 0.5em;
	color: var(--mca-muted, #6b7280);
}
