/* ─── Orca Suite Chat Widget ─────────────────────────────────────────────────
   Palette sourced from index.html CSS custom properties:
     bg deep:   #050B17  (--ink-950)
     bg panel:  #070F1E  (--ink-900)
     bg tile:   #0A1628  (--ink-800)
     accent:    #5B9BFF  (--blue)
     accent2:   #3B82F6  (--blue2)
     mute:      #8AA0C0  (--mute)
     mute2:     #B8C7DD  (--mute2)
     paper:     #E7EEF8  (--paper)
     line:      rgba(148,175,220,0.12)
     line2:     rgba(148,175,220,0.22)
   Font: DM Sans (loaded by the page)
   ─────────────────────────────────────────────────────────────────────────── */

/* ─── Screen-reader only ─────────────────────────────────────────────────── */
.orca-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Launcher button ────────────────────────────────────────────────────── */
.orca-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  height: 52px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;

  background: #5B9BFF;
  color: #050B17;
  box-shadow:
    0 4px 24px -4px rgba(91, 155, 255, 0.55),
    0 0 0 1px rgba(91, 155, 255, 0.35);

  transition:
    transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1),
    background 0.22s ease,
    box-shadow 0.22s ease;
}

.orca-launcher:hover {
  background: #7ab4ff;
  transform: translateY(-2px);
  box-shadow:
    0 8px 32px -6px rgba(91, 155, 255, 0.65),
    0 0 0 1px rgba(91, 155, 255, 0.45);
}

.orca-launcher:focus-visible {
  outline: 2px solid #5B9BFF;
  outline-offset: 3px;
}

.orca-launcher-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.orca-launcher-label {
  line-height: 1;
}

/* ─── Chat panel ─────────────────────────────────────────────────────────── */
.orca-panel {
  position: fixed;
  bottom: 92px;
  right: 28px;
  z-index: 8999;

  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100dvh - 120px);

  display: flex;
  flex-direction: column;

  background: #070F1E;
  border: 1px solid rgba(148, 175, 220, 0.18);
  border-radius: 18px;
  box-shadow:
    0 32px 80px -16px rgba(5, 11, 23, 0.75),
    0 4px 20px -4px rgba(91, 155, 255, 0.12);

  overflow: hidden;
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  color: #E7EEF8;

  /* Hidden by default - shown via JS removing [hidden] */
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition:
    opacity 0.24s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* JS adds this class to trigger entrance */
.orca-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* When [hidden] is removed but --open not yet added, panel is invisible */
.orca-panel:not(.orca-panel--open) {
  pointer-events: none;
}

/* ─── Panel header ───────────────────────────────────────────────────────── */
.orca-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 13px;
  border-bottom: 1px solid rgba(148, 175, 220, 0.12);
  flex-shrink: 0;
  background: rgba(10, 22, 40, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.orca-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #E7EEF8;
  letter-spacing: 0.01em;
}

.orca-panel-icon {
  width: 16px;
  height: 16px;
  color: #5B9BFF;
  flex-shrink: 0;
}

.orca-panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.orca-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: #8AA0C0;
  transition: color 0.18s ease, background 0.18s ease;
  padding: 0;
}

.orca-icon-btn svg {
  width: 15px;
  height: 15px;
}

.orca-icon-btn:hover {
  color: #E7EEF8;
  background: rgba(148, 175, 220, 0.1);
}

.orca-icon-btn:focus-visible {
  outline: 2px solid #5B9BFF;
  outline-offset: 2px;
}

/* ─── Messages area ──────────────────────────────────────────────────────── */
.orca-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 155, 255, 0.2) transparent;
}

.orca-messages::-webkit-scrollbar {
  width: 4px;
}
.orca-messages::-webkit-scrollbar-track {
  background: transparent;
}
.orca-messages::-webkit-scrollbar-thumb {
  background: rgba(91, 155, 255, 0.2);
  border-radius: 99px;
}

/* ─── Bubbles ────────────────────────────────────────────────────────────── */
.orca-bubble {
  display: flex;
  max-width: 88%;
}

.orca-bubble--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.orca-bubble--assistant {
  align-self: flex-start;
}

.orca-bubble-inner {
  padding: 9px 13px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.orca-bubble--user .orca-bubble-inner {
  background: #5B9BFF;
  color: #050B17;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.orca-bubble--assistant .orca-bubble-inner {
  background: rgba(10, 22, 40, 0.85);
  border: 1px solid rgba(148, 175, 220, 0.14);
  color: #B8C7DD;
  border-bottom-left-radius: 4px;
}

/* ─── Thinking indicator ─────────────────────────────────────────────────── */
.orca-thinking .orca-bubble-inner {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
}

.orca-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5B9BFF;
  opacity: 0.4;
  animation: orcaDotPulse 1.2s ease-in-out infinite;
}

.orca-dot:nth-child(2) { animation-delay: 0.2s; }
.orca-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes orcaDotPulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.85); }
  40%            { opacity: 1;   transform: scale(1.1); }
}

