/* ===========================================================================
   Live preview of the Audio Catcher side panel.

   This is a faithful HTML/CSS recreation of the extension UI, not a
   screenshot: values are carried over from the extension's own
   css/style_append.css and css/dialogs.css. It deliberately omits the site
   shortcut rail, so no third-party brand appears on the marketing site.

   Namespaced .acp-* so nothing here collides with the page styles.
   =========================================================================== */

/* ---------- stage: perspective + tilt ---------- */
.ac-stage {
  --acp-tilt-y: -9deg;
  --acp-tilt-x: 2deg;
  --acp-mx: 0deg;
  --acp-my: 0deg;
  perspective: 1600px;
  perspective-origin: 60% 40%;
  position: relative;
}

/* The ambient glow is a box-shadow, not a pseudo-element with negative insets:
   an absolutely positioned bleed widens the document and gives the page a
   horizontal scrollbar on narrow viewports. Shadows never do. */

.ac-stage.is-flat {
  --acp-tilt-y: 0deg;
  --acp-tilt-x: 0deg;
  perspective: none;
}

.acp {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin-inline: auto;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(69, 143, 255, .08), transparent 24%),
    radial-gradient(circle at bottom left, rgba(64, 100, 255, .1), transparent 26%),
    var(--bg);
  box-shadow: var(--shadow-md), var(--shadow-neon), 0 0 110px 30px rgba(48, 97, 255, .12);
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  transform:
    rotateY(calc(var(--acp-tilt-y) + var(--acp-mx)))
    rotateX(calc(var(--acp-tilt-x) + var(--acp-my)));
  transform-style: preserve-3d;
  transition: transform 420ms cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
}

/* The extension's signature grain, at the same two scales. */
.acp::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .05) .6px, transparent .8px);
  background-size: 28px 28px;
  opacity: .22;
}

/* Shown only until panel.js swaps in the real component — and left standing if
   the script never runs, so the slot is never an empty hole. */
.acp-fallback {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 400px;
  margin-inline: auto;
  padding: 40px 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--grad-panel);
  text-align: center;
}

.acp-fallback img { width: 40px; height: 40px; border-radius: 10px; }

.acp-fallback p { color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* ---------- header ---------- */
.acp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(11, 15, 20, .8);
  border-bottom: 1px solid var(--border);
}

.acp-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.acp-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex: none;
  filter: drop-shadow(0 0 14px rgba(84, 168, 255, .24));
}

.acp-brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  background: var(--grad-wordmark);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.acp-brand-ver { display: block; font-size: 11px; font-weight: 500; color: var(--dim); }

.acp-icon-btn {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
}

/* ---------- controls ---------- */
.acp-controls { display: grid; gap: 10px; padding: 14px 16px; }

.acp-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--grad-panel);
  color: var(--dim);
  font-size: 13px;
}

.acp-search svg { flex: none; width: 15px; height: 15px; }

.acp-search .acp-caret {
  margin-left: auto;
  color: var(--dim);
  font-size: 15px;
  line-height: 1;
}

.acp-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.acp-sel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--grad-panel);
  color: var(--muted);
  font-size: 11px;
}

.acp-sel.is-set { border-color: rgba(83, 168, 255, .38); color: var(--accent); }

.acp-sel svg { flex: none; width: 11px; height: 11px; opacity: .8; }

.acp-sort { display: flex; align-items: center; justify-content: center; gap: 8px; }

.acp-sort i { display: block; height: 2px; border-radius: 2px; background: var(--muted); }

.acp-sort-lines { display: grid; gap: 3px; justify-items: start; }

.acp-sort-lines i:nth-child(1) { width: 13px; }
.acp-sort-lines i:nth-child(2) { width: 9px; }
.acp-sort-lines i:nth-child(3) { width: 5px; }

/* ---------- body ---------- */
/* One fixed box for every state, so the list, the empty state and the open
   export menu all produce a panel of exactly the same height. */
.acp-body {
  position: relative;
  height: var(--acp-body-h, 340px);
  overflow: hidden;
}

/* The fade sells a scrollable list; on the empty state it just dims the copy. */
.acp-body.is-empty::after { display: none; }

