/* ===== ADD-TO-CART MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 40px 36px;
    max-width: 420px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 14px; right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}
.modal-close:hover { color: var(--text-primary); }

.modal-thumb {
    width: 120px;
    height: 120px;
    border-radius: 14px;
    overflow: hidden;
    margin: 0 auto 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.modal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #e8e8e8;
    margin-bottom: 6px;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.modal-exclusive-sub {
    color: var(--accent-active);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 11px;
}

.modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-perks {
    text-align: left;
    margin-bottom: 20px;
}
.modal-perk {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
    padding: 8px 0;
    border-bottom: 1px solid rgba(58,58,58,0.3);
}
.modal-perk:last-child { border-bottom: none; }
.modal-perk i { color: var(--accent-active); font-size: 14px; width: 18px; text-align: center; }

.modal-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-active);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-btn {
    width: 100%;
    padding: 14px;
    border-radius: 30px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn-primary {
    background: var(--accent-active);
    color: #1e1e1e;
}
.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(167,139,250,0.3);
}

.modal-btn-secondary {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}
.modal-btn-secondary:hover {
    border-color: var(--accent-passive);
    color: var(--accent-passive);
}

/* ===== QUICK-ADD MODAL (free beats) ===== */
.modal-card-quick {
    max-width: 520px;
    padding: 24px;
    text-align: left;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-quick-loading {
    text-align: center;
    padding: 60px 0;
    color: var(--accent-active);
    font-size: 24px;
}

.modal-quick-error {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
    font-size: 13px;
}

/* Header: artwork + title + meta */
.modal-quick-header {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-subtle);
}
.modal-quick-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.modal-quick-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal-quick-title-wrap { min-width: 0; flex: 1; }
.modal-quick-title {
    font-size: 17px;
    font-weight: 700;
    color: #e8e8e8;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.modal-quick-meta {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--text-secondary);
}
.modal-quick-meta i { color: var(--accent-active); margin-right: 4px; font-size: 11px; }

/* Empty state (no children) */
.modal-quick-empty {
    text-align: center;
    padding: 24px 0 8px;
    color: var(--text-secondary);
    font-size: 13px;
}
.modal-quick-empty i {
    display: block;
    font-size: 28px;
    margin-bottom: 12px;
    color: var(--border-subtle);
}

/* Bundle card */
.modal-bundle-card {
    background: rgba(167,139,250,0.06);
    border: 1px solid rgba(167,139,250,0.2);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
}
.modal-bundle-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.modal-bundle-header > i {
    color: var(--accent-active);
    font-size: 16px;
}
.modal-bundle-text { flex: 1; min-width: 0; }
.modal-bundle-text strong {
    display: block;
    font-size: 14px;
    color: #f0f0f0;
    font-weight: 700;
}
.modal-bundle-text span {
    font-size: 11px;
    color: var(--text-secondary);
}
.modal-bundle-price { text-align: right; }
.modal-bundle-original {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-decoration: line-through;
}
.modal-bundle-now {
    font-size: 18px;
    font-weight: 700;
    color: #f0f0f0;
}
.modal-bundle-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
}
.modal-bundle-check { display: inline-flex; align-items: center; gap: 5px; }
.modal-bundle-check.available i { color: #4ade80; }
.modal-bundle-check.available { color: var(--text-primary); }
.modal-bundle-check.unavailable i { color: #f87171; opacity: 0.5; }
.modal-bundle-check.unavailable {
    color: var(--text-secondary);
    text-decoration: line-through;
    opacity: 0.6;
}
.modal-bundle-buy {
    width: 100%;
    background: var(--accent-active) !important;
    color: #1e1e1e !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    justify-content: center;
}
.modal-bundle-buy:hover { background: #9574f0 !important; }

/* Asset rows */
.modal-asset-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}
.modal-asset-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
}
.modal-asset-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.modal-asset-icon.oneshots { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.modal-asset-icon.stems    { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.modal-asset-icon.midi     { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.modal-asset-icon.misc     { background: rgba(236, 72, 153, 0.12); color: #ec4899; }
.modal-asset-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.modal-asset-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.modal-asset-count {
    font-size: 11px;
    color: var(--text-secondary);
}
.modal-asset-buy-btn {
    background: #3a3a3a;
    color: #f0f0f0;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.modal-asset-buy-btn:hover:not(:disabled) { background: #444; }
.modal-asset-buy-btn:disabled { opacity: 0.7; cursor: default; }

/* Footer: free MP3 + view full details */
.modal-quick-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}
.modal-quick-footer .modal-btn-secondary { width: 100%; }
.modal-quick-detail-link {
    color: var(--text-secondary);
    font-size: 12px;
    text-decoration: none;
    padding: 4px 8px;
}
.modal-quick-detail-link:hover { color: var(--accent-active); }

@media (max-width: 600px) {
    .modal-card-quick {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
    }
    .modal-asset-row { flex-wrap: wrap; }
    .modal-asset-meta { flex-basis: 60%; }
}

/* ===== Stems Preview Modal ===== */
.stems-modal-card { max-width: 520px; width: 100%; padding: 24px; }

.stems-modal-header { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.stems-modal-thumb { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; flex-shrink: 0; background: var(--bg-main); }
.stems-modal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stems-modal-titles { display: flex; flex-direction: column; min-width: 0; }
.stems-modal-eyebrow { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-active); font-weight: 600; }
.stems-modal-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin: 2px 0 4px; line-height: 1.2; }
.stems-modal-sub { font-size: 12px; color: var(--text-secondary); margin: 0; }

.stems-modal-state { padding: 18px 4px; color: var(--text-secondary); font-size: 13px; }
.stems-modal-state > div { display: flex; align-items: center; gap: 10px; justify-content: center; }
.stems-modal-loading i, .stems-modal-processing i { color: var(--accent-active); font-size: 14px; }
.stems-modal-empty i { color: var(--accent-warn, var(--accent-passive)); font-size: 14px; }

.stems-list { list-style: none; padding: 0; margin: 6px 0 12px; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.stem-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; background: rgba(255,255,255,0.02); border: 1px solid transparent; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.stem-row:hover { background: rgba(255,255,255,0.04); border-color: var(--border-subtle); }
.stem-row.playing { background: rgba(167,139,250,0.08); border-color: rgba(167,139,250,0.25); }
.stem-play-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 11px; flex-shrink: 0; transition: all 0.2s ease; }
.stem-row:hover .stem-play-btn { border-color: var(--accent-active); color: var(--accent-active); }
.stem-row.playing .stem-play-btn { background: var(--accent-active); border-color: var(--accent-active); color: #1e1e1e; }
.stem-name { width: 96px; flex-shrink: 0; font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stem-row.playing .stem-name { color: var(--accent-active); }

/* Waveform — two stacked images. Base is desaturated for the unplayed look;
   .played has clip-path:inset() driven by JS to reveal the colored portion. */
.stem-wave { position: relative; flex: 1; height: 36px; min-width: 0; cursor: pointer; overflow: hidden; border-radius: 4px; }
.stem-wave img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.stem-wave-base { filter: grayscale(1) brightness(0.85); opacity: 0.5; }
.stem-wave-played { clip-path: inset(0 100% 0 0); transition: clip-path 0.08s linear; }
.stem-row:hover .stem-wave-base { opacity: 0.7; }
.stem-wave-missing { background: repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0 6px, transparent 6px 10px); }

.stems-modal-footer { display: flex; justify-content: stretch; margin-top: 8px; }
.stems-modal-buy { width: 100%; }
