/* ArtistView — full-page artist profile (av- prefix) */

.av-page {
    position: fixed;
    inset: 0;
    /* Below the content-page overlay (z 60), the persistent bottom
       bars (z 70), and the full audio player (z 80). Tapping a song
       on the artist page can open content above; the bar/tab-bar stay
       visible at the bottom over this surface. */
    z-index: 50;
    display: flex;
    flex-direction: column;
    background: var(--ctrl-bg, #0a0a0a);
    color: var(--ctrl-text, #e5e5e5);
    font-family: 'Inter', -apple-system, sans-serif;
    overflow: hidden;
}

/* ---- Hero Header ---- */
.av-hero {
    position: relative;
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex-shrink: 0;
}

.av-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10,10,10,0.8) 0%, transparent 60%);
    pointer-events: none;
}

.av-header-back {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.35);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.av-share-btn {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.35);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.av-hero-content {
    position: relative;
    z-index: 1;
}

.av-hero-icon {
    font-size: 1.5rem;
    opacity: 0.7;
    margin-bottom: 6px;
}

.av-hero-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    font-family: 'Lora', Georgia, serif;
}

.av-hero-stats {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* ---- Action Bar ---- */
.av-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    flex-shrink: 0;
}

.av-action-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    color: var(--ctrl-text, #e5e5e5);
    -webkit-tap-highlight-color: transparent;
}

.av-action-btn:active {
    background: rgba(255,255,255,0.15);
}

.av-play-all {
    background: var(--ctrl-accent, #4a9eff);
    color: #fff;
}

.av-play-all:active {
    background: #3a8eef;
}

/* ---- Scrollable content area ---- */
.av-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Leave room for the persistent now-playing bar + tab bar
       (z 70, fixed at the bottom of the viewport). */
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}

/* ---- Track List ---- */
.av-list {
    /* Inner list — scroll is on parent .av-scroll */
}

.av-track {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    width: 100%;
    background: none;
    border: none;
    color: var(--ctrl-text, #e5e5e5);
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.av-track:active {
    background: rgba(255,255,255,0.06);
}

.av-track-art {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
    opacity: 0.5;
    overflow: hidden;
}

.av-track-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
}

.av-track-art:has(img) {
    opacity: 1;
    background: none;
}

.av-track-info {
    flex: 1;
    min-width: 0;
}

.av-track-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.av-track-meta {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.av-track-type {
    text-transform: capitalize;
}

.av-track-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(74, 158, 255, 0.15);
    color: var(--ctrl-accent, #4a9eff);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sv-track-num {
    width: 24px;
    font-size: 0.8rem;
    opacity: 0.4;
    text-align: center;
    flex-shrink: 0;
}

/* Session row layout — tap area on the left, action buttons (remove,
   move up/down) on the right. The tap area uses the existing .av-track
   styles; we just relax its width:100% via .sv-row-tap. */
.sv-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sv-row > .av-track.sv-row-tap {
    flex: 1;
    width: auto;
    border-bottom: none;
}

.sv-row-remove {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.9rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sv-row-remove:hover,
.sv-row-remove:active {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
}

/* Up / down reorder buttons. Stacked vertically in a single 28px column
   so they don't dominate the row — visible but understated. */
.sv-row-move {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 32px;
}

.sv-row-move-btn {
    flex: 1;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.65rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.sv-row-move-btn:hover:not(:disabled),
.sv-row-move-btn:active:not(:disabled) {
    color: var(--ctrl-accent, #4a9eff);
    background: rgba(74, 158, 255, 0.08);
}

.sv-row-move-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Bottom-sheet menu for playlist-level actions (share / rename / delete / etc.).
   The header's single ⋮ button (.av-share-btn) opens this; Share is always
   present in the menu, owner-only items are gated server-side via isOwner. */
.sv-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.sv-menu {
    width: 100%;
    max-width: 420px;
    background: var(--ctrl-surface, #141414);
    border-top: 1px solid var(--ctrl-border, #2a2a2a);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    animation: sv-menu-rise 0.15s ease-out;
}

@keyframes sv-menu-rise {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.sv-menu-title {
    padding: 16px 20px 8px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sv-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: none;
    border: none;
    color: var(--ctrl-text, #e5e5e5);
    font-size: 0.95rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sv-menu-item:active {
    background: rgba(255, 255, 255, 0.06);
}

.sv-menu-icon {
    width: 18px;
    text-align: center;
    opacity: 0.7;
}

.sv-menu-item-danger {
    color: #ff6b6b;
}

.sv-menu-item-danger .sv-menu-icon {
    opacity: 0.9;
}

.sv-menu-cancel {
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

/* "Editing" pill next to the playlist title while in edit mode */
.sv-editing-pill {
    display: inline-block;
    margin-left: 10px;
    padding: 3px 10px;
    background: rgba(74, 158, 255, 0.2);
    border: 1px solid rgba(74, 158, 255, 0.5);
    color: #cfe2ff;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    vertical-align: middle;
}

.av-track-play {
    font-size: 0.7rem;
    opacity: 0.3;
    flex-shrink: 0;
}

/* ---- States ---- */
.av-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    opacity: 0.4;
}

.av-error {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    font-size: 0.85rem;
    padding: 24px;
}

/* ---- Empty / error state for shared playlists ---- */
.sv-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    gap: 12px;
}

.sv-empty-icon {
    font-size: 2.5rem;
    opacity: 0.35;
    margin-bottom: 4px;
}

.sv-empty-title {
    font-size: 1rem;
    font-weight: 600;
    max-width: 320px;
    line-height: 1.4;
}

.sv-empty-sub {
    font-size: 0.85rem;
    opacity: 0.55;
    max-width: 320px;
    line-height: 1.4;
}

.sv-empty-action {
    margin-top: 8px;
    padding: 10px 20px;
    background: #e5e5e5;
    color: #0a0a0a;
    border: none;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.sv-empty-action:hover {
    background: #fff;
}

/* ---- Sections ---- */
.av-section {
    padding: 16px 16px 4px;
}

.av-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ctrl-muted, #999);
    margin: 0 0 10px;
}

/* ---- Releases (horizontal scroll cards) ---- */
.av-releases {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.av-releases::-webkit-scrollbar { display: none; }

.av-release-card {
    flex-shrink: 0;
    width: 120px;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.av-release-art {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.8);
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.av-release-title {
    font-size: 0.78rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.av-release-card:active { transform: scale(0.96); }

/* ---- Sessions ---- */
.av-sessions {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.av-sessions::-webkit-scrollbar { display: none; }

.av-session-card {
    flex-shrink: 0;
    width: 160px;
    height: 100px;
    border-radius: 12px;
    border: none;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    color: white;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.av-session-label {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.av-session-count {
    font-size: 0.7rem;
    opacity: 0.7;
}

.av-session-card:active { transform: scale(0.96); }

/* ---- Responsive ---- */
@media (min-width: 600px) {
    .av-hero { min-height: 180px; }
    .av-hero-name { font-size: 1.8rem; }
    .av-track { padding: 12px 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .av-track:active { background: none; }
}
