﻿/* ===================================================================
   Music
   Extends the Tech Noir design system from ../style.css
   =================================================================== */

:root {
    --deck-cyan: var(--cyan-glow);
    --deck-green: var(--green-glow);
    --panel-radius: 14px;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {

    outline: 2px solid var(--deck-cyan);
    outline-offset: 3px;
}

button,
input {
    font: inherit;
}

.music-main {
    position: relative;
    z-index: 1;
}

.site-footer {
    color: var(--text-secondary);
}

.music-hero {
    padding: 4.5rem 0 1rem;
}

.music-intro {
    max-width: 760px;
    margin-bottom: 2.5rem;
}

.music-title {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1.08;
    letter-spacing: -1.5px;
    font-weight: 800;
    color: var(--text-pure);
    margin-bottom: 1rem;
}

.music-subtitle {
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 640px;
}

/* Player deck */
.player-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(340px, 0.98fr);
    gap: 1.25rem;
    align-items: start;
}

.now-panel,
.playlist-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-dim);
    border-radius: var(--panel-radius);
    min-width: 0;
}

.now-panel {
    display: flex;
    flex-direction: column;
    padding: 1.2rem 1.35rem 1.35rem;
}

.playlist-panel {
    display: flex;
    flex-direction: column;
    padding: 1.2rem 1.35rem 1.35rem;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.05rem 1.2rem;
    border-bottom: 1px solid var(--border-dim);
}

.now-panel .panel-head,
.playlist-panel .panel-head {
    padding: 0 0 1rem;
}

.panel-kicker {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--text-primary);
}

.panel-meta {
    display: block;
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.panel-state {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--deck-green);
    white-space: nowrap;
}

.playlist-form {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.95rem;
    padding: 0.5rem 0.5rem 0.5rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 9px;
    transition: var(--transition-fast);
}

.playlist-form:focus-within {
    border-color: var(--border-cyan);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.08);
}

.playlist-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-pure);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.4rem 0;
}

.playlist-input::placeholder {
    color: var(--text-secondary);
}

.playlist-input:focus {
    outline: none;
}

.playlist-submit {
    flex-shrink: 0;
    min-height: 44px;
    padding: 0 0.95rem;
    border: 1px solid transparent;
    border-radius: 7px;
    background: var(--deck-cyan);
    color: #041016;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
}

.playlist-submit:hover {
    background: #4df5ff;
}

.playlist-submit[disabled] {
    opacity: 0.6;
    cursor: progress;
}

.playlist-hint {
    margin-top: 0.55rem;
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.status-region {
    display: block;
}

.playlist-status {
    margin-top: 0.7rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.playlist-status.is-ok {
    color: var(--deck-green);
}

.playlist-status.is-error {
    color: #ffb4b4;
}

.playlist-empty {
    margin-top: 1rem;
    padding: 1.6rem 1rem;
    border: 1px dashed var(--border-bright);
    border-radius: 9px;
    text-align: center;
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.playlist-list {
    list-style: none;
    margin-top: 0.9rem;
    max-height: 430px;
    overflow-y: auto;
    border-top: 1px solid var(--border-dim);
    scrollbar-width: thin;
}

/* Now playing panel */
.source-badge {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--deck-green);
    border: 1px solid rgba(0, 255, 157, 0.32);
    background: rgba(0, 255, 157, 0.07);
    border-radius: 5px;
    padding: 3px 8px;
    white-space: nowrap;
}

.now-track {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 0 1.15rem;
}

.artwork-frame {
    position: relative;
    width: 118px;
    height: 118px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid var(--border-bright);
    background: #080c14;
    overflow: hidden;
}

.artwork-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.artwork-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(0, 240, 255, 0.45);
    background:
        radial-gradient(circle at 50% 50%, rgba(0, 240, 255, 0.1), transparent 62%),
        repeating-linear-gradient(0deg, transparent 0 15px, rgba(255, 255, 255, 0.025) 15px 16px);
}

.artwork-fallback svg {
    animation: slowSpin 24s linear infinite;
}

@keyframes slowSpin {
    to { transform: rotate(360deg); }
}

.now-meta {
    min-width: 0;
}

.now-title {
    font-size: 1.32rem;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text-pure);
    overflow-wrap: anywhere;
}

.now-artist {
    margin-top: 4px;
    font-size: 0.92rem;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.now-album {
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.watch-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--deck-cyan);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 240, 255, 0.35);
}

.watch-link:hover {
    color: var(--deck-green);
    border-bottom-color: rgba(0, 255, 157, 0.5);
}

.yt-player-shell {
    position: fixed;
    left: 0;
    top: 0;
    width: 160px;
    height: 90px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

#youtube-player {
    width: 160px;
    height: 90px;
}

.transport {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.35rem 0 1.1rem;
}

.transport-btn,
.volume-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border-bright);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.transport-btn:hover,
.volume-btn:hover {
    color: var(--deck-cyan);
    border-color: var(--border-cyan);
    background: var(--bg-card-hover);
}

.transport-play {
    width: 58px;
    height: 58px;
    border-radius: 12px;
    border-color: rgba(0, 240, 255, 0.55);
    background: var(--deck-cyan);
    color: #041016;
    box-shadow: 0 0 24px rgba(0, 240, 255, 0.22);
}

.transport-play:hover {
    background: #4df5ff;
    color: #041016;
    border-color: #4df5ff;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
}

.transport-play .icon-play,
.transport-play .icon-pause {
    display: inline-flex;
    transform: translateX(1px);
}

.transport-play .icon-pause {
    transform: none;
}

.timeline {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    align-items: center;
    gap: 10px;
}

.time-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.time-label:last-child {
    text-align: right;
}

