/**
 * Castos / SSP podcast player — Alavi RTL + gold branding.
 * Update-safe overrides only (never edit SSP core).
 */

.podcast_player,
.castos-player,
.podcast_meta,
.podcast-meta,
.ssp-subscribe-buttons {
	font-family: var(--alavi-font, "Vazirmatn", Tahoma, sans-serif) !important;
}

/* Brand tokens over SSP defaults */
.castos-player {
	--ssp-progress-bar-color: #c9a227;
	--ssp-play-btn-color: #c9a227;
	--alavi-podcast-accent: #c9a227;
	--alavi-podcast-radius: var(--alavi-radius, 12px);
	--alavi-podcast-gold-soft: rgba(201, 162, 39, 0.18);
	direction: rtl;
	text-align: right;
}

.castos-player .player,
.castos-player .player__body,
.castos-player .currently-playing,
.castos-player .episode-title,
.castos-player .player__podcast-title,
.castos-player .player-panels-nav button,
.castos-player .player-panel,
.castos-player .playlist__item__details {
	font-family: var(--alavi-font, "Vazirmatn", Tahoma, sans-serif) !important;
}

/* Rounded Alavi card */
.castos-player .player {
	border-radius: var(--alavi-podcast-radius);
	overflow: hidden;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
	border: 1px solid var(--alavi-podcast-gold-soft);
}

.castos-player .player-panels .player-panel {
	border-radius: var(--alavi-radius-sm, 8px) var(--alavi-radius-sm, 8px) 0 0;
}

/* Artwork on the RIGHT (RTL grid: first column → inline-start) */
.castos-player .player__main {
	direction: rtl;
}

.castos-player .player__artwork {
	border-radius: 0 var(--alavi-podcast-radius) var(--alavi-podcast-radius) 0;
	overflow: hidden;
}

.castos-player .player__artwork img {
	border-radius: 0;
}

.castos-player .player__body {
	/* Physical pad: left edge of body (screen-left) has breathing room */
	padding: 13px 0 10px 13px;
	text-align: right;
}

.castos-player .currently-playing .show,
.castos-player .episode-title {
	text-align: right;
}

/*
 * Play/pause on the LEFT of the control strip.
 * LTR grid keeps play in column 1 (screen-left); do not RTL-flip this row.
 */
.castos-player .play-progress {
	direction: ltr;
	unicode-bidi: isolate;
}

/* Seek math + fill grow left → right */
.castos-player .ssp-progress,
.castos-player .progress {
	direction: ltr;
	unicode-bidi: isolate;
}

.castos-player .progress__filled {
	margin-inline: 0;
	transform-origin: left center;
}

.castos-player .playback {
	direction: ltr;
	unicode-bidi: isolate;
	grid-template-columns: 1fr auto;
	justify-items: stretch;
}

.castos-player .playback__controls {
	direction: ltr;
	justify-content: start;
}

.castos-player .playback__timers {
	direction: ltr;
	unicode-bidi: isolate;
	letter-spacing: 0;
	justify-self: end;
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1;
}

/* Play triangle must face RIGHT — never mirror play/pause */
.castos-player .play-progress .play-pause-controls .play-btn,
.castos-player .play-progress .play-pause-controls .pause-btn {
	transform: none;
}

.castos-player .play-progress .play-pause-controls .play-btn:hover,
.castos-player .play-pause-controls .pause-btn:hover {
	transform: scale(1.08);
}

/* Only skip icons mirror so back/forward match LTR timeline */
.castos-player .player-btn__rwd,
.castos-player .player-btn__fwd {
	transform: scaleX(-1);
}

.castos-player .player-panels-nav {
	margin-left: 0;
	margin-right: 52px;
	text-align: right;
}

.castos-player .player-panels-nav button {
	text-transform: none;
	letter-spacing: 0;
}

.castos-player .player-panel-row {
	direction: rtl;
	text-align: right;
}

.castos-player .player-panel-row .title {
	text-align: right;
}

.castos-player .player-panel input,
.castos-player .player-panel textarea {
	direction: ltr;
	text-align: left;
	unicode-bidi: isolate;
	font-family: var(--alavi-font, "Vazirmatn", Tahoma, sans-serif) !important;
	border-radius: var(--alavi-radius-sm, 6px);
}

.castos-player .close-btn {
	right: auto;
	left: -7px;
}

.castos-player .subscribe-icons {
	direction: rtl;
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem 0.55rem;
	justify-content: flex-start;
}

.castos-player .subscribe-icons a {
	text-align: center;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.3rem 0.7rem;
	border-radius: 999px;
	border: 1px solid rgba(201, 162, 39, 0.4);
	background: rgba(201, 162, 39, 0.12);
	font-family: var(--alavi-font, "Vazirmatn", Tahoma, sans-serif) !important;
	font-size: 0.8125rem;
}

.castos-player .subscribe-icons a:hover {
	border-color: #c9a227;
	background: rgba(201, 162, 39, 0.22);
}

/* Iranian platforms — masks set via inline CSS from PHP */
.castos-player .subscribe-icons .shenoto span,
.castos-player .subscribe-icons .beshno span,
.castos-player .subscribe-icons .podcaster span,
.castos-player .subscribe-icons .namlik span,
.castos-player .subscribe-icons .custom_fa span {
	mask-size: contain;
	-webkit-mask-size: contain;
	background-color: #c9a227;
}

