/* ---------------------------------------------------------------------------
   WinningHunter "Ask AI" prompt popover — reusable component
   --------------------------------------------------------------------------- */

.ai-prompt-trigger {
  --ai-trigger-accent: #cc785c;
  background: linear-gradient(135deg, #1f2937 0%, #0b1120 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  height: 34px;
  padding: 0 12px 0 6px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.ai-prompt-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.26);
}

.ai-prompt-trigger:active {
  transform: translateY(0);
}

.ai-prompt-trigger-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--ai-trigger-accent, #cc785c);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-prompt-trigger-icon svg {
  width: 13px;
  height: 13px;
}

/* Ask-AI button inside action grids (e.g. ad detail modal) */
.ad-action-item .ask-ai-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ai-trigger-accent, #cc785c);
}

.ad-action-item .ask-ai-icon svg {
  width: 24px;
  height: 24px;
}

/* Backdrop --------------------------------------------------------------- */
.ai-prompt-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100029;
  background: rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.ai-prompt-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

/* Popover ---------------------------------------------------------------- */
.ai-prompt-popover {
  --active-accent: #cc785c;
  position: fixed;
  z-index: 100030;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f172a;
}

.ai-prompt-popover.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.ai-prompt-popover-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.08),
    0 24px 48px rgba(0, 0, 0, 0.06);
  outline: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

/* Hero + intro ----------------------------------------------------------- */
@keyframes ai-prompt-connection-pulse {
  0%, 80%, 100% { opacity: 0.35; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.15); }
}

.ai-prompt-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 16px 4px;
}

.ai-prompt-wh-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
}

.ai-prompt-connection {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ai-prompt-connection-dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  animation: ai-prompt-connection-pulse 1.4s ease-in-out infinite;
}

.ai-prompt-connection-dot:nth-child(2) {
  animation-delay: 0.18s;
}

.ai-prompt-connection-dot:nth-child(3) {
  animation-delay: 0.36s;
}

.ai-prompt-hero-provider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  background: color-mix(in srgb, var(--provider-accent, #cc785c) 12%, transparent);
}

.ai-prompt-hero-provider-logo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--provider-accent, #cc785c);
}

.ai-prompt-hero-provider-logo svg {
  width: 22px;
  height: 22px;
}

.ai-prompt-hero-provider-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.ai-prompt-intro {
  text-align: center;
  padding: 8px 16px 10px;
}

.ai-prompt-popover-card--streamlined .ai-prompt-intro {
  padding-bottom: 4px;
}

.ai-prompt-popover-card--streamlined .ai-prompt-input-wrap {
  margin-top: 2px;
}

.ai-prompt-popover-card--streamlined .ai-prompt-templates {
  padding-top: 8px;
}

.ai-prompt-heading {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

.ai-prompt-subtitle {
  margin: 6px auto 0;
  max-width: 360px;
  font-size: 13px;
  font-weight: 500;
  color: #000000;
  line-height: 1.4;
}

.ai-prompt-provider-bar {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  padding: 0 16px 10px;
}

.ai-prompt-provider-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.ai-prompt-provider-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ai-prompt-provider-dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s ease;
}

.ai-prompt-provider-pick.is-active .ai-prompt-provider-dot {
  background: #0f172a;
}

.ai-prompt-provider-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: var(--provider-accent, #111827);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.ai-prompt-provider-btn svg {
  width: 14px;
  height: 14px;
}

.ai-prompt-provider-btn:hover {
  opacity: 0.8;
}

.ai-prompt-provider-pick.is-active .ai-prompt-provider-btn,
.ai-prompt-provider-btn.is-active {
  opacity: 1;
}

.ai-prompt-vline {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  margin: 0 2px 8px;
  flex-shrink: 0;
}

.ai-prompt-icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #000000;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.ai-prompt-icon-btn svg {
  width: 15px;
  height: 15px;
}

.ai-prompt-icon-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ai-prompt-icon-btn.is-copied {
  background: #dcfce7;
  color: #15803d;
}

/* Input ------------------------------------------------------------------ */
.ai-prompt-input-wrap {
  position: relative;
  margin: 0 14px;
  border-radius: 12px;
  background: #f8fafc;
  outline: 1px solid #e5e7eb;
  transition: background 0.15s ease, outline-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-prompt-input-wrap:focus-within {
  background: #fff;
  outline: 2px solid var(--active-accent, #cc785c);
  box-shadow: none;
}

.ai-prompt-popover textarea {
  display: block;
  width: 100%;
  min-height: 80px;
  max-height: 160px;
  border: 0;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
  padding: 11px 46px 11px 13px;
  resize: none;
  outline: none;
  box-shadow: none;
  border-radius: 12px;
}

.ai-prompt-popover textarea:focus,
.ai-prompt-popover textarea:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.ai-prompt-popover textarea::placeholder {
  color: #717c92;
  font-weight: 500;
}

.ai-prompt-send {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: var(--active-accent, #2563eb);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2),
    0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.ai-prompt-send svg {
  width: 15px;
  height: 15px;
}

.ai-prompt-send:hover {
  filter: brightness(1.06);
}

.ai-prompt-send:active {
  transform: scale(0.92);
}

.ai-prompt-send:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Template chips --------------------------------------------------------- */
.ai-prompt-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 12px;
}

.ai-prompt-template {
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  height: 27px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  padding: 0 11px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.ai-prompt-template:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ai-prompt-template:active {
  transform: scale(0.97);
}

/* Footer ----------------------------------------------------------------- */
.ai-prompt-footer {
  border-top: 1px solid #f1f5f9;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-prompt-mcp-card {
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 12px;
  background: #fff;
  outline: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 10px 12px;
  text-decoration: none;
  transition: background 0.15s ease, outline-color 0.15s ease;
}

.ai-prompt-mcp-card:hover {
  background: #f8fafc;
  outline-color: #cbd5e1;
}

.ai-prompt-mcp-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  outline: 1px solid #e5e7eb;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

.ai-prompt-mcp-icon-logo {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  display: block;
  object-fit: cover;
}

.ai-prompt-mcp-text {
  min-width: 0;
  flex: 1;
}

.ai-prompt-mcp-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.ai-prompt-mcp-title em {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #2563eb;
  background: #dbeafe;
  border-radius: 5px;
  padding: 1px 5px;
}

.ai-prompt-mcp-desc {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: #000000;
  line-height: 1.35;
}

.ai-prompt-mcp-arrow {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #5b6b82;
  transition: transform 0.15s ease, color 0.15s ease;
}

.ai-prompt-mcp-card:hover .ai-prompt-mcp-arrow {
  transform: translateX(2px);
  color: #0f172a;
}

.ai-prompt-snapshot {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5b6b82;
}

.ai-prompt-snapshot svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ai-prompt-snapshot span {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive ------------------------------------------------------------- */
@media (max-width: 520px) {
  .ai-prompt-provider-bar {
    flex-wrap: wrap;
    justify-content: center;
  }
}