.range-input {
    --progress: 0%;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--deck-cyan) 0%, var(--deck-cyan) var(--progress), rgba(255, 255, 255, 0.09) var(--progress), rgba(255, 255, 255, 0.09) 100%);
    cursor: pointer;
    outline-offset: 6px;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--text-pure);
    border: 2px solid var(--deck-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

.range-input::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--text-pure);
    border: 2px solid var(--deck-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

.volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0.85rem;
}

.volume-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
}

.volume-btn.is-muted {
    color: #ff9494;
    border-color: rgba(255, 148, 148, 0.35);
}

.range-volume {
    --progress: 80%;
}

.player-error {
    margin-top: 0.9rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid rgba(255, 148, 148, 0.35);
    background: rgba(255, 95, 86, 0.08);
    border-radius: 7px;
    color: #ffb4b4;
    font-size: 0.82rem;
    line-height: 1.45;
}

/* Catalog */
.catalog-section {
    padding: 4.5rem 0 5rem;
}

.catalog-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.6rem;
}

.catalog-title {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.7px;
    color: var(--text-pure);
}

.catalog-note {
    max-width: 340px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-secondary);
    text-align: right;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.6rem 0.55rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: 10px;
    transition: var(--transition-fast);
}

.search-form:focus-within {
    border-color: var(--border-cyan);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.08);
}

.search-icon {
    display: inline-flex;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-pure);
    font-size: 0.95rem;
    padding: 0.55rem 0;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-input:focus {
    outline: none;
}

.search-submit {
    flex-shrink: 0;
    min-height: 44px;
    padding: 0 1.1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--deck-cyan);
    color: #041016;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
}

.search-submit:hover {
    background: #4df5ff;
}

.preset-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0.9rem 0 2rem;
}

.preset-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-right: 2px;
}

.preset-chip {
    min-height: 44px;
    padding: 0 0.8rem;
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.preset-chip:hover {
    color: var(--deck-green);
    border-color: rgba(0, 255, 157, 0.4);
    background: rgba(0, 255, 157, 0.05);
}

.results-shell {
    position: relative;
}

.results-status {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    min-height: 1.2rem;
    margin-bottom: 0.65rem;
}

.results-loading {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 2.2rem 0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.loading-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--deck-cyan);
    animation: loadingBlink 1.1s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.14s; }
.loading-dot:nth-child(3) { animation-delay: 0.28s; }

@keyframes loadingBlink {
    0%, 100% { opacity: 0.2; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2px); }
}

.results-message {
    border: 1px dashed var(--border-bright);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.015);
    padding: 2rem 1.4rem;
    text-align: center;
}

.results-message-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.results-message-text {
    font-size: 0.86rem;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.retry-btn {
    margin-top: 1rem;
    min-height: 44px;
    padding: 0 1rem;
    border: 1px solid var(--border-bright);
    border-radius: 7px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.retry-btn:hover {
    border-color: var(--border-cyan);
    color: var(--deck-cyan);
}

.track-list {
    list-style: none;
    border-top: 1px solid var(--border-dim);
}

.track-row {
    display: grid;
    grid-template-columns: 22px 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0.62rem 0.7rem;
    border: none;
    border-bottom: 1px solid var(--border-dim);
    border-radius: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease;
}

.track-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.track-row.is-active {
    background: rgba(0, 240, 255, 0.07);
}

.track-row.is-active .track-row-title {
    color: var(--deck-cyan);
}

.row-play {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid var(--text-secondary);
    justify-self: center;
    transition: border-left-color 0.16s ease;
}

.track-row:hover .row-play,
.track-row.is-active .row-play {
    border-left-color: var(--deck-cyan);
}

.track-row-art {
    width: 48px;
    height: 48px;
    border-radius: 5px;
    object-fit: cover;
    border: 1px solid var(--border-dim);
    background: var(--bg-card);
}

.track-row-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.track-row-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-row-sub {
    font-size: 0.76rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-row-time {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: right;
}

/* Responsive */
@media (max-width: 900px) {
    .player-grid {
        grid-template-columns: 1fr;
    }

    .now-panel,
    .playlist-panel {
        padding: 1.1rem 1.15rem 1.25rem;
    }

    .playlist-list {
        max-height: 320px;
    }
}

@media (max-width: 700px) {
    .music-hero {
        padding-top: 3rem;
    }

    .catalog-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .catalog-note {
        text-align: left;
        max-width: none;
    }

    .search-form {
        flex-wrap: wrap;
        padding: 0.65rem;
        gap: 0.5rem;
    }

    .search-icon {
        display: none;
    }

    .search-input {
        flex: 1 1 100%;
        padding: 0.45rem 0.35rem;
    }

    .search-submit {
        flex: 1 1 100%;
    }

    .playlist-form {
        flex-wrap: wrap;
        padding: 0.6rem;
    }

    .playlist-input {
        flex: 1 1 100%;
        padding: 0.4rem 0.25rem;
    }

    .playlist-submit {
        flex: 1 1 100%;
    }

    .track-row {
        grid-template-columns: 18px 42px minmax(0, 1fr) 40px;
        gap: 9px;
        padding: 0.58rem 0.35rem;
    }

    .track-row-art {
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 460px) {
    .music-title {
        letter-spacing: -1px;
    }

    .artwork-frame {
        width: 92px;
        height: 92px;
    }

    .now-title {
        font-size: 1.12rem;
    }

    .now-track {
        gap: 0.8rem;
    }

    .transport {
        gap: 0.55rem;
    }

    .transport-btn {
        width: 44px;
        height: 44px;
    }

    .transport-play {
        width: 54px;
        height: 54px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

