@keyframes pulse {
    0% {
        transform: scale(0.9) rotate(-15deg);
    }

    25% {
        transform: scale(1.1) rotate(0deg);
    }

    50% {
        transform: scale(0.9) rotate(15deg);
    }

    75% {
        transform: scale(1.1) rotate(0deg);
    }

    100% {
        transform: scale(0.9) rotate(-15deg);
    }
}

.animate {
    animation: pulse 1s infinite;
}

/* Layout */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.page-content {
    flex: 1;
    min-height: 0;
    /* Only a fallback: pages scroll inside their own .page-scroll area (see .page below) */
    overflow-y: auto;
    padding: 24px;
}

/* Page layout: a page never scrolls as a whole. It fills .page-content, its header (search, filters,
   title) stays in place, and only the .page-scroll area below it scrolls. */
.page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.page-header {
    flex-shrink: 0;
}

.page-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* A MudTable that fills the rest of a .page: toolbar and pager stay, only the rows scroll
   (use with FixedHeader="true" so the column titles stay too) */
.page-table {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.page-table > * {
    flex-shrink: 0;
}

.page-table > .mud-table-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* Menu button for the side menu, which is an overlay below MudBlazor's md breakpoint (960px) */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-bottom: 1px solid #2A2A2A;
    flex-shrink: 0;
}

@media (max-width: 959.98px) {
    .mobile-topbar {
        display: flex;
    }
}

/* Player Bar */
.player-bar {
    display: flex;
    align-items: center;
    height: 72px;
    min-height: 72px;
    background: #121212;
    border-top: 1px solid #2A2A2A;
    padding: 0 24px;
    gap: 20px;
    width: 100%;
    z-index: 1100;
}

.player-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 260px;
    flex-shrink: 0;
    overflow: hidden;
}

.player-bar-track-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.player-bar-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-width: 0;
    max-width: 720px;
    margin: 0 auto;
}

.player-bar-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.player-bar-progress {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Compact MudBlazor buttons in player controls */
.player-bar-controls .mud-icon-btn {
    padding: 4px;
}

/* Compact MudSlider in progress bar */
.player-bar-progress .mud-slider {
    margin-top: 0;
    margin-bottom: 0;
}

.player-bar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 160px;
}

/* Sidebar */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 32px 24px;
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #E0E0E0;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    padding: 0 8px;
}

/* Sidebar nav styling */
.sidebar-nav .mud-nav-link {
    color: #B0B0B0;
    border-radius: 8px;
    margin-bottom: 2px;
}

.sidebar-nav .mud-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-nav .mud-nav-link.active {
    color: #E0E0E0;
    background-color: rgba(196, 90, 60, 0.1);
}

.sidebar-nav .mud-nav-link.active .mud-nav-link-icon {
    color: #C45A3C;
}

.sidebar-nav .mud-nav-group .mud-nav-link {
    color: #757575;
    font-size: 0.85rem;
}

.sidebar-nav .mud-nav-group .mud-nav-link.active {
    color: #E0E0E0;
    background-color: rgba(196, 90, 60, 0.1);
}

/* Remove default MudBlazor appbar offset since we have no app bar */
.mud-drawer {
    top: 0 !important;
}

.mud-layout {
    height: 100%;
}

.mud-main-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Index Page */
.idx-topbar {
    display: flex;
    padding: 24px 40px 20px 40px;
}

.idx-search {
    display: flex;
    align-items: center;
    max-width: 480px;
    width: 100%;
    background: #2A2A2A;
    border-radius: 10px;
    padding: 4px 16px;
}

.idx-search .mud-input-underline::before,
.idx-search .mud-input-underline::after {
    display: none !important;
}

.idx-search .mud-input {
    color: #E0E0E0;
    font-size: 14px;
}

.idx-search .mud-input-adornment {
    color: #757575;
}

.idx-search .mud-input-slot {
    background: transparent !important;
}

.idx-pills {
    display: flex;
    padding: 0 40px 20px 40px;
    gap: 8px;
}

