/* ==========================================================================
   PLAYLISTS PAGE — playlist-specific styles only
   Shared base look (nav, buttons, inputs, #app) lives in base.css
   ========================================================================== */

/* ---------- Background vibe-classification progress banner ---------- */
.vibe-classification-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #22d3ee;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

/* ---------- Vibe-based playlist recommendations ---------- */
.playlist-recommendations {
    background: #181818;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #2c2c2c;
    margin-bottom: 16px;
}
.playlist-recommendations h4 {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.recommendations-status {
    font-size: 0.82rem;
    color: #b3b3b3;
}
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.recommendation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #242424;
    border-radius: 8px;
    padding: 8px 10px;
}
.recommendation-cover {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.recommendation-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.recommendation-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recommendation-tags {
    font-size: 0.75rem;
    color: #06b6d4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recommendation-add-btn {
    background: transparent;
    border: 1.5px solid #b3b3b3;
    color: #b3b3b3;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.recommendation-add-btn:hover {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.06);
}

/* ---------- Create Playlist Form ---------- */
#create-playlist-container {
    background: #1e1e1e;
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid #2a2a2a;
    box-sizing: border-box;
}
#create-playlist-container h3 {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 18px;
}
/* ---------- Playlist Workspace (desktop) ---------- */
.playlist-workspace {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.column {
    flex: 1;
    background: #1e1e1e;
    padding: 20px;
    border-radius: 16px;
    min-height: 200px;
    border: 1px solid #2a2a2a;
    box-sizing: border-box;
    overflow: hidden;
}
.column h3 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-top: 0;
    margin-bottom: 16px;
    color: #ffffff;
}

/* Master list rows */
#playlists-master-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.playlist-item-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: #2a2a2a;
    margin-bottom: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.playlist-item-row:hover {
    background: #383838;
    transform: translateX(2px);
}
/* Scoped to playlist rows: the Home song list uses the same class names. */
.playlist-item-row .list-cover {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.list-text-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.playlist-item-row .list-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.playlist-count {
    font-size: 0.78rem;
    color: #b3b3b3;
}
.playlist-item-row.active-row {
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}
.playlist-item-row.active-row .list-title {
    color: var(--on-accent);
}
.playlist-item-row.active-row .playlist-count,
.playlist-item-row.active-row .playlist-meta {
    color: inherit;
    opacity: 0.8;
}
.playlist-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 0.78rem;
    color: #b3b3b3;
}
.playlist-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.playlist-group-heading {
    list-style: none;
    margin: 14px 0 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8d8d8d;
}
.playlist-group-heading:first-child {
    margin-top: 0;
}

/* ---------- Sharing switch ---------- */
.share-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
    margin: 0 0 16px;
    padding: 10px 14px;
    background: #242424;
    border-radius: 12px;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}
.share-switch-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.share-switch-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
}
.share-switch-hint {
    font-size: 0.78rem;
    font-weight: 400;
    color: #b3b3b3;
    line-height: 1.3;
}
/* A native checkbox drawn as an on/off switch (works with a tap anywhere on the row). */
.switch-input {
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    position: relative;
    width: 48px;
    height: 28px;
    margin: 0;
    border-radius: 14px;
    background: #4d4d4d;
    cursor: pointer;
    transition: background 0.2s;
}
.switch-input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s;
}
.switch-input:checked {
    background: var(--accent);
}
.switch-input:checked::after {
    transform: translateX(20px);
}

/* ---------- Someone else's shared playlist: play-only ---------- */
.readonly-note {
    margin: 0 0 14px;
    padding: 10px 14px;
    background: #242424;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #b3b3b3;
}
#focused-playlist-zone.readonly .owner-only,
#focused-playlist-zone.readonly #rename-playlist-btn,
#focused-playlist-zone.readonly #change-cover-btn,
#focused-playlist-zone.readonly #rename-playlist-form,
#focused-playlist-zone.readonly .reorder-btn,
#focused-playlist-zone.readonly .remove-track-btn,
#focused-playlist-zone.readonly .bulk-add-container,
#focused-playlist-zone.readonly .playlist-recommendations,
#focused-playlist-zone.readonly #delete-playlist-entirely-btn {
    display: none !important;
}

/* Focused playlist zone (drawer) */
#focused-playlist-zone {
    background: #181818;
    padding: 20px;
    border-radius: 14px;
    border: 1px solid #2e2e2e;
}
.focused-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.focused-header-row h3 {
    margin: 0;
}
.focused-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.rename-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.rename-form input[type="text"] {
    flex: 1;
}
.rename-form button {
    width: auto;
    padding: 10px 18px;
    font-size: 0.9rem;
    margin-top: 0;
    flex-shrink: 0;
}
.hidden {
    display: none !important;
}
#focused-song-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.song-item-subrow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #242424;
    margin-bottom: 6px;
    border-radius: 8px;
    font-size: 0.9rem;
    gap: 10px;
}
.subrow-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.subrow-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.reorder-btn {
    background: transparent;
    border: none;
    color: #b3b3b3;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.reorder-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.reorder-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}
.remove-track-btn {
    background: transparent;
    border: none;
    color: #b3b3b3;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}
.remove-track-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}
.danger-btn {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    margin-top: 20px;
    width: 100%;
    padding: 12px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
}
.danger-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #f87171;
}

