/**
 * Persistent Spotify Web Playback-bar (under Issue Tracker-knapp i høyre hjørne).
 * z-index 1000 etter ønsket spesifikasjon — under modaler/drawer (9989+).
 */

.ecp-sticky-spotify-shell--dormant {
    display: none !important;
}

/* Mobil bunnmeny: flyout over pill (samme z/bunn som .bottom-nav-flyout) */
@media (max-width: 768px) {
    body.nav-style-bottom .ecp-sticky-spotify-shell.ecp-sticky-spotify-shell--flyout-open {
        display: flex !important;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: var(--bottom-nav-overlay-bottom, calc(46px + var(--bottom-nav-chin, 0px)));
        max-width: none;
        z-index: 99990;
        max-height: var(--bottom-nav-spotify-shell-max-h, var(--bottom-nav-flyout-max-h, min(85vh, 900px)));
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-end;
        overflow: hidden;
        pointer-events: auto;
    }

    body.nav-style-bottom .ecp-sticky-spotify-shell.ecp-sticky-spotify-shell--flyout-open .ecp-sticky-spotify-drawers {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    body.nav-style-bottom .ecp-sticky-spotify-shell.ecp-sticky-spotify-shell--flyout-open .ecp-sticky-spotify {
        flex-shrink: 0;
    }

    /* Overstyr vh-tak slik at lyrics/katalog fyller skallet (samme som --bottom-nav-flyout-max-h) */
    body.nav-style-bottom .ecp-sticky-spotify-shell.ecp-sticky-spotify-shell--flyout-open .ecp-sticky-spotify-drawer.ecp-sticky-spotify-drawer--open {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        max-height: none !important;
    }

    body.nav-style-bottom .ecp-sticky-spotify-shell.ecp-sticky-spotify-shell--flyout-open .ecp-sticky-spotify-drawer.ecp-sticky-spotify-drawer--open .ecp-sticky-spotify-drawer-panel {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none !important;
    }

    body.nav-style-bottom .ecp-sticky-spotify-shell.ecp-sticky-spotify-shell--flyout-open .ecp-spotify-catalog-pick-scroll,
    body.nav-style-bottom .ecp-sticky-spotify-shell.ecp-sticky-spotify-shell--flyout-open .ecp-sticky-spotify-drawer-body--lyrics {
        max-height: none !important;
    }
}

/* Ytre skall: spiller + skuffer over (fast nederst) */
.ecp-sticky-spotify-shell {
    position: fixed;
    left: 12px;
    right: 76px;
    bottom: 16px;
    z-index: 1000;
    max-width: min(560px, calc(100vw - 92px));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    box-sizing: border-box;
    font-size: 0.8125rem;
    pointer-events: none;
    transition:
        transform 0.38s cubic-bezier(0.32, 0.72, 0, 1),
        opacity 0.32s ease;
}

.ecp-sticky-spotify-shell > * {
    pointer-events: auto;
}

.ecp-sticky-spotify-shell--hiding {
    transform: translateY(calc(100% + 28px));
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}

.ecp-sticky-spotify-drawers {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-height: 0;
}

/* Skuff som folder ut opp fra spilleren */
.ecp-sticky-spotify-drawer {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition:
        max-height 0.34s cubic-bezier(0.32, 0.72, 0, 1),
        opacity 0.26s ease,
        margin 0.26s ease;
    margin-bottom: 0;
}

.ecp-sticky-spotify-drawer.ecp-sticky-spotify-drawer--open {
    max-height: min(42vh, 380px);
    opacity: 1;
    pointer-events: auto;
    margin-bottom: 6px;
}

.ecp-sticky-spotify-drawer--tracklist.ecp-sticky-spotify-drawer--open {
    max-height: min(62vh, 560px);
}

.ecp-sticky-spotify-drawer-panel {
    background: #1a1a1a;
    color: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px 10px 8px 8px;
    box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    max-height: min(42vh, 380px);
    overflow: hidden;
}

.ecp-sticky-spotify-drawer--tracklist .ecp-sticky-spotify-drawer-panel {
    max-height: min(62vh, 560px);
}

.ecp-sticky-spotify-drawer-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ecp-sticky-spotify-drawer-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 6px;
}

