/* Clásica — reproductor global (barra inferior).
 * Colores como variables: el tema puede sobreescribirlas sin tocar el plugin.
 * La tipografía se hereda del tema. */
:root {
	--cp-bg:      #1A120A;   /* igual que la navbar */
	--cp-text:    #ffffff;
	--cp-sub:     rgba(255, 255, 255, .55);
	--cp-line:    rgba(255, 255, 255, .14);
	--cp-accent:  var(--clpod-accent, #FF4500);
	--cp-live:    var(--clpod-teal, #2ec4b6);
	--cp-error:   var(--clpod-error, #ff6b5b);
	--cp-height:  76px;
	--cp-z:       99999;
}

/* Reserva espacio para que la barra no tape el pie de página. */
html.has-cp-bar body { padding-bottom: var(--cp-height); }

.cp-bar {
	position: fixed;
	left: 0; right: 0; bottom: 0;
	z-index: var(--cp-z);
	min-height: var(--cp-height);
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
	align-items: center;
	gap: 1.25rem;
	padding: .55rem 1.5rem;
	background: var(--cp-bg);
	color: var(--cp-text);
	border-top: 1px solid var(--cp-line);
	box-sizing: border-box;
}
.cp-bar[hidden] { display: none; }

/* Solo visible en modo podcast. */
.cp-bar[data-mode="live"] [data-podcast-only] { display: none !important; }

/* --- Izquierda: arte + textos --- */
.cp-left { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.cp-art { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.08); }
.cp-art[hidden] { display: none; }
.cp-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cp-live-dot {
	display: inline-block;
	width: 8px; height: 8px;
	border-radius: 50%;
	background: var(--cp-live);
	flex: 0 0 auto;
}
.cp-bar[data-mode="podcast"] .cp-left > .cp-live-dot { display: none; }
.cp-bar.is-playing[data-mode="live"] .cp-left > .cp-live-dot { animation: cp-pulse 1.8s ease-in-out infinite; }
@keyframes cp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.cp-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.cp-eyebrow {
	font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
	color: var(--cp-live);
}
.cp-title {
	font-size: 1rem; font-weight: 700; color: var(--cp-text);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cp-sub {
	font-size: .82rem; color: var(--cp-sub);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- Centro: controles + progreso --- */
.cp-center { display: flex; flex-direction: column; align-items: center; gap: .3rem; min-width: 0; }
.cp-controls { display: flex; align-items: center; gap: 1rem; }

.cp-bar button {
	appearance: none; border: 0; background: none; color: inherit;
	cursor: pointer; font: inherit; padding: 0 !important; margin: 0; box-shadow: none;
}

.cp-bar .cp-play {
	width: 48px; height: 48px; min-height: 48px;
	aspect-ratio: 1 / 1;
	border-radius: 50% !important;
	background: var(--cp-accent);
	color: #fff;
	display: inline-flex; align-items: center; justify-content: center;
}
.cp-bar .cp-play:hover { filter: brightness(1.08); }

/* Íconos según modo/estado: live → play/stop; podcast → play/pausa. */
.cp-play svg { display: none; }
.cp-bar:not(.is-playing) .cp-i-play { display: block; }
.cp-bar.is-playing[data-mode="live"] .cp-i-stop { display: block; }
.cp-bar.is-playing[data-mode="podcast"] .cp-i-pause { display: block; }

/* Conectando: spinner en el botón (sigue siendo pulsable para cancelar) y etiqueta en pulso. */
.cp-bar.is-loading .cp-play svg { display: none !important; }
.cp-bar.is-loading .cp-play::after {
	content: "";
	width: 20px; height: 20px;
	border-radius: 50%;
	border: 2.5px solid rgba(255, 255, 255, .35);
	border-top-color: #fff;
	box-sizing: border-box;
	animation: cp-spin .8s linear infinite;
}
.cp-bar.is-loading .cp-eyebrow { color: var(--cp-text); animation: cp-pulse 1.4s ease-in-out infinite; }
@keyframes cp-spin { to { transform: rotate(360deg); } }

/* Fallo de conexión: mensaje en la etiqueta y "Reintentar" en lugar del subtítulo. */
.cp-bar.is-error .cp-eyebrow { color: var(--cp-error); }
.cp-bar.is-error .cp-sub { display: none; }
.cp-bar .cp-retry {
	align-self: flex-start;
	font-size: .82rem; font-weight: 700; color: var(--cp-accent);
	text-decoration: underline; text-underline-offset: 2px;
}
.cp-bar .cp-retry:hover { color: var(--cp-text); }
.cp-bar .cp-retry[hidden] { display: none; }

/* Botones de episodio y de la radio mientras conectan. */
[data-clasica-play].is-loading,
.clasica-live-btn.is-loading { animation: cp-pulse 1.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
	.cp-bar.is-loading .cp-play::after { animation-duration: 2.4s; }
	.cp-bar.is-loading .cp-eyebrow,
	[data-clasica-play].is-loading,
	.clasica-live-btn.is-loading { animation: none; }
}

.cp-bar .cp-skip { font-size: .8rem; font-weight: 700; color: var(--cp-sub); min-width: 2.2rem; }
.cp-bar .cp-skip:hover { color: var(--cp-text); }

.cp-progress { display: flex; align-items: center; gap: .6rem; width: 100%; max-width: 520px; }
.cp-time { font-size: .75rem; color: var(--cp-sub); font-variant-numeric: tabular-nums; min-width: 2.6rem; text-align: center; }

.cp-bar input[type="range"] {
	appearance: none; -webkit-appearance: none;
	height: 4px; border-radius: 4px; background: var(--cp-line); outline-offset: 3px; margin: 0;
}
.cp-bar #cp-seek { flex: 1 1 auto; }
.cp-bar input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--cp-accent); cursor: pointer;
}
.cp-bar input[type="range"]::-moz-range-thumb {
	width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--cp-accent); cursor: pointer;
}

/* --- Derecha: en vivo, velocidad, volumen, minimizar --- */
.cp-right { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; }
.cp-bar .cp-go-live {
	display: inline-flex; align-items: center; gap: .45rem;
	font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--cp-live);
	white-space: nowrap;
}
.cp-bar .cp-rate { font-size: .85rem; font-weight: 700; color: var(--cp-sub); min-width: 2.4rem; }
.cp-bar .cp-rate:hover { color: var(--cp-text); }
.cp-volume { display: flex; align-items: center; gap: .45rem; color: var(--cp-sub); }
.cp-volume input { width: 100px; }
.cp-bar .cp-close { color: var(--cp-sub); display: inline-flex; }
.cp-bar .cp-close:hover { color: var(--cp-text); }

/* --- Mini botón (barra minimizada) --- */
.cp-mini {
	position: fixed; right: 1rem; bottom: 1rem; z-index: var(--cp-z);
	display: inline-flex; align-items: center; gap: .5rem;
	max-width: 260px; padding: .6rem 1rem !important;
	border: 0; border-radius: 999px !important;
	background: var(--cp-bg); color: var(--cp-text);
	font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
.cp-mini[hidden] { display: none; }
.cp-mini span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Botón "Escuchar en vivo" ([clasica_live_button] o data-clasica-live) --- */
.clasica-live-btn {
	display: inline-flex; align-items: center; gap: .5rem;
	padding: .65rem 1.2rem !important;
	border: 0; border-radius: 999px !important;
	background: var(--cp-accent); color: #fff;
	font: inherit; font-weight: 700; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase;
	cursor: pointer;
}
.clasica-live-btn .cp-live-dot { background: #fff; }
.clasica-live-btn.is-playing .cp-live-dot { animation: cp-pulse 1.8s ease-in-out infinite; }

/* --- Responsive (móvil): fila 1 = info + controles + cerrar; fila 2 = progreso --- */
@media (max-width: 900px) {
	.cp-bar { grid-template-columns: minmax(0, 1fr) auto auto; gap: .35rem .7rem; padding: .5rem .8rem; }
	.cp-center { display: contents; }
	.cp-left { grid-column: 1; grid-row: 1; }
	.cp-controls { grid-column: 2; grid-row: 1; gap: .6rem; }
	.cp-right { grid-column: 3; grid-row: 1; gap: .6rem; }
	.cp-progress { grid-column: 1 / -1; grid-row: 2; max-width: none; }
	.cp-volume, .cp-bar .cp-rate { display: none !important; }
	/* "Radio en vivo" queda como un punto compacto: siempre se puede volver a la radio. */
	.cp-bar .cp-go-live { font-size: 0; gap: 0; padding: .4rem !important; }
	.cp-bar .cp-go-live .cp-live-dot { width: 10px; height: 10px; }
	.cp-art { width: 42px; height: 42px; }
	.cp-sub { display: none; }
	.cp-bar .cp-play { width: 42px; height: 42px; min-height: 42px; }
	html.has-cp-bar body { padding-bottom: 110px; }
}
