/* ═══════════════════════════════════════════════════════════
   Add to Collection panel — Figma dashboard_update exact match
   Theme: rounded-xl = 16px (--radius-xl), rounded-lg = 12px (--radius-lg)
   ═══════════════════════════════════════════════════════════ */

#add-to-collection-panel {
    width: min(360px, 100vw);
    /* Figma --border: rgba(26,24,21,0.11) mapped to theme text */
    --atc-border: color-mix(in srgb, var(--text-primary) 11%, transparent);
    --atc-muted: color-mix(in srgb, var(--text-primary) 6.5%, var(--surface));
    --atc-amber: #fbbf24;           /* amber-400 */
    --atc-amber-border: color-mix(in srgb, #fcd34d 70%, transparent); /* amber-300/70 */
    --atc-amber-50: #fffbeb;
    --atc-amber-100: #fef3c7;
}

#add-to-collection-panel.active {
    box-shadow:
        -4px 0 24px rgba(8, 14, 16, 0.10),
        -1px 0 0 rgba(26, 24, 21, 0.08);
}

#add-to-collection-panel .panel-header {
    height: 48px;                 /* h-12 */
    padding: 0 20px;              /* px-5 */
    box-sizing: border-box;
    border-bottom-color: var(--atc-border);
}

#add-to-collection-panel .panel-header h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
}

/* Figma close: w-7 h-7 rounded-lg, X size 15 (icon-btn svg already 15) */
#add-to-collection-panel .panel-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-lg); /* 12px — rounded-lg */
    color: color-mix(in srgb, var(--text-tertiary) 65%, transparent);
}

#add-to-collection-panel .panel-close:hover {
    background: color-mix(in srgb, var(--atc-muted) 60%, transparent);
    color: var(--text-primary);
}

#add-to-collection-panel .panel-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

/* ── Current song card ───────────────────────────────────── */
/* px-4 pt-3.5 pb-2.5 | card: gap-2.5 px-3 py-2.5 bg-muted/50 rounded-xl */

.atc-song-wrap {
    flex-shrink: 0;
    padding: 14px 16px 10px;
}

.atc-song-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--atc-muted) 50%, var(--surface));
    border-radius: var(--radius-xl); /* 16px */
    min-width: 0;
}

.atc-song-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: color-mix(in srgb, var(--text-tertiary) 55%, transparent);
    line-height: 0;
}

.atc-song-icon svg {
    width: 13px;
    height: 13px;
}

.atc-song-info {
    min-width: 0;
    flex: 1;
}

.atc-song-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
}

.atc-song-sub {
    font-size: 11px;
    color: color-mix(in srgb, var(--text-tertiary) 55%, transparent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
}

/* ── Section label: px-5 pb-1.5 ──────────────────────────── */

.atc-section-label {
    flex-shrink: 0;
    padding: 0 20px 6px;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--text-section-label);
    user-select: none;
}

/* ── List: px-4 pb-2 space-y-1.5 ─────────────────────────── */

#add-to-collection-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px; /* space-y-1.5 */
}

/* ── Row: gap-3 px-3.5 py-[11px] rounded-xl border ───────── */

.atc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-xl); /* 16px */
    border: 1px solid var(--atc-border);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
    box-sizing: border-box;
}

.atc-row:hover {
    background: color-mix(in srgb, var(--atc-muted) 30%, transparent);
}

.atc-row.is-in {
    border-color: color-mix(in srgb, var(--accent) 20%, transparent);
    background: color-mix(in srgb, var(--accent) 5.5%, transparent);
}

.atc-row.is-in:hover {
    background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.atc-row.is-favorites.is-in {
    border-color: var(--atc-amber-border);
    background: color-mix(in srgb, var(--atc-amber-50) 80%, var(--surface));
}

.atc-row.is-favorites.is-in:hover {
    background: color-mix(in srgb, var(--atc-amber-100) 50%, var(--surface));
}

body.dark-mode .atc-row.is-favorites.is-in {
    border-color: color-mix(in srgb, var(--favorites-gold) 30%, var(--atc-border));
    background: color-mix(in srgb, var(--favorites-gold) 9%, var(--surface));
}

body.dark-mode .atc-row.is-favorites.is-in:hover {
    background: color-mix(in srgb, var(--favorites-gold) 13%, var(--surface));
}

/* Icon box: w-7 h-7 rounded-lg */
.atc-row-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-lg); /* 12px */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--atc-muted) 60%, transparent);
    color: color-mix(in srgb, var(--text-tertiary) 55%, transparent);
}

.atc-row-icon svg {
    width: 13px;
    height: 13px;
}

