/* ---------------------------------------------------------------------------
   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 the ad detail modal grid */
#ad-modal-action-ask-ai .ask-ai-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ai-trigger-accent, #cc785c);
}

#ad-modal-action-ask-ai .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;
}

/* Header ----------------------------------------------------------------- */
.ai-prompt-popover-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 9px;
}

.ai-prompt-title {
  min-width: 0;
  flex: 1;
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.ai-prompt-wh-chip {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #fff;
  outline: 1px solid #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.ai-prompt-wh-chip img {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.ai-prompt-x {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  margin: 0 1px;
}

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

.ai-prompt-provider-btn {
  width: 30px;
  height: 30px;
  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.5;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1);
  transition: opacity 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

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

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

.ai-prompt-provider-btn.is-active {
  opacity: 1;
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px #3b82f6;
}

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

.ai-prompt-icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  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: #16a34a;
}

/* 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-color: transparent;
  box-shadow: 0 0 0 2px var(--active-accent, #3b82f6);
}

.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;
}

.ai-prompt-popover textarea::placeholder {
  color: #94a3b8;
  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 {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #225aea 0%, #1e3a8a 100%);
  color: #fff;
}

.ai-prompt-mcp-icon svg {
  width: 18px;
  height: 18px;
}

.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: #64748b;
  line-height: 1.35;
}

.ai-prompt-mcp-arrow {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #94a3b8;
  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: #94a3b8;
}

.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-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