.ecp-sticky-spotify-drawer-body--lyrics {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px 14px;
    font-size: 0.8125rem;
    line-height: 1.55;
}

.ecp-sticky-spotify-drawer-lyrics-text {
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    white-space: pre-wrap;
    word-break: break-word;
}

.ecp-sticky-spotify-drawer-instrumental {
    margin: 0;
    color: rgba(255, 255, 255, 0.55);
    font-style: italic;
}

.ecp-sticky-spotify-drawer-source {
    flex-shrink: 0;
    margin: 0;
    padding: 0 14px 10px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.42);
}

.ecp-sticky-spotify-tracklist-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 0 8px;
    max-height: min(36vh, 320px);
}

.ecp-sticky-spotify-drawer--tracklist .ecp-sticky-spotify-tracklist-scroll {
    max-height: min(54vh, 500px);
}

.ecp-sticky-spotify-tracklist-empty {
    margin: 12px 14px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
}

.ecp-sticky-spotify-tracklist-row-pos {
    flex-shrink: 0;
    width: 1.65rem;
    text-align: right;
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.38);
    padding-top: 0.12rem;
}

.ecp-sticky-spotify-tracklist-row {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    margin: 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    text-align: left;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1.35;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ecp-sticky-spotify-tracklist-row:last-child {
    border-bottom: none;
}

.ecp-sticky-spotify-tracklist-row:hover:not(:disabled) {
    background: rgba(29, 185, 84, 0.1);
}

.ecp-sticky-spotify-tracklist-row--current {
    background: rgba(29, 185, 84, 0.14);
}

.ecp-sticky-spotify-tracklist-row--current .ecp-sticky-spotify-tracklist-row-title {
    color: #1ed760;
}

.ecp-sticky-spotify-tracklist-row:disabled,
.ecp-sticky-spotify-tracklist-row--nojump {
    cursor: default;
    opacity: 0.72;
}

.ecp-sticky-spotify-tracklist-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.ecp-sticky-spotify-tracklist-row-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecp-sticky-spotify-tracklist-row-artist {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.48);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecp-sticky-spotify-tracklist-row-isrc {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.38);
    max-width: 38%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecp-sticky-spotify {
    flex-shrink: 0;
    width: 100%;
    background: #121212;
    color: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.ecp-spotify-top {
    padding: 4px 10px 4px;
}

.ecp-spotify-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    min-height: 48px;
}

.ecp-spotify-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 10px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ecp-spotify-time-elapsed,
.ecp-spotify-time-total {
    font-size: 0.65rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.48);
    width: 2.35rem;
    flex-shrink: 0;
    line-height: 1.2;
}

.ecp-spotify-time-total {
    text-align: right;
}

.ecp-spotify-progress {
    flex: 1;
    min-width: 0;
    height: 6px;
    accent-color: #1db954;
    cursor: pointer;
}

.ecp-spotify-progress:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

/* Klikk → katalogdetaljer når avspilling er startet fra utgivelse */
.ecp-spotify-cover-btn {
    display: block;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
    line-height: 0;
}

.ecp-spotify-cover-btn:disabled,
.ecp-spotify-cover-btn.ecp-spotify-cover-btn--inactive {
    cursor: default;
}

.ecp-spotify-cover-btn:not(:disabled):hover {
    box-shadow: 0 0 0 2px rgba(29, 185, 84, 0.45);
}

.ecp-spotify-cover-btn:focus-visible {
    outline: 2px solid rgba(29, 185, 84, 0.75);
    outline-offset: 2px;
}

.ecp-spotify-cover {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
}

.ecp-spotify-cover--empty {
    visibility: hidden;
}

.ecp-spotify-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ecp-spotify-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.ecp-spotify-artist {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ecp-spotify-status {
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 200, 120, 0.95);
}