.atc-row.is-in .atc-row-icon {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: color-mix(in srgb, var(--accent) 70%, transparent);
}

.atc-row.is-favorites .atc-row-icon {
    background: var(--atc-amber-50);
    color: var(--atc-amber);
}

.atc-row.is-favorites.is-in .atc-row-icon {
    background: var(--atc-amber-100);
    color: var(--atc-amber);
}

.atc-row.is-favorites .atc-row-icon svg {
    fill: currentColor;
}

body.dark-mode .atc-row.is-favorites .atc-row-icon {
    background: color-mix(in srgb, var(--favorites-gold) 14%, var(--surface));
    color: var(--favorites-gold);
}

body.dark-mode .atc-row.is-favorites.is-in .atc-row-icon {
    background: color-mix(in srgb, var(--favorites-gold) 18%, var(--surface));
    color: var(--favorites-gold);
}

.atc-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.atc-row-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
    user-select: none;
}

.atc-row-count {
    font-size: 11px;
    color: color-mix(in srgb, var(--text-tertiary) 55%, transparent);
    user-select: none;
    line-height: 1.35;
}

/* Check: 18×18 rounded-full; unchecked border-2; checked solid */
.atc-check {
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    border: 2px solid var(--atc-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
    color: #fff;
    transition: background 0.15s ease, border-color 0.15s ease, border-width 0.15s ease;
    box-sizing: border-box;
}

.atc-check svg {
    width: 10px;
    height: 10px;
    stroke-width: 3;
}

.atc-row.is-in .atc-check {
    background: var(--accent);
    border-color: var(--accent);
    border-width: 0;
    width: 18px;
    height: 18px;
}

.atc-row.is-favorites.is-in .atc-check {
    background: var(--atc-amber);
    border-color: var(--atc-amber);
}

body.dark-mode .atc-row.is-favorites.is-in .atc-check {
    background: var(--favorites-gold-dim);
    border-color: var(--favorites-gold-dim);
}

/* ── New collection (app-only; not in Figma) ─────────────── */

.atc-new-wrap {
    margin-top: 2px;
}

.atc-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-xl);
    border: 1px dashed var(--atc-border);
    background: transparent;
    color: color-mix(in srgb, var(--text-tertiary) 70%, transparent);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.atc-new-btn svg {
    width: 14px;
    height: 14px;
}

.atc-new-btn:hover {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--atc-border));
    background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.atc-new-form {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.atc-new-input {
    flex: 1;
    min-width: 0;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--atc-border);
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    outline: none;
}

.atc-new-input:focus {
    border-color: color-mix(in srgb, var(--accent) 38%, var(--atc-border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.atc-new-confirm,
.atc-new-cancel {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-xl);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.atc-new-confirm svg,
.atc-new-cancel svg {
    width: 14px;
    height: 14px;
}

.atc-new-confirm {
    background: var(--accent);
    color: #fff;
}

.atc-new-confirm:hover {
    filter: brightness(0.95);
}

.atc-new-cancel {
    background: var(--atc-muted);
    color: var(--text-secondary);
}

.atc-new-cancel:hover {
    background: var(--atc-border);
}

/* ── Footer: px-4 py-3.5 | Done: py-2.5 rounded-xl 13.5px ─ */

#add-to-collection-panel .panel-footer {
    padding: 14px 16px;
    gap: 0;
    border-top-color: var(--atc-border);
}

#add-to-collection-panel .panel-footer .btn-primary {
    flex: 1;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 10px 16px;           /* py-2.5 */
    border-radius: var(--radius-xl); /* 16px */
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: none;
    transform: none;
}

#add-to-collection-panel .panel-footer .btn-primary:hover {
    background: color-mix(in srgb, var(--accent) 90%, #000);
    transform: none;
    box-shadow: none;
}

#add-to-collection-panel .panel-footer .btn-primary:active {
    transform: scale(0.99);
}

/* Keep Figma layout when responsive.css resets generic panel padding.
   Tablet modal: 521–1023px (and large coarse pointers). Must use overflow:hidden
   + flex min-height so the list/textarea scroll inside max-height. */
@media (max-width: 1023px), (min-width: 1024px) and (pointer: coarse) {
    #add-to-collection-panel {
        width: min(460px, 92vw);
        height: var(--floating-modal-height);
        min-height: var(--floating-modal-min-height);
        max-height: var(--floating-modal-max-height);
        overflow: hidden;
        border-radius: var(--radius-2xl);
        box-shadow: 0 20px 60px rgba(8, 14, 16, 0.18);
    }

    #add-to-collection-panel .panel-header {
        height: 48px;
        padding: 0 20px;
        flex-shrink: 0;
    }

    #add-to-collection-panel .panel-content {
        flex: 1 1 auto;
        padding: 0;
        overflow: hidden;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    #add-to-collection-panel .panel-footer {
        flex-shrink: 0;
        padding: 14px 16px;
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }
}