.acp-body::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 46px;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none;
  z-index: 2;
}

.acp-list {
  display: grid;
  gap: 10px;
  padding: 4px 16px 16px;
  align-content: start;
}

.acp-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, rgba(83, 168, 255, .05), transparent 34%),
    var(--grad-panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .02);
}

.acp-item.is-playing { border-color: rgba(83, 168, 255, .42); box-shadow: var(--shadow-neon); }

.acp-item-top { display: flex; align-items: flex-start; gap: 12px; }

.acp-item-id { display: flex; align-items: flex-start; gap: 8px; flex: 1; min-width: 0; }

/* A neutral file glyph stands in for the favicon: the preview names no site. */
.acp-fav {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--fav-bg, rgba(83, 168, 255, .16));
  color: var(--fav-fg, #9ecbff);
}

.acp-fav svg { width: 11px; height: 11px; }

.acp-item-meta { min-width: 0; display: grid; gap: 6px; }

.acp-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.acp-badges { display: flex; gap: 6px; }

.acp-badge {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .08);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.acp-actions { display: flex; gap: 6px; flex: none; }

.acp-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.acp-btn svg { width: 15px; height: 15px; }

.acp-btn.play {
  border-color: transparent;
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 10px 22px rgba(27, 88, 160, .28);
}

.acp-btn.dl { color: var(--success); }
.acp-btn.rm { color: var(--danger); }

/* ---------- waveform ---------- */
.acp-wave {
  position: relative;
  height: 40px;
  /* Reserve the right edge for the time readout so the bars never run under it. */
  padding: 0 86px 0 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .2);
  display: flex;
  align-items: center;
  gap: 1px;
  overflow: hidden;
}

.acp-wave i {
  flex: 1 1 auto;
  min-width: 2px;
  border-radius: 999px;
  background: var(--dim);
  transition: background 120ms linear;
}

.acp-wave i.on { background: var(--primary); }

.acp-time {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  color: rgba(238, 246, 255, .68);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}

/* ---------- format dropdown ---------- */
.acp-item { position: relative; }

.acp-menu {
  position: absolute;
  right: 12px;
  top: 52px;
  z-index: 6;
  min-width: 186px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .38), 0 0 0 1px rgba(83, 168, 255, .08);
}

.acp-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.acp-menu-row + .acp-menu-row { margin-top: 2px; }

.acp-menu-row.is-hi { background: rgba(83, 168, 255, .08); color: var(--accent); }

.acp-pill {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(0, 0, 0, .4);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--dim);
}

.acp-pill.med { color: var(--primary); border-color: rgba(83, 168, 255, .26); }

.acp-pill.pro {
  background: linear-gradient(135deg, rgba(255, 217, 122, .22), rgba(240, 180, 41, .16));
  border-color: rgba(240, 180, 41, .42);
  color: var(--gold-soft);
}

/* ---------- empty state ---------- */
.acp-empty {
  position: relative;
  height: calc(100% - 20px);
  margin: 4px 16px 16px;
  padding: 22px 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 20% 0%, rgba(48, 97, 255, .16), transparent 55%),
    var(--grad-panel-strong);
  text-align: left;
  overflow: hidden;
}

.acp-empty-ico {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 12px 26px rgba(27, 88, 160, .3);
  margin-bottom: 18px;
}

.acp-empty-ico svg { width: 24px; height: 24px; }

.acp-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }

.acp-chip {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.acp-empty h4 { font-size: 17px; letter-spacing: -.03em; margin-bottom: 8px; }

.acp-empty p { color: var(--muted); font-size: 12.5px; line-height: 1.6; }

/* ---------- footer ---------- */
.acp-foot {
  display: grid;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.acp-vol { display: flex; align-items: center; gap: 10px; color: var(--muted); }

.acp-vol svg { width: 15px; height: 15px; flex: none; }

.acp-track {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--elevated);
}

.acp-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--acp-vol, 78%);
  border-radius: inherit;
  background: var(--primary);
}

.acp-track b {
  position: absolute;
  top: 50%;
  left: var(--acp-vol, 78%);
  width: 12px;
  height: 12px;
  margin-left: -6px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, .5);
}

.acp-vol-num { font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

.acp-bulk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.acp-bulk-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid transparent;
}