/* ---------- Bulk Add Section ---------- */
.bulk-add-container {
    background: #181818;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #2c2c2c;
}
/* Collapsed by default: most visits are about the tracks, not bulk editing. */
.bulk-add-container > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin: -8px 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    list-style: none;
}
.bulk-add-container > summary::-webkit-details-marker {
    display: none;
}
.bulk-add-container[open] > summary {
    margin-bottom: 8px;
}
.empty-playlist-note {
    background: transparent;
    color: #b3b3b3;
    padding: 12px 4px;
    font-size: 0.9rem;
    line-height: 1.4;
}
.new-playlist-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin-bottom: 16px;
    background: #2a2a2a;
    color: #ffffff;
    border-radius: 24px;
    font-size: 0.95rem;
}
.new-playlist-btn:hover {
    background: #383838;
}
.icon-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}
.icon-btn-primary:hover {
    background: var(--accent-hover);
    color: var(--on-accent);
}
#bulk-songs-search {
    width: 100%;
    padding: 10px 14px;
    background: #1a1a1a;
    border: 1px solid #3e3e3e;
    color: white;
    border-radius: 8px;
    margin-bottom: 12px;
    box-sizing: border-box;
    font-size: 0.9rem;
}
#bulk-songs-search:focus {
    border-color: var(--accent);
    outline: none;
}
.bulk-songs-picker-scroll {
    max-height: 220px;
    overflow-y: auto;
    background: #0f0f0f;
    border: 1px solid #2c2c2c;
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 6px 0;
}
.bulk-songs-picker-scroll::-webkit-scrollbar {
    width: 6px;
}
.bulk-songs-picker-scroll::-webkit-scrollbar-thumb {
    background: #3e3e3e;
    border-radius: 3px;
}
.bulk-song-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.bulk-song-item:hover {
    background: #1f1f1f;
}
.bulk-song-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
}
.bulk-song-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: normal;
}
.bulk-row-title {
    font-size: 0.9rem;
    color: #e1e1e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.success-btn {
    background-color: var(--accent) !important;
    color: var(--on-accent) !important;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: transform 0.1s ease;
}
.success-btn:active {
    transform: scale(0.98);
}

/* ---------- Mobile Overhaul ---------- */
@media (max-width: 768px) {
    #create-playlist-container {
        padding: 18px;
        border-radius: 14px;
        margin-bottom: 24px;
        box-sizing: border-box;
    }
    #create-playlist-container h3 {
        font-size: 1rem;
        margin-bottom: 14px;
    }
    #create-playlist-form button {
        width: 100%;
        padding: 16px;
        font-size: 1rem;
        border-radius: 14px;
    }

    /* Stack columns properly, no overflow */
    .playlist-workspace {
        flex-direction: column !important;
        gap: 0;
        width: 100%;
        box-sizing: border-box;
    }
    .playlist-workspace .column {
        width: 100%;
        max-width: 100%;
        margin-bottom: 24px;
        padding: 16px;
        border-radius: 14px;
        box-sizing: border-box;
        overflow: hidden;
    }

    .column h3 {
        text-align: center;       /* centred heading */
    }

    .playlist-item-row {
        padding: 14px 16px;
        gap: 12px;
        border-radius: 12px;
        background: #242424;
        margin-bottom: 10px;
    }
    .playlist-item-row .list-cover {
        width: 44px;
        height: 44px;
    }
    .playlist-item-row .list-title {
        font-size: 1rem;
    }
    .playlist-item-row.active-row {
        background: var(--accent);
        box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.4);
    }

    #focused-playlist-zone {
        margin: 8px 0 16px 0;
        padding: 18px;
        border-radius: 14px;
        background: #1a1a1a;
        border: 1px solid #2e2e2e;
        box-sizing: border-box;
    }
    #focused-playlist-zone h3 {
        font-size: 1rem;
        margin-bottom: 16px;
        text-align: center;
    }
    .focused-header-row {
        flex-direction: column;
        align-items: center;
    }
    .focused-header-row h3 {
        margin-bottom: 4px;
    }
    .focused-header-actions {
        justify-content: center;
        width: 100%;
    }
    .rename-form {
        flex-direction: column;
    }
    .rename-form button {
        width: 100%;
    }

    .bulk-add-container {
        padding: 14px;
        border-radius: 10px;
        margin-bottom: 18px;
        box-sizing: border-box;
    }
    .bulk-songs-picker-scroll {
        max-height: 200px;
    }
    .bulk-song-item {
        padding: 12px 14px;
    }
    .bulk-song-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
    .bulk-row-title {
        font-size: 0.9rem;
    }
    .success-btn {
        padding: 14px;
        font-size: 0.95rem;
        border-radius: 12px;
    }

    .song-item-subrow {
        padding: 14px;
        font-size: 0.9rem;
        border-radius: 10px;
    }
    /* iOS zooms into any input under 16px on focus */
    #bulk-songs-search,
    #rename-playlist-input {
        font-size: 1rem;
    }
    .danger-btn {
        width: 100%;
        padding: 14px;
        font-size: 0.95rem;
        margin-top: 16px;
        border-radius: 12px;
    }

    /* Remove any leftover table/grid overrides */
    .playlist-table,
    .playlist-grid {
        display: block;
        width: 100%;
    }
    .playlist-table thead {
        display: none;
    }
    .playlist-table tr {
        display: flex;
        flex-direction: column;
        background: transparent;
        padding: 0;
        border: none;
    }
    .inline-add-row {
        flex-direction: column;
        gap: 10px;
    }
    .inline-add-row select,
    .inline-add-row button {
        width: 100% !important;
    }
}