/* Front subscribe chips (listing + single) */
.alavi-podcast-subscribe {
	direction: rtl;
	margin: 0 0 1.35rem;
	font-family: var(--alavi-font, "Vazirmatn", Tahoma, sans-serif);
}

.alavi-podcast-subscribe__label {
	margin: 0 0 0.55rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: rgba(0, 0, 0, 0.55);
}

.alavi-podcast-subscribe__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem 0.55rem;
}

.alavi-podcast-subscribe__chip {
	display: inline-flex;
	align-items: center;
	padding: 0.35rem 0.85rem;
	border-radius: 999px;
	border: 1px solid rgba(201, 162, 39, 0.45);
	background: rgba(201, 162, 39, 0.1);
	color: inherit;
	text-decoration: none;
	font-size: 0.8125rem;
	line-height: 1.35;
	transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.alavi-podcast-subscribe__chip:hover {
	background: rgba(201, 162, 39, 0.22);
	border-color: #c9a227;
	transform: translateY(-1px);
}

.alavi-podcast-subscribe__chip--shenoto,
.alavi-podcast-subscribe__chip--castbox,
.alavi-podcast-subscribe__chip--beshno,
.alavi-podcast-subscribe__chip--podcaster,
.alavi-podcast-subscribe__chip--namlik {
	border-color: rgba(201, 162, 39, 0.55);
	font-weight: 600;
}

.alavi-single-podcast-article .alavi-podcast-subscribe {
	margin-top: 0.35rem;
}

.alavi-podcasts--page .alavi-podcast-subscribe {
	margin-inline: 0;
}

/* Playlist */
.castos-player .playlist__wrapper,
.castos-player .playlist__items,
.castos-player .playlist__item {
	direction: rtl;
	text-align: right;
}

.castos-player .playlist__item__details {
	text-align: right;
}

/* Episode meta under the player */
.podcast_meta,
.podcast-meta,
.entry-content .podcast_player + p,
.podcast_player ~ .podcast_meta {
	direction: rtl;
	text-align: right;
	font-family: var(--alavi-font, "Vazirmatn", Tahoma, sans-serif);
}

.podcast-meta-download,
.podcast-meta-new-window,
.podcast-meta-duration,
.podcast-meta-date,
.podcast-meta-itunes {
	font-family: var(--alavi-font, "Vazirmatn", Tahoma, sans-serif);
}

.podcast-meta-duration,
.podcast-meta-date {
	unicode-bidi: isolate;
}

.ssp-subscribe-buttons {
	direction: rtl;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.65rem;
	align-items: center;
	justify-content: flex-start;
}

.ssp-subscribe-buttons a {
	font-family: var(--alavi-font, "Vazirmatn", Tahoma, sans-serif);
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	border: 1px solid rgba(201, 162, 39, 0.45);
	background: rgba(201, 162, 39, 0.1);
	color: inherit;
	text-decoration: none;
	font-size: 0.875rem;
	line-height: 1.3;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.ssp-subscribe-buttons a:hover {
	background: rgba(201, 162, 39, 0.2);
	border-color: #c9a227;
}

.ssp-subscribe-buttons a img {
	width: 18px;
	height: 18px;
	object-fit: contain;
}

/* Soft gold accents */
.castos-player .play-progress .play-pause-controls .play-btn {
	background-color: var(--ssp-play-btn-color);
	box-shadow: 0 0 0 3px var(--alavi-podcast-gold-soft);
}

.castos-player .progress__filled {
	background-color: var(--ssp-progress-bar-color);
}

.castos-player .ssp-progress,
.castos-player .progress {
	background-color: rgba(201, 162, 39, 0.22);
}

.castos-player .player-btn__speed {
	font-family: var(--alavi-font, "Vazirmatn", Tahoma, sans-serif) !important;
}

/* Mobile: artwork still on right; pull play row toward artwork */
@media (max-width: 768px) {
	.castos-player .player__body {
		padding: 12px;
		text-align: right;
	}

	.castos-player .player__artwork img {
		border-radius: var(--alavi-radius-sm, 6px);
	}

	.castos-player .play-progress {
		margin-left: 0;
		margin-right: -60px;
	}

	.castos-player .player-panels-nav {
		margin-right: 0;
		margin-left: 0;
	}
}

.castos-player.light-mode {
	--ssp-progress-bar-color: #c9a227;
	--ssp-play-btn-color: #c9a227;
}

.castos-player.light-mode .player {
	border-color: rgba(201, 162, 39, 0.28);
}

html[dir="ltr"] .castos-player {
	direction: ltr;
}

html[dir="ltr"] .castos-player .player__main {
	direction: ltr;
}

html[dir="ltr"] .castos-player .player__artwork {
	border-radius: var(--alavi-podcast-radius) 0 0 var(--alavi-podcast-radius);
}

html[dir="ltr"] .castos-player .player-btn__rwd,
html[dir="ltr"] .castos-player .player-btn__fwd {
	transform: none;
}

html[dir="ltr"] .castos-player .play-progress {
	margin-right: 0;
}