.acp-bulk-btn svg { width: 14px; height: 14px; }

.acp-bulk-btn.ghost { border-color: rgba(239, 68, 68, .38); color: var(--danger); }

.acp-bulk-btn.primary { background: var(--primary); color: #06213d; }

/* ---------- standalone dialogs ---------- */
.acp-dialog {
  width: 100%;
  max-width: 340px;
  margin-inline: auto;
  padding: 22px 20px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  color: var(--text);
  font-size: 14px;
}

.acp-dialog h4 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }

.acp-dialog .acp-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.acp-progress { height: 6px; border-radius: 999px; background: var(--elevated); overflow: hidden; }

.acp-progress span {
  display: block;
  height: 100%;
  width: 58%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 400ms ease;
}

.acp-quota {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--elevated);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.acp-offer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
  padding: 13px 14px;
  border: 1px solid rgba(240, 180, 41, .32);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-glow), rgba(240, 180, 41, .04));
}

.acp-offer-txt { display: grid; gap: 1px; min-width: 0; }

.acp-offer-txt b { font-size: 13px; color: var(--text); }

.acp-offer-txt span { font-size: 12px; color: var(--gold-soft); }

.acp-gold-btn {
  margin-left: auto;
  flex: none;
  padding: 8px 14px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: var(--gold-ink);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 6px 18px var(--gold-glow);
}

.acp-bens { display: grid; gap: 9px; margin-bottom: 16px; }

.acp-bens li { display: flex; gap: 9px; font-size: 13px; line-height: 1.4; color: var(--text); }

.acp-bens svg { flex: none; width: 14px; height: 14px; margin-top: 3px; color: var(--primary); }

.acp-plan {
  display: grid;
  gap: 2px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--elevated);
  position: relative;
}

.acp-plan + .acp-plan { margin-top: 9px; }

.acp-plan.is-on {
  border-color: rgba(240, 180, 41, .55);
  background: linear-gradient(135deg, rgba(240, 180, 41, .12), rgba(240, 180, 41, .03));
}

.acp-plan-lbl { font-size: 11.5px; color: var(--muted); }

.acp-plan.is-on .acp-plan-lbl { color: var(--gold-soft); }

.acp-plan-amt { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }

.acp-plan-amt small { font-size: 11.5px; font-weight: 500; color: var(--dim); }

.acp-plan-eq { font-size: 11px; color: var(--dim); }

.acp-plan-tag {
  position: absolute;
  top: 11px;
  right: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: var(--gold-ink);
  font-size: 10px;
  font-weight: 800;
}

.acp-sub-btn {
  margin-top: 15px;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: var(--gold-ink);
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 6px 18px var(--gold-glow);
}

.acp-fine { margin-top: 11px; text-align: center; font-size: 11.5px; color: var(--dim); }

/* ---------- entrance + motion ---------- */
.acp-item, .acp-empty, .acp-menu { opacity: 1; }

.ac-stage.is-armed .acp-item,
.ac-stage.is-armed .acp-empty,
.ac-stage.is-armed .acp-menu {
  opacity: 0;
  transform: translateY(10px);
}

.ac-stage.is-in .acp-item,
.ac-stage.is-in .acp-empty,
.ac-stage.is-in .acp-menu {
  opacity: 1;
  transform: none;
  transition: opacity 520ms ease, transform 520ms cubic-bezier(.22, .61, .36, 1);
  transition-delay: var(--acp-delay, 0ms);
}

@keyframes acp-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -9px; }
}

.ac-stage.is-float .acp { animation: acp-float 7s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .ac-stage { --acp-tilt-y: 0deg; --acp-tilt-x: 0deg; perspective: none; }
  .ac-stage.is-float .acp { animation: none; }
  .acp { transition: none; }
  .ac-stage.is-armed .acp-item,
  .ac-stage.is-armed .acp-empty,
  .ac-stage.is-armed .acp-menu { opacity: 1; transform: none; }
}

/* Tilting a 400px panel inside a narrow column just clips it. */
@media (max-width: 860px) {
  .ac-stage { --acp-tilt-y: 0deg; --acp-tilt-x: 0deg; }
}