/* ─── Notices (error, warn) ──────────────────────────────────────────────── */
.orca-notice {
  align-self: flex-start;
  max-width: 90%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
}

.orca-notice--error {
  background: rgba(232, 100, 100, 0.08);
  border: 1px solid rgba(232, 100, 100, 0.25);
  color: #e89b9b;
}

.orca-notice--warn {
  background: rgba(201, 180, 122, 0.08);
  border: 1px solid rgba(201, 180, 122, 0.22);
  color: #C9B47A;
}

.orca-notice-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.orca-notice-link:hover {
  opacity: 0.85;
}

/* ─── Quick links bar ────────────────────────────────────────────────────── */
.orca-quick-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-top: 1px solid rgba(148, 175, 220, 0.09);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.orca-quick-link {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 175, 220, 0.2);
  background: transparent;
  color: #8AA0C0;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

.orca-quick-link:hover {
  border-color: rgba(91, 155, 255, 0.5);
  color: #E7EEF8;
  background: rgba(91, 155, 255, 0.08);
}

.orca-quick-link:focus-visible {
  outline: 2px solid #5B9BFF;
  outline-offset: 2px;
}

.orca-quick-demo {
  border-color: rgba(91, 155, 255, 0.3);
  color: #5B9BFF;
}

.orca-quick-demo:hover {
  background: rgba(91, 155, 255, 0.12);
}

/* ─── Input area ─────────────────────────────────────────────────────────── */
.orca-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(148, 175, 220, 0.12);
  flex-shrink: 0;
  background: rgba(7, 15, 30, 0.7);
}

.orca-textarea {
  flex: 1;
  resize: none;
  background: rgba(10, 22, 40, 0.7);
  border: 1px solid rgba(148, 175, 220, 0.18);
  border-radius: 12px;
  color: #E7EEF8;
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 9px 12px;
  min-height: 38px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 155, 255, 0.2) transparent;
}

.orca-textarea::placeholder {
  color: #4E647E;
}

.orca-textarea:focus {
  border-color: rgba(91, 155, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 155, 255, 0.1);
}

.orca-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.orca-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  background: #5B9BFF;
  color: #050B17;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
  padding: 0;
}

.orca-send-btn svg {
  width: 16px;
  height: 16px;
}

.orca-send-btn:hover {
  background: #7ab4ff;
  transform: translateY(-1px);
}

.orca-send-btn:active {
  transform: translateY(0);
}

.orca-send-btn:focus-visible {
  outline: 2px solid #5B9BFF;
  outline-offset: 3px;
}

.orca-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ─── Email capture bar ──────────────────────────────────────────────────── */
.orca-capture-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-top: 1px solid rgba(148, 175, 220, 0.12);
  background: rgba(5, 11, 23, 0.45);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.orca-capture-label {
  font-size: 11.5px;
  color: #8AA0C0;
  white-space: nowrap;
  flex-shrink: 0;
}

.orca-capture-input {
  flex: 1;
  min-width: 120px;
  height: 28px;
  padding: 0 9px;
  background: rgba(10, 22, 40, 0.7);
  border: 1px solid rgba(148, 175, 220, 0.2);
  border-radius: 6px;
  color: #E7EEF8;
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.orca-capture-input::placeholder {
  color: #4E647E;
}

.orca-capture-input:focus {
  border-color: rgba(91, 155, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(91, 155, 255, 0.1);
}

.orca-capture-send {
  height: 28px;
  padding: 0 11px;
  background: #5B9BFF;
  color: #050B17;
  border: none;
  border-radius: 6px;
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.18s ease, transform 0.18s ease;
}

.orca-capture-send:hover {
  background: #7ab4ff;
  transform: translateY(-1px);
}

.orca-capture-send:focus-visible {
  outline: 2px solid #5B9BFF;
  outline-offset: 2px;
}

.orca-capture-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #4E647E;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  transition: color 0.18s ease;
}

.orca-capture-dismiss:hover {
  color: #8AA0C0;
}

.orca-capture-dismiss:focus-visible {
  outline: 2px solid #5B9BFF;
  outline-offset: 2px;
}

/* ─── Disclaimer ─────────────────────────────────────────────────────────── */
.orca-disclaimer {
  margin: 0;
  padding: 5px 14px 8px;
  font-size: 10.5px;
  color: #4E647E;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

/* ─── Mobile responsive ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .orca-launcher {
    bottom: 18px;
    right: 16px;
    height: 48px;
    padding: 0 16px;
    font-size: 13.5px;
  }

  .orca-panel {
    bottom: 78px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: 100%;
    height: calc(100dvh - 110px);
    max-height: none;
    border-radius: 16px;
  }
}

/* ─── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .orca-launcher,
  .orca-panel,
  .orca-quick-link,
  .orca-send-btn,
  .orca-icon-btn,
  .orca-textarea {
    transition: none !important;
  }

  .orca-dot {
    animation: none !important;
    opacity: 0.6;
  }

  .orca-panel--open {
    opacity: 1 !important;
    transform: none !important;
  }
}
