/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.75); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px; width: 90%; max-width: 440px;
  transform: scale(0.95) translateY(10px); transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header { display: flex; gap: 18px; margin-bottom: 24px; align-items: center; }
.modal-img {
  width: 96px; height: 96px; border-radius: 12px; object-fit: cover;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.modal-info { flex: 1; min-width: 0; }
.modal-title { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.3px; }
.modal-artist { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.modal-section { margin-bottom: 20px; }
.modal-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 10px; font-weight: 600; }

.option-group { display: flex; gap: 8px; }
.option-btn {
  flex: 1; padding: 12px 8px; text-align: center; background: var(--bg-input);
  border: 2px solid var(--border); border-radius: 12px;
  color: var(--text); cursor: pointer; font-size: 13px; transition: all var(--transition);
  font-family: inherit; font-weight: 500;
}
.option-btn:hover { border-color: var(--border-hover); }
.option-btn.selected { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.option-btn small { display: block; font-size: 11px; color: var(--text-dim); margin-top: 3px; font-weight: 400; }

/* Explains the currently-selected download method (also covers why Format
   disappears for Soulseek/Lidarr — those hints don't mention quality). */
.modal-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ── Action hierarchy ──
   Three dedicated classes, no shared base with overlapping properties, so
   there is no source-order/specificity fight between "primary" and
   "secondary" look (the old bug: .btn-download + .modal-secondary on the
   same element both set background/color at equal specificity, and
   .btn-download — defined later in the file — silently won every time,
   making Add/Download render identical to Play). */

/* Primary — the one filled, unmissable action: Play. */
.modal-btn-primary {
  width: 100%; padding: 16px; background: var(--accent); color: #000;
  border: none; border-radius: 12px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all var(--transition); font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.modal-btn-primary:hover { box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.modal-btn-primary:active { transform: translateY(0); }
.modal-btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* Secondary — outlined, clearly lower-weight than Play: Add to Queue, Download. */
.modal-btn-outline {
  padding: 13px 16px; background: transparent; color: var(--text);
  border: 2px solid var(--border); border-radius: 12px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all var(--transition);
  font-family: inherit;
}
.modal-btn-outline:hover { border-color: var(--border-hover); background: var(--bg-input); }
.modal-btn-outline:disabled { opacity: .4; cursor: not-allowed; }
.modal-btn-download-cta { width: 100%; margin-top: 16px; }

/* Row holding Add to Queue + the demoted Radio/Follow chips. */
.modal-quick-row { display: flex; gap: 8px; align-items: stretch; margin-top: 10px; }

/* Small, lighter "chip" style for demoted secondary actions (Radio/Follow),
   visually distinct from the primary Play and the medium Add to Queue button. */
.modal-chip {
  flex: 0 0 auto; padding: 9px 12px; text-align: center; background: transparent;
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--text-muted); cursor: pointer; font-size: 12px; font-weight: 500;
  font-family: inherit; transition: all var(--transition);
}
.modal-chip:hover { border-color: var(--border-hover); color: var(--text); }

/* Labeled divider that visually ties Method/Format to Download and separates
   them from the listen/queue actions above. */
.modal-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 16px; }
.modal-divider::before, .modal-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.modal-divider span {
  font-size: 11px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 1.2px; font-weight: 600; white-space: nowrap;
}

/* Groups Method + Format + Download into one visually distinct panel so it
   reads as "these options only affect Download". */
.modal-download-panel {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px;
}
.modal-download-panel .modal-section:last-of-type { margin-bottom: 0; }

.btn-download {
  width: 100%; padding: 15px; background: var(--accent); color: #000;
  border: none; border-radius: 12px; font-size: 15px;
  font-weight: 700; cursor: pointer; transition: all var(--transition);
  font-family: inherit;
}
.btn-download:hover { box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-download:active { transform: translateY(0); }
.btn-download:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-close {
  position: absolute; top: 16px; right: 20px; background: none; border: none;
  color: var(--text-muted); font-size: 24px; cursor: pointer; line-height: 1;
  transition: color var(--transition); width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.btn-close:hover { color: var(--text); background: rgba(255,255,255,.05); }

#modalLibraryNotice {
  background: var(--accent-dim); border: 1px solid rgba(162,230,64,0.2);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 20px;
  font-size: 13px; color: var(--accent); font-weight: 500;
}

.modal-btn-row { display: flex; gap: 8px; margin-top: 8px; }
.modal-btn-row .btn-play-modal { flex: 0 0 auto; padding: 15px 20px; background: var(--bg-elevated); color: var(--text); border: 2px solid var(--border); border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all var(--transition); font-family: inherit; display: flex; align-items: center; gap: 6px; }
.modal-btn-row .btn-play-modal:hover { border-color: var(--accent); color: var(--accent); }
.modal-btn-row .btn-queue-modal { flex: 0 0 auto; padding: 15px 16px; background: var(--bg-elevated); color: var(--text-muted); border: 2px solid var(--border); border-radius: 12px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--transition); font-family: inherit; }
.modal-btn-row .btn-queue-modal:hover { border-color: var(--border-hover); color: var(--text); }

.modal-auto-dl { display: flex; align-items: center; gap: 8px; padding: 10px 0 0; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.modal-auto-dl input { accent-color: var(--accent); cursor: pointer; margin: 0; }
.modal-auto-dl:hover { color: var(--text); }