.idx-pill {
    background: transparent;
    border: 1px solid #424242;
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 13px;
    font-family: inherit;
    color: #9E9E9E;
    cursor: pointer;
    transition: all 0.15s ease;
}

.idx-pill:hover {
    color: #E0E0E0;
    border-color: #616161;
}

.idx-pill--active {
    background: #C45A3C;
    color: #FFFFFF;
    border-color: #C45A3C;
}

.idx-pill--active:hover {
    background: #B55035;
    color: #FFFFFF;
    border-color: #B55035;
}

/* Track List */
.track-list {
    display: flex;
    flex-direction: column;
    padding: 0 40px 80px 40px;
}

/* Header and rows share the columns: #, title, album, time. Title and album split the width
   (minmax(0, ...) lets them shrink below their content, so long text ends in an ellipsis) */
.track-header,
.track-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 6fr) minmax(0, 4fr) 70px;
}

.track-list--no-album .track-header,
.track-list--no-album .track-row {
    grid-template-columns: 40px minmax(0, 1fr) 70px;
}

.track-header {
    /* Column titles stay visible while the rows scroll */
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--mud-palette-background);
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #2A2A2A;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    color: #757575;
    letter-spacing: 0.08em;
    gap: 16px;
}

.track-row {
    align-items: center;
    border-radius: 8px;
    padding: 10px 12px;
    gap: 16px;
    cursor: pointer;
    min-height: 60px;
    transition: background 0.1s ease;
}

.track-row:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

.track-row--playing {
    background: rgba(25, 118, 210, 0.06);
}

.track-row--loading {
    cursor: default;
}

.track-row--loading:hover {
    background: transparent !important;
}

.track-row--alt {
    background: rgba(255, 255, 255, 0.04);
}

.track-num {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #757575;
    font-size: 14px;
}

.track-play-icon {
    display: none;
}

.track-row:hover .track-num-text {
    display: none;
}

.track-row:hover .track-play-icon {
    display: block;
    color: #E0E0E0;
}

.track-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
}

.track-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
    object-fit: cover;
}

.track-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 2px;
}

.track-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.track-title {
    font-size: 14px;
    font-weight: 500;
    color: #E0E0E0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-badge {
    font-size: 10px;
    text-transform: uppercase;
    border: 1px solid #424242;
    border-radius: 4px;
    padding: 1px 4px;
    color: #757575;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}

.track-star {
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.track-download {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.track-download .mud-icon-btn {
    padding: 2px;
}

.track-artist-row {
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
}

.track-artist {
    font-size: 12px;
    color: #9E9E9E;
    cursor: pointer;
    white-space: nowrap;
}

.track-artist:hover {
    color: #E0E0E0;
    text-decoration: underline;
}

.track-artist-sep {
    font-size: 12px;
    color: #9E9E9E;
    margin-right: 2px;
}

.track-album {
    /* Only as wide as the text, so the rest of the cell still plays the track */
    justify-self: start;
    max-width: 100%;
    font-size: 13px;
    color: #9E9E9E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.track-album:hover {
    color: #E0E0E0;
    text-decoration: underline;
}

.track-duration {
    font-size: 13px;
    color: #9E9E9E;
    text-align: right;
}

/* Album Grid */
.idx-album-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    padding: 8px 40px 80px 40px;
}

.idx-album-card {
    width: 190px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
}

.idx-album-card:hover .idx-album-title {
    color: #FFFFFF;
}

.idx-album-art {
    width: 190px;
    height: 190px;
    border-radius: 8px;
    object-fit: cover;
}

.idx-album-title {
    font-size: 14px;
    font-weight: 500;
    color: #E0E0E0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.idx-album-artist {
    font-size: 12px;
    color: #9E9E9E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Artist Grid */
.idx-artist-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    padding: 8px 40px 80px 40px;
}

.idx-artist-card {
    width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.idx-artist-card:hover .idx-artist-name {
    color: #FFFFFF;
}

.idx-artist-art {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
}

.idx-artist-name {
    font-size: 14px;
    font-weight: 500;
    color: #E0E0E0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
