/**
 * Shared Private Social Downloader UI
 * Brand colors come from each *-private-downloader-tool.css (--pd-a, --pd-b, --pd-c, --pd-ink)
 */

/* Let the private UI own the frame — avoid double card inside .tool-widget */
.tool-widget:has(.pd-tool) {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.pd-tool {
  --pd-a: var(--a, #25F4EE);
  --pd-b: var(--a2, #FE2C55);
  --pd-c: var(--a3, #69C9D0);
  --pd-ink: var(--ink, #0a0a0a);
  --pd-line: rgba(148, 163, 184, 0.16);
  --pd-surface: rgba(10, 16, 28, 0.88);
  --pd-surface-2: rgba(15, 23, 42, 0.72);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.pd-tool [hidden] {
  display: none !important;
}

/* —— Hero —— */
.pd-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.25rem;
  align-items: start;
  padding: 1.35rem 1.4rem 1.4rem;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--pd-a) 28%, var(--pd-line));
  background:
    radial-gradient(900px 220px at -8% -40%, color-mix(in srgb, var(--pd-a) 32%, transparent), transparent 58%),
    radial-gradient(720px 200px at 108% -20%, color-mix(in srgb, var(--pd-b) 26%, transparent), transparent 52%),
    linear-gradient(155deg, rgba(8, 12, 22, 0.98), rgba(12, 18, 32, 0.94));
  animation: pd-hero-in 0.55s ease both;
}

.pd-hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% 40%;
  height: 70%;
  background: radial-gradient(circle, color-mix(in srgb, var(--pd-a) 12%, transparent), transparent 70%);
  pointer-events: none;
  animation: pd-glow 6s ease-in-out infinite alternate;
}

.pd-brand-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.75rem;
}

.pd-brand-text {
  min-width: 0;
}

.pd-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pd-c);
}

.pd-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #f8fafc;
  line-height: 1.2;
}

.pd-sub {
  margin: 0 0 0.95rem;
  max-width: 40rem;
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.55;
}

.pd-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pd-trust li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: #cbd5e1;
}

.pd-trust-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--pd-a), var(--pd-b));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pd-a) 18%, transparent);
}

.pd-hero-aside {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

.pd-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pd-ink);
  background: linear-gradient(145deg, var(--pd-a), var(--pd-b));
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--pd-b) 28%, transparent);
}

.pd-public-link {
  font-size: 0.75rem;
  font-weight: 700;
  color: #7dd3fc;
  text-decoration: none;
  text-align: right;
  max-width: 11rem;
  line-height: 1.35;
}

.pd-public-link:hover {
  color: #bae6fd;
  text-decoration: underline;
}

/* —— Cards / steps —— */
.pd-card {
  position: relative;
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: 18px;
  border: 1px solid var(--pd-line);
  background: var(--pd-surface-2);
  animation: pd-card-in 0.45s ease both;
}

.pd-step:nth-of-type(1) { animation-delay: 0.05s; }
.pd-step:nth-of-type(2) { animation-delay: 0.1s; }
.pd-step:nth-of-type(3) { animation-delay: 0.15s; }

.pd-step-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e2e8f0;
}

.pd-step-label span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 10px;
  font-size: 0.78rem;
  background: linear-gradient(145deg, color-mix(in srgb, var(--pd-a) 85%, #fff), var(--pd-b));
  color: var(--pd-ink);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--pd-a) 22%, transparent);
}

.pd-step--action {
  border-color: color-mix(in srgb, var(--pd-a) 35%, var(--pd-line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--pd-a) 8%, transparent), transparent 48%),
    var(--pd-surface-2);
}

.pd-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.7rem;
}

.pd-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #e2e8f0;
}

.pd-head--formats {
  margin-top: 1.1rem;
}

.pd-pill {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--pd-c);
  background: color-mix(in srgb, var(--pd-a) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--pd-a) 32%, transparent);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  white-space: nowrap;
}

.pd-pill--link {
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pd-pill--link:hover {
  background: color-mix(in srgb, var(--pd-a) 22%, transparent);
  border-color: color-mix(in srgb, var(--pd-a) 55%, transparent);
  color: #fff;
}



.pd-input,
.pd-cookies {
  border-radius: 12px !important;
}

.pd-cookies {
  min-height: 6.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  resize: vertical;
}

.pd-field-label {
  display: block;
  margin: 0.85rem 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #94a3b8;
}

.pd-cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  justify-content: flex-start;
  align-items: center;
}

.pd-clear-btn {
  min-height: 44px;
  min-width: 7.5rem;
  justify-content: center;
}

.pd-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-start;
}

.pd-fetch {
  min-width: 11rem;
  font-weight: 800 !important;
  padding: 0.75rem 1.2rem !important;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--pd-b) 28%, transparent);
}