.ecp-spotify-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Kun ikon — samme grønn som play (uten sirkelboks) */
.ecp-spotify-skip {
    width: auto;
    height: auto;
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
    border: none;
    background: transparent;
    color: #1db954;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 6px;
}

.ecp-spotify-skip:hover:not(:disabled) {
    background: rgba(29, 185, 84, 0.16);
}

.ecp-spotify-skip:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* components.css .lucide { color: var(--text) } — overstyr med høyere spesifisitet */
.ecp-spotify-skip svg.lucide,
.ecp-spotify-skip svg {
    width: 20px;
    height: 20px;
    color: #1db954;
    stroke: #1db954;
}

.ecp-spotify-skip:hover:not(:disabled) svg.lucide,
.ecp-spotify-skip:hover:not(:disabled) svg {
    color: #1ed760;
    stroke: #1ed760;
}

.ecp-spotify-playpause {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #1db954;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.ecp-spotify-playpause:hover {
    filter: brightness(1.08);
}

.ecp-spotify-playpause--active {
    box-shadow: 0 0 0 2px rgba(29, 185, 84, 0.45);
}

.ecp-spotify-pp-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.ecp-spotify-pp-slot svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 520px) {
    .ecp-sticky-spotify-shell {
        right: 12px;
        max-width: none;
    }

    .ecp-spotify-time-elapsed,
    .ecp-spotify-time-total {
        width: 2rem;
        font-size: 0.6rem;
    }
}

/* Issue Tracker-panel over spilleren (skjul-stripe + kontroller + progress) */
/* Løft bug-panelet over klassisk flytende spiller (ikke bunnmeny-flyout) */
body.ecp-spotify-sticky-on:not(.nav-style-bottom) #issue-tracker-widget {
    bottom: 172px;
}