/* Align with responsive.css fullscreen panels (≤520px) */
@media (max-width: 520px) {
    #add-to-collection-panel {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
    }

    #add-to-collection-panel .panel-content {
        flex: 1 1 auto;
        min-height: 0;
    }
}

/* ═══════════════════════════════════════════════════════════
   Add Songs (from inside a collection) — match ATC / Settings chrome
   ═══════════════════════════════════════════════════════════ */

.add-song-to-col-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.40);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    padding: 16px;
    box-sizing: border-box;
}

.add-song-to-col-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.add-song-to-col-modal {
    --astc-border: color-mix(in srgb, var(--text-primary) 11%, transparent);
    --astc-muted: color-mix(in srgb, var(--text-primary) 6.5%, var(--surface));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    box-shadow: 0 20px 60px rgba(8, 14, 16, 0.18);
    width: min(420px, 100%);
    height: var(--floating-modal-height);
    min-height: var(--floating-modal-min-height);
    max-height: var(--floating-modal-max-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.97) translateY(6px);
    transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.add-song-to-col-overlay.active .add-song-to-col-modal {
    transform: scale(1) translateY(0);
}

.add-song-to-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 52px;
    padding: 0 16px 0 20px;
    border-bottom: 1px solid var(--astc-border);
    flex-shrink: 0;
    box-sizing: border-box;
}

.add-song-to-col-title-block {
    min-width: 0;
    flex: 1;
}

.add-song-to-col-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0;
    line-height: 1.25;
}

.add-song-to-col-subtitle {
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    color: color-mix(in srgb, var(--text-tertiary) 65%, transparent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.add-song-to-col-subtitle:empty {
    display: none;
}

.add-song-to-col-close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: color-mix(in srgb, var(--text-tertiary) 65%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.add-song-to-col-close:hover {
    background: color-mix(in srgb, var(--astc-muted) 60%, transparent);
    color: var(--text-primary);
}

.add-song-to-col-close svg {
    width: 15px;
    height: 15px;
}

.add-song-to-col-search-row {
    padding: 12px 16px 10px;
    flex-shrink: 0;
}

.add-song-to-col-search-row .search-box {
    width: 100%;
}

.add-song-to-col-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.add-song-to-col-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--astc-border);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
    box-sizing: border-box;
}

.add-song-to-col-row:hover {
    background: color-mix(in srgb, var(--astc-muted) 30%, transparent);
}

.add-song-to-col-row.is-in {
    border-color: color-mix(in srgb, var(--accent) 20%, transparent);
    background: color-mix(in srgb, var(--accent) 5.5%, transparent);
}

.add-song-to-col-row.is-in:hover {
    background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.add-song-to-col-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--astc-muted) 60%, transparent);
    color: color-mix(in srgb, var(--text-tertiary) 55%, transparent);
}

.add-song-to-col-icon svg {
    width: 13px;
    height: 13px;
}

.add-song-to-col-row.is-in .add-song-to-col-icon {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: color-mix(in srgb, var(--accent) 70%, transparent);
}

.add-song-to-col-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.add-song-to-col-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
}

.add-song-to-col-author {
    font-size: 11px;
    color: color-mix(in srgb, var(--text-tertiary) 55%, transparent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
}

.add-song-to-col-check {
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    border: 2px solid var(--astc-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
    color: #fff;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.add-song-to-col-check svg {
    width: 10px;
    height: 10px;
    stroke-width: 3;
}

.add-song-to-col-row.is-in .add-song-to-col-check {
    background: var(--accent);
    border-color: var(--accent);
    border-width: 0;
}

.add-song-to-col-footer {
    flex-shrink: 0;
    padding: 14px 16px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--astc-border);
}

.add-song-to-col-done {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-xl);
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.12s ease;
}

.add-song-to-col-done:hover {
    filter: brightness(0.95);
}

.add-song-to-col-done:active {
    transform: scale(0.99);
}

@media (max-width: 520px) {
    .add-song-to-col-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .add-song-to-col-modal {
        width: 100%;
        height: 85dvh;
        max-height: 85dvh;
        min-height: 0;
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        transform: translateY(20px);
    }

    .add-song-to-col-overlay.active .add-song-to-col-modal {
        transform: translateY(0);
    }
}
