/* Oracle Campaign Copilot panel polish. Scoped to the existing workspace ID. */
#campaign-copilot-chat {
  width: min(520px, calc(100vw - 3rem)) !important;
  height: min(760px, calc(100vh - 2rem));
  max-height: none !important;
}

#campaign-copilot-chat > div:first-child {
  padding: 1.25rem;
}

.campaign-copilot-change-highlight {
  animation: campaign-copilot-change-pulse 2.4s ease-out;
}

@keyframes campaign-copilot-change-pulse {
  0%, 30% {
    box-shadow: 0 0 0 2px rgb(251 146 60 / 0.9), 0 0 32px rgb(249 115 22 / 0.28);
    background-color: rgb(249 115 22 / 0.08);
  }
  100% {
    box-shadow: 0 0 0 0 rgb(251 146 60 / 0);
    background-color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .campaign-copilot-change-highlight {
    animation: none;
    box-shadow: 0 0 0 2px rgb(251 146 60 / 0.75);
  }
}

#campaign-copilot-chat [aria-label="Suggested campaign revision messages"] {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  overflow: visible !important;
  padding: 0.75rem 1rem;
}

#campaign-copilot-chat [aria-label="Suggested campaign revision messages"] > button {
  min-width: 0;
  white-space: normal;
  text-align: left;
  line-height: 1.35;
  border-radius: 0.75rem;
  padding: 0.625rem 0.75rem;
}

#campaign-copilot-chat [aria-label="Suggested campaign revision messages"] > button:focus-visible,
#campaign-copilot-chat textarea:focus-visible,
#campaign-copilot-chat button:focus-visible {
  outline: 2px solid rgb(253 186 116 / 0.8);
  outline-offset: 2px;
}

/* Keep the approval explanation full-width instead of crushing it beside the CTA. */
#campaign-copilot-chat > div:last-child > div:first-child {
  display: flex !important;
  flex-direction: column;
  align-items: stretch !important;
  gap: 0.75rem;
}

#campaign-copilot-chat > div:last-child > div:first-child > div:first-child {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 0.75rem;
  background: rgb(255 255 255 / 0.025);
}

#campaign-copilot-chat > div:last-child > div:first-child > div:first-child p:first-child {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

#campaign-copilot-chat > div:last-child > div:first-child > div:first-child p:last-child {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1.125rem;
  color: rgb(255 255 255 / 0.42);
}

#campaign-copilot-chat > div:last-child > div:first-child > div:last-child {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  width: 100%;
  gap: 0.5rem;
}

#campaign-copilot-chat > div:last-child > div:first-child > div:last-child > button:first-child:nth-last-child(3) {
  grid-column: 1 / -1;
  width: 100%;
}

#campaign-copilot-chat > div:last-child > div:first-child > div:last-child > button:nth-last-child(2) {
  min-width: 5.5rem;
  padding: 0.625rem 1rem;
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 0.75rem;
}

#campaign-copilot-chat > div:last-child > div:first-child > div:last-child > button:last-child {
  width: 100%;
  min-width: 0;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
}

@media (min-width: 640px) and (max-height: 640px) {
  #campaign-copilot-chat {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  #campaign-copilot-chat > div:nth-child(2) {
    flex: 0 0 auto;
    min-height: 4rem;
    max-height: 8rem;
    overflow-y: auto;
  }

  #campaign-copilot-chat [aria-label="Suggested campaign revision messages"] {
    max-height: 7rem;
    overflow-y: auto !important;
  }
}

@media (max-width: 639px) {
  #campaign-copilot-chat {
    width: auto !important;
    height: auto;
    max-height: calc(100vh - 1.5rem) !important;
    overflow-y: auto !important;
  }

  #campaign-copilot-chat > div:nth-child(2) {
    flex: 0 0 auto;
    max-height: 12rem;
    overflow-y: auto;
  }

  #campaign-copilot-chat > div:first-child {
    padding: 1rem;
  }

  #campaign-copilot-chat [aria-label="Suggested campaign revision messages"] {
    grid-template-columns: 1fr;
    max-height: 8rem;
    overflow-y: auto !important;
  }

  #campaign-copilot-chat > div:last-child > div:first-child > div:last-child {
    grid-template-columns: 1fr;
  }

  #campaign-copilot-chat > div:last-child > div:first-child > div:last-child > button {
    grid-column: 1 !important;
    width: 100%;
  }
}