/* Katalog: ISRC + Spotify-knapp */
.catalog-isrc-with-play {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.catalog-isrc-with-play .t-isrc {
    flex: 1;
    min-width: 0;
}

.catalog-isrc-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-spotify-isrc-play--inline {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(29, 185, 84, 0.45);
    background: rgba(29, 185, 84, 0.12);
    color: #1db954;
    cursor: pointer;
}

.btn-spotify-isrc-play--inline:hover:not(:disabled) {
    background: rgba(29, 185, 84, 0.22);
}

.btn-spotify-isrc-play--inline:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-spotify-isrc-play--inline i,
.btn-spotify-isrc-play--inline svg {
    width: 18px;
    height: 18px;
}

@media (prefers-reduced-motion: reduce) {
    .ecp-sticky-spotify-shell,
    .ecp-sticky-spotify-drawer {
        transition-duration: 0.01ms;
    }
}

/* Sangtekst-knapp (samme uttrykk som skip); grå når ingen tekst / ikke katalogkoblet */
.ecp-spotify-lyrics-btn {
    width: auto;
    height: auto;
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
    border: none;
    background: transparent;
    color: #1db954;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 6px;
}

.ecp-spotify-lyrics-btn:hover:not(:disabled) {
    background: rgba(29, 185, 84, 0.16);
}

.ecp-spotify-lyrics-btn:disabled,
.ecp-spotify-lyrics-btn.ecp-spotify-lyrics-btn--inactive {
    opacity: 0.38;
    cursor: default;
}

.ecp-spotify-lyrics-btn:disabled:hover,
.ecp-spotify-lyrics-btn.ecp-spotify-lyrics-btn--inactive:hover {
    background: transparent;
}

.ecp-spotify-lyrics-btn svg.lucide,
.ecp-spotify-lyrics-btn svg {
    width: 20px;
    height: 20px;
    color: #1db954;
    stroke: #1db954;
}

.ecp-spotify-lyrics-btn:disabled svg.lucide,
.ecp-spotify-lyrics-btn:disabled svg,
.ecp-spotify-lyrics-btn.ecp-spotify-lyrics-btn--inactive svg.lucide,
.ecp-spotify-lyrics-btn.ecp-spotify-lyrics-btn--inactive svg {
    color: rgba(255, 255, 255, 0.45);
    stroke: rgba(255, 255, 255, 0.45);
}

/* Katalog: utgivelser med UPC */
.ecp-sticky-spotify-drawer--catalog-pick.ecp-sticky-spotify-drawer--open {
    max-height: min(62vh, 560px);
}

.ecp-sticky-spotify-drawer--catalog-pick .ecp-sticky-spotify-drawer-panel {
    max-height: min(62vh, 560px);
}

.ecp-sticky-spotify-drawer-header--catalog-pick {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Utgivelsesliste: mer plass til søk + liste (tittel skjules; aria-label på dialog) */
.ecp-spotify-catalog-pick--releases-compact .ecp-sticky-spotify-drawer-header--catalog-pick {
    display: none;
}

.ecp-sticky-spotify-drawer-header--catalog-pick .ecp-sticky-spotify-drawer-title {
    flex: 1;
    min-width: 0;
}

.ecp-spotify-catalog-pick-back {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #1db954;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ecp-spotify-catalog-pick-back:hover {
    background: rgba(29, 185, 84, 0.16);
}

.ecp-spotify-catalog-pick-back svg {
    width: 20px;
    height: 20px;
}

.ecp-spotify-catalog-pick-list-tools {
    flex-shrink: 0;
    padding: 8px 12px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ecp-spotify-catalog-pick-list-tools[hidden] {
    display: none !important;
}

.ecp-spotify-catalog-pick-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.8rem;
}

.ecp-spotify-catalog-pick-search::placeholder {
    color: rgba(255, 255, 255, 0.38);
}

.ecp-spotify-catalog-pick-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 0 8px;
    max-height: min(48vh, 420px);
}

.ecp-spotify-catalog-pick-empty {
    margin: 12px 14px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
}

.ecp-spotify-catalog-pick-release-row {
    width: 100%;
    display: flex;
    text-align: left;
    padding: 10px 12px;
    margin: 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1.35;
}

.ecp-spotify-catalog-pick-release-row:hover {
    background: rgba(29, 185, 84, 0.1);
}

.ecp-spotify-catalog-pick-release-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ecp-spotify-catalog-pick-release-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecp-spotify-catalog-pick-release-sub {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.45);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecp-spotify-catalog-pick-track-row {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    margin: 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    text-align: left;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1.35;
}

.ecp-spotify-catalog-pick-track-row:hover:not(:disabled) {
    background: rgba(29, 185, 84, 0.1);
}

.ecp-spotify-catalog-pick-track-row--noisrc {
    opacity: 0.55;
    cursor: default;
}

.ecp-spotify-catalog-pick-track-pos {
    flex-shrink: 0;
    width: 1.65rem;
    text-align: right;
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.38);
    padding-top: 0.12rem;
}

.ecp-spotify-catalog-pick-track-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.ecp-spotify-catalog-pick-track-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecp-spotify-catalog-pick-track-isrc {
    font-size: 0.62rem;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.38);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecp-spotify-catalog-pick-track-hint {
    font-size: 0.62rem;
    color: rgba(255, 200, 120, 0.85);
}

.ecp-spotify-catalog-pick-btn {
    width: auto;
    height: auto;
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
    border: none;
    background: transparent;
    color: #1db954;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 6px;
}

.ecp-spotify-catalog-pick-btn:hover {
    background: rgba(29, 185, 84, 0.16);
}

.ecp-spotify-catalog-pick-btn svg.lucide,
.ecp-spotify-catalog-pick-btn svg {
    width: 20px;
    height: 20px;
    color: #1db954;
    stroke: #1db954;
}

.ecp-spotify-catalog-pick-auth-btn {
    display: block;
    width: calc(100% - 28px);
    max-width: 280px;
    margin: 16px 14px 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 999px;
    background: #1db954;
    color: #000;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.ecp-spotify-catalog-pick-auth-btn:hover {
    filter: brightness(1.06);
}
