/* ═══════════════════════════════════════════════════════════════
   RWA Top Musical (Music Chart) – Styles
   Inspired by Apple Music / Spotify chart layout
   ═══════════════════════════════════════════════════════════════ */

/* ── Foundation ── */
.elementor-widget-rwa_top_musical,
.elementor-widget-rwa_top_musical .elementor-widget-container {
	width: 100% !important;
}

/* ── Section ── */
.rwa-top-musical-section {
	width: 100%;
}

/* ── Header (título con flecha estilo Apple Music) ── */
.rwa-top-musical__header {
	margin-bottom: 28px;
}

.rwa-top-musical__title {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 26px;
	font-weight: 700;
	color: #fff;
	margin: 0;
	letter-spacing: 0.2px;
	cursor: default;
}

.rwa-top-musical__title-arrow {
	opacity: .5;
	transition: opacity .3s, transform .3s;
}

.rwa-top-musical__title:hover .rwa-top-musical__title-arrow {
	opacity: 1;
	transform: translateX(3px);
}

/* ── Grid ── */
.rwa-top-musical {
	--rwa-top-cols: 5;
	display: grid;
	grid-template-columns: repeat(var(--rwa-top-cols), 1fr);
	gap: 28px 24px;
	width: 100%;
}

/* ── Song Item ── */
.rwa-top-song {
	display: flex;
	flex-direction: column;
}

.rwa-top-song__link {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	gap: 10px;
}

a.rwa-top-song__link:hover .rwa-top-song__cover img {
	transform: scale(1.04);
}

a.rwa-top-song__link:hover .rwa-top-song__name {
	color: var(--rwa-accent, #00f5d4);
}

/* ── Cover ── */
.rwa-top-song__cover {
	position: relative;
	width: 100%;
	padding-top: 100%; /* 1:1 */
	border-radius: 10px;
	overflow: hidden;
	background: rgba(255, 255, 255, 0.04);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.rwa-top-song__cover img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .4s ease;
}

.rwa-top-song__cover-placeholder {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.03);
	color: rgba(255, 255, 255, 0.25);
}

/* ── Meta row (position + info + movement) ── */
.rwa-top-song__meta {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding-top: 4px;
}

/* ── Position number (big, bold) ── */
.rwa-top-song__position {
	font-size: 38px;
	font-weight: 800;
	line-height: 1;
	color: rgba(255, 255, 255, 0.85);
	min-width: 30px;
	font-variant-numeric: tabular-nums;
	letter-spacing: -1px;
	flex-shrink: 0;
	padding-top: 2px;
}

/* ── Song info ── */
.rwa-top-song__info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
	padding-top: 6px;
}

.rwa-top-song__name {
	font-size: 14px;
	font-weight: 700;
	color: #fff;
	line-height: 1.3;
	transition: color .3s;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.rwa-top-song__artist {
	font-size: 13px;
	color: rgba(255, 255, 255, 0.5);
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ── Movement indicator ── */
.rwa-top-song__movement {
	display: flex;
	align-items: center;
	gap: 2px;
	font-size: 11px;
	font-weight: 700;
	flex-shrink: 0;
	padding-top: 8px;
}

.rwa-top-song__movement--up {
	color: #34c759;
}

.rwa-top-song__movement--down {
	color: #ff3b30;
}

.rwa-top-song__movement--same {
	color: rgba(255, 255, 255, 0.25);
}

.rwa-top-song__movement--new {
	color: #007aff;
}

.rwa-top-song__badge-new {
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	background: #007aff;
	color: #fff;
	padding: 2px 6px;
	border-radius: 3px;
	line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
	.rwa-top-musical {
		--rwa-top-cols: 4 !important;
	}
}

@media (max-width: 1024px) {
	.rwa-top-musical {
		--rwa-top-cols: 3 !important;
	}
}

@media (max-width: 768px) {
	.rwa-top-musical {
		--rwa-top-cols: 2 !important;
		gap: 20px 16px;
	}
	.rwa-top-song__position {
		font-size: 30px;
	}
	.rwa-top-song__name {
		font-size: 13px;
	}
}

@media (max-width: 480px) {
	.rwa-top-musical {
		--rwa-top-cols: 2 !important;
		gap: 16px 12px;
	}
	.rwa-top-song__position {
		font-size: 26px;
	}
	.rwa-top-song__artist {
		font-size: 11px;
	}
}

/* ═══════════════════════════════════════════════════════════════
   TABLE / LIST LAYOUT  (El Ranking Mix style)
   ═══════════════════════════════════════════════════════════════ */

/* ── Banner ── */
.rwa-top-table__banner {
	position: relative;
	width: 100%;
	border-radius: 14px 14px 0 0;
	overflow: hidden;
	aspect-ratio: 16 / 6;
	max-height: 280px;
	background: #111;
}

.rwa-top-table__banner img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rwa-top-table__banner-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.15) 100%);
	padding: 24px;
}