.pd-mini {
  appearance: none;
  border: 1px solid var(--pd-line);
  background: rgba(30, 41, 59, 0.85);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.pd-mini:hover {
  border-color: color-mix(in srgb, var(--pd-a) 50%, transparent);
  color: #fff;
}

.pd-note {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
  flex: 1;
  min-width: 12rem;
  line-height: 1.45;
}

/* —— Progress / status —— */
.pd-progress {
  margin-top: 1rem;
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--pd-a) 30%, transparent);
  background: color-mix(in srgb, var(--pd-a) 10%, transparent);
}

.pd-progress-head {
  display: flex;
  justify-content: space-between;
  color: #e2e8f0;
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
}

.pd-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 41, 0.85);
  overflow: hidden;
}

.pd-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pd-b), var(--pd-a), var(--pd-c));
  transition: width 0.25s ease;
}

.pd-progress-step {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

.pd-status {
  margin: 0.75rem 0 0;
  min-height: 1.2rem;
  font-size: 0.86rem;
  color: #94a3b8;
}

.pd-status.is-error {
  color: #fca5a5;
}

.pd-status.is-ok {
  color: #86efac;
}

/* —— Result —— */
.pd-result {
  border-color: color-mix(in srgb, var(--pd-a) 40%, var(--pd-line));
  animation: pd-result-in 0.4s ease both;
}

.pd-result-grid {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 1rem;
}

.pd-preview-wrap {
  border-radius: 14px;
  overflow: hidden;
  background: #020617;
  border: 1px solid var(--pd-line);
  aspect-ratio: 16 / 10;
}

.pd-preview,
.pd-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pd-result-meta h3 {
  margin: 0 0 0.45rem;
  color: #f8fafc;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
}

.pd-meta {
  margin: 0 0 0.35rem;
  color: #94a3b8;
  font-size: 0.86rem;
}

.pd-actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.pd-formats {
  display: grid;
  gap: 0.55rem;
}

/* JS builds {prefix}-format rows — style all of them inside .pd-tool */
.pd-tool [class$="-format"] {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--pd-line);
  background: rgba(2, 6, 23, 0.45);
  color: #e2e8f0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pd-tool [class$="-format"].is-active {
  border-color: color-mix(in srgb, var(--pd-a) 60%, transparent);
  background: color-mix(in srgb, var(--pd-a) 14%, transparent);
}

.pd-tool [class$="-format-badge"] {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--pd-a) 18%, transparent);
  color: var(--pd-c);
}

.pd-tool [class$="-format"] strong {
  display: block;
  font-size: 0.9rem;
}

.pd-tool [class$="-format"] span {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

.pd-tool [class$="-format-dl"] {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--pd-b), var(--pd-a));
  color: var(--pd-ink);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.pd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
  width: 100%;
  align-items: stretch;
}

.pd-tool .btn-primary {
  background: linear-gradient(145deg, var(--pd-b), var(--pd-a));
  color: var(--pd-ink);
  border-color: transparent;
}

@keyframes pd-hero-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes pd-card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes pd-result-in {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

@keyframes pd-glow {
  from { opacity: 0.55; transform: translateX(0); }
  to { opacity: 1; transform: translateX(-6%); }
}

@media (max-width: 900px) {
  .pd-hero {
    grid-template-columns: 1fr;
  }

  .pd-hero-aside {
    align-items: flex-start;
  }

  .pd-public-link {
    text-align: left;
    max-width: none;
  }

  .pd-url-row,
  .pd-result-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .pd-cookie-actions,
  .pd-tools {
    justify-content: center;
  }

  .pd-clear-btn {
    width: 100%;
    max-width: 20rem;
  }

  .pd-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .pd-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.25;
  }

  .pd-tool [class$="-hero"],
  .pd-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .pd-tool [class$="-format"] {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .pd-tool [class$="-format-dl"] {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .pd-note {
    min-width: 0;
    flex: 1 1 100%;
  }

  .pd-fetch {
    min-width: 0;
    width: 100%;
  }

  .pd-tools {
    width: 100%;
  }

  .pd-url-stack .btn,
  .pd-cookie-actions .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .pd-mini {
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pd-hero,
  .pd-card,
  .pd-result,
  .pd-hero::after {
    animation: none;
  }
}

/* Input stack: row 1 URL | row 2 Paste | row 3 Fetch + Clear */
.pd-url-stack {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  width: 100%;
}
.pd-url-stack--actions { margin-top: .65rem; }
.pd-url-field { position: relative; min-width: 0; width: 100%; }
.pd-url-icon {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: #94a3b8; pointer-events: none; z-index: 1;
}
.pd-url-input { padding-left: 2.55rem !important; min-height: 50px; }
.pd-url-stack .pd-paste-btn {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  border-style: dashed;
}

.pd-url-stack .pd-url-input {
  padding-left: 2.55rem !important;
  min-height: 48px;
}
