/* ===== Variables ===== */
:root {
    --bg-deep: #0a0a0f;
    --glass: rgba(18, 18, 24, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text: #f5f5f7;
    --text-muted: rgba(245, 245, 247, 0.62);
    --accent: #e85d04;
    --accent-soft: #f48c06;
    --accent-glow: rgba(232, 93, 4, 0.45);
    --radius-lg: 20px;
    --radius-md: 14px;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    --font-display: "Crimson Pro", Georgia, serif;
    --font-ui: "DM Sans", "Segoe UI", sans-serif;
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-ui);
    font-size: 16px;
    color: var(--text);
    background: var(--bg-deep);
    line-height: 1.5;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: inherit;
    background-size: cover;
    background-position: center;
    filter: blur(40px) saturate(1.2) brightness(0.35);
    transform: scale(1.15);
    z-index: -2;
    transition: background-image 0.6s ease;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, rgba(10, 10, 15, 0.5) 0%, rgba(10, 10, 15, 0.92) 55%, #0a0a0f 100%);
    z-index: -1;
}

/* ===== App shell ===== */
.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1rem 2.5rem;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem 0;
}

.app-header__brand {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.01em;
}

.app-header__brand:hover {
    color: var(--accent-soft);
}

.app-header__badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(232, 93, 4, 0.15);
    color: var(--accent-soft);
    border: 1px solid rgba(232, 93, 4, 0.25);
}

/* ===== Layout ===== */
.app-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 900px) {
    .app-layout {
        grid-template-columns: minmax(320px, 420px) 1fr;
        align-items: start;
    }

    .player-panel {
        position: sticky;
        top: 1rem;
    }
}

.glass {
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* ===== Player ===== */
.player-panel {
    padding: 1.5rem;
    text-align: center;
}

.player-panel.playing .cover {
    transform: scale(1.02);
    box-shadow: 0 12px 40px var(--accent-glow);
}

.player-panel.playing .cover-glow {
    opacity: 1;
}

.player-panel__cover-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto 1rem;
}

.cover {
    display: block;
    width: min(100%, 280px);
    max-width: 280px;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: center center;
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    margin: 0 auto;
}

.cover-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 116%;
    height: 116%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: -1;
}

.now-playing {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-soft);
}

.titulo {
    margin: 0 0 1.25rem;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 3.5vw, 1.75rem);
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}

/* ===== Controls ===== */
.controles {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.btn {
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
    color: var(--text);
}

.btn:active {
    transform: scale(0.94);
}

.btn svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
}

.btn--icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.btn--icon:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn--like.is-liked {
    color: #ff3b5c;
    background: rgba(255, 59, 92, 0.2);
}

.btn--like.is-liked svg {
    fill: #ff3b5c;
}

.btn--download:hover {
    background: rgba(255, 255, 255, 0.16);
    color: var(--accent-soft);
}

.btn--play {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--accent-soft), var(--accent));
    box-shadow: 0 6px 24px var(--accent-glow);
}

.btn--play svg {
    width: 1.5rem;
    height: 1.5rem;
    margin-left: 2px;
}

.btn--play:hover {
    box-shadow: 0 8px 28px var(--accent-glow);
}

/* ===== Progress ===== */
.progreso {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.tiempo {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    min-width: 2.5rem;
}

.tiempo:last-child {
    text-align: right;
}

input[type="range"] {
    flex: 1;
    height: 5px;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15);
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--text);
}

/* ===== Lyrics ===== */
.letra-box {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 0.5rem;
    padding: 1rem 0.75rem;
    font-family: var(--font-display);
    font-size: 1.05rem;
    line-height: 1.75;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.letra-box div {
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    transition: color 0.3s ease, background 0.3s ease;
}

.letra-box div.activa {
    color: var(--text);
    background: rgba(232, 93, 4, 0.12);
    font-weight: 600;
}

.letra-box:empty::before {
    content: "Letra no disponible";
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-style: italic;
}

/* ===== Sidebar ===== */
.sidebar {
    min-width: 0;
}

.filtros {
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}

.filtros__label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.filtros select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.filtros select:focus {
    outline: 2px solid var(--accent-soft);
    outline-offset: 2px;
}

.filtros-select {
    position: relative;
}

.filtros-select__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.filtros-select__trigger:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(244, 140, 6, 0.35);
}

.filtros-select.is-open .filtros-select__trigger,
.filtros-select__trigger:focus-visible {
    outline: none;
    border-color: var(--accent-soft);
    box-shadow: 0 0 0 3px rgba(244, 140, 6, 0.2);
}

.filtros-select__chevron {
    width: 1.25rem;
    height: 1.25rem;
    fill: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.filtros-select.is-open .filtros-select__chevron {
    transform: rotate(180deg);
    fill: var(--accent-soft);
}

.filtros-select__menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    z-index: 30;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: #1a1a22;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    max-height: 240px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.filtros-select.is-open .filtros-select__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filtros-select__option {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.filtros-select__option:hover,
.filtros-select__option:focus {
    outline: none;
    background: rgba(244, 140, 6, 0.18);
    color: #fff;
}

.filtros-select__option.is-selected {
    background: rgba(232, 93, 4, 0.22);
    color: var(--accent-soft);
    font-weight: 600;
}

.filtros-select__option.is-selected:hover {
    background: rgba(232, 93, 4, 0.32);
    color: #fff;
}

.lista-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
}

.lista-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
}

.lista-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Playlist ===== */
.lista {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: min(70vh, 720px);
    overflow-y: auto;
    padding-right: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    cursor: pointer;
}

.item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.item.is-active {
    background: rgba(232, 93, 4, 0.1);
    border-color: rgba(232, 93, 4, 0.25);
}

.item__thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
}

.item__info {
    min-width: 0;
    text-align: left;
}

.item__titulo {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item__meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.item__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.item__btn {
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.item__btn:hover {
    background: rgba(232, 93, 4, 0.35);
}

.item__btn svg {
    width: 0.9rem;
    height: 0.9rem;
    fill: currentColor;
}

.lista-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

@media (max-width: 599px) {
    .app {
        padding: 0.75rem 0.75rem 2rem;
    }

    .player-panel {
        padding: 1.15rem;
    }

    .letra-box {
        max-height: 180px;
        font-size: 0.95rem;
    }

    .lista {
        max-height: none;
    }
}