.rwa-top-table__banner-title {
	font-size: clamp(28px, 5vw, 56px);
	font-weight: 900;
	color: #fff;
	text-align: center;
	margin: 0;
	text-shadow: 0 2px 20px rgba(0,0,0,0.5);
	letter-spacing: -0.5px;
}

/* ── Toolbar (sort icon) ── */
.rwa-top-table__toolbar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px 4px;
	color: rgba(255,255,255,0.4);
}

.rwa-top-table__sort-icon {
	opacity: 0.5;
	cursor: pointer;
	transition: opacity .2s;
}

.rwa-top-table__sort-icon:hover {
	opacity: 1;
}

/* ── Column Headers ── */
.rwa-top-table__head {
	display: grid;
	grid-template-columns: 48px 1fr 1fr 60px;
	align-items: center;
	padding: 8px 16px;
	border-bottom: 1px solid rgba(255,255,255,0.08);
	color: rgba(255,255,255,0.45);
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.rwa-top-table__th--num {
	text-align: center;
}

.rwa-top-table__th--move {
	text-align: center;
	display: flex;
	justify-content: center;
}

/* ── Rows ── */
.rwa-top-table__body {
	display: flex;
	flex-direction: column;
}

.rwa-top-table__row {
	display: grid;
	grid-template-columns: 48px 1fr 1fr 60px;
	align-items: center;
	padding: 10px 16px;
	gap: 0 12px;
	border-bottom: 1px solid rgba(255,255,255,0.05);
	text-decoration: none;
	color: inherit;
	transition: background .2s;
	min-height: 56px;
}

a.rwa-top-table__row:hover {
	background: rgba(255,255,255,0.04);
	text-decoration: none;
	color: inherit;
}

a.rwa-top-table__row:hover .rwa-top-table__song-name {
	color: var(--rwa-accent, #00f5d4);
}

/* ── Position Number ── */
.rwa-top-table__cell--num {
	font-size: 17px;
	font-weight: 700;
	color: rgba(255,255,255,0.8);
	text-align: center;
	font-variant-numeric: tabular-nums;
}

/* ── Title cell (thumb + name) ── */
.rwa-top-table__cell--title {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.rwa-top-table__thumb {
	width: 44px;
	height: 44px;
	border-radius: 6px;
	overflow: hidden;
	flex-shrink: 0;
	background: rgba(255,255,255,0.04);
}

.rwa-top-table__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rwa-top-table__thumb-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255,255,255,0.03);
	color: rgba(255,255,255,0.2);
}

.rwa-top-table__song-name {
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color .25s;
}

/* ── Artist cell ── */
.rwa-top-table__cell--artist {
	font-size: 14px;
	color: rgba(255,255,255,0.5);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Movement cell ── */
.rwa-top-table__cell--move {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	font-size: 12px;
	font-weight: 700;
}

/* Reuse the movement color classes */
.rwa-top-table__cell--move.rwa-top-song__movement--up    { color: #34c759; }
.rwa-top-table__cell--move.rwa-top-song__movement--down  { color: #ff3b30; }
.rwa-top-table__cell--move.rwa-top-song__movement--same  { color: rgba(255,255,255,0.2); }
.rwa-top-table__cell--move.rwa-top-song__movement--new   { color: #007aff; }

/* ── Hide columns grid when no position / no artist etc ── */
.rwa-top-table__head:not(:has(.rwa-top-table__th--num)),
.rwa-top-table__row:not(:has(.rwa-top-table__cell--num)) {
	grid-template-columns: 1fr 1fr 60px;
}

/* ── Global section wrapper for table ── */
.rwa-top-musical-section--table {
	background: rgba(10, 10, 20, 0.5);
	border-radius: 14px;
	border: 1px solid rgba(255,255,255,0.06);
	overflow: hidden;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

/* ═══════════════════════════════════════════════════════════════
   TABLE RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
	.rwa-top-table__head {
		grid-template-columns: 36px 1fr 60px;
	}
	.rwa-top-table__th--artist {
		display: none;
	}
	.rwa-top-table__row {
		grid-template-columns: 36px 1fr 60px;
	}
	.rwa-top-table__cell--artist {
		display: none;
	}
	.rwa-top-table__cell--num {
		font-size: 15px;
	}
	.rwa-top-table__song-name {
		font-size: 13px;
	}
	.rwa-top-table__thumb {
		width: 38px;
		height: 38px;
	}
}

@media (max-width: 480px) {
	.rwa-top-table__row {
		padding: 8px 12px;
		min-height: 48px;
	}
	.rwa-top-table__head {
		padding: 6px 12px;
	}
	.rwa-top-table__thumb {
		width: 34px;
		height: 34px;
		border-radius: 4px;
	}
	.rwa-top-table__banner {
		aspect-ratio: 16 / 7;
	}
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE — GRID
   ═══════════════════════════════════════════════════════════════ */

body.rwa-light-mode .rwa-top-musical__title {
	color: #1a1a2e;
}

body.rwa-light-mode .rwa-top-song__cover {
	background: #f0f0f4;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

body.rwa-light-mode .rwa-top-song__position {
	color: rgba(0, 0, 0, 0.75);
}

body.rwa-light-mode .rwa-top-song__name {
	color: #1a1a2e;
}

body.rwa-light-mode a.rwa-top-song__link:hover .rwa-top-song__name {
	color: #0073aa;
}

body.rwa-light-mode .rwa-top-song__artist {
	color: rgba(0, 0, 0, 0.5);
}

body.rwa-light-mode .rwa-top-song__cover-placeholder {
	background: #f0f0f4;
	color: rgba(0, 0, 0, 0.2);
}

body.rwa-light-mode .rwa-top-song__movement--same {
	color: rgba(0, 0, 0, 0.2);
}

body.rwa-light-mode .rwa-top-song__movement--up {
	color: #28a745;
}

body.rwa-light-mode .rwa-top-song__movement--down {
	color: #dc3545;
}

body.rwa-light-mode .rwa-top-musical__title-arrow {
	color: #1a1a2e;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE — TABLE
   ═══════════════════════════════════════════════════════════════ */

body.rwa-light-mode .rwa-top-musical-section--table {
	background: rgba(255, 255, 255, 0.85);
	border-color: rgba(0, 0, 0, 0.08);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

body.rwa-light-mode .rwa-top-table__toolbar {
	color: rgba(0, 0, 0, 0.35);
}

body.rwa-light-mode .rwa-top-table__head {
	color: rgba(0, 0, 0, 0.45);
	border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.rwa-light-mode .rwa-top-table__row {
	border-bottom-color: rgba(0, 0, 0, 0.05);
}

body.rwa-light-mode a.rwa-top-table__row:hover {
	background: rgba(0, 0, 0, 0.03);
}

body.rwa-light-mode .rwa-top-table__cell--num {
	color: rgba(0, 0, 0, 0.7);
}

body.rwa-light-mode .rwa-top-table__song-name {
	color: #1a1a2e;
}

body.rwa-light-mode a.rwa-top-table__row:hover .rwa-top-table__song-name {
	color: #0073aa;
}

body.rwa-light-mode .rwa-top-table__cell--artist {
	color: rgba(0, 0, 0, 0.5);
}

body.rwa-light-mode .rwa-top-table__thumb {
	background: #f0f0f4;
}

body.rwa-light-mode .rwa-top-table__thumb-placeholder {
	background: #f0f0f4;
	color: rgba(0, 0, 0, 0.2);
}

body.rwa-light-mode .rwa-top-table__cell--move.rwa-top-song__movement--same {
	color: rgba(0, 0, 0, 0.2);
}

body.rwa-light-mode .rwa-top-table__cell--move.rwa-top-song__movement--up {
	color: #28a745;
}

body.rwa-light-mode .rwa-top-table__cell--move.rwa-top-song__movement--down {
	color: #dc3545;
}
