/*
 * aura-widget.css — floating Aura assistant widget.
 * Theme-aware (light/dark), mobile-friendly, accessible focus states.
 */
.aura-root {
  --aura-accent: #40d3ff;
  --aura-accent-strong: #6f7dff;
  --aura-bg: #ffffff;
  --aura-fg: #0f172a;
  --aura-muted: #475569;
  --aura-border: rgba(15, 23, 42, 0.12);
  --aura-user-bg: linear-gradient(135deg, #40d3ff, #6f7dff);
  --aura-user-fg: #04121f;
  --aura-aura-bg: #f1f5f9;
  --aura-dock-offset: 20px;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  pointer-events: none;
}

.aura-panel,
.aura-launcher {
  pointer-events: auto;
}

.aura-panel[hidden] {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  .aura-root {
    --aura-bg: #0e1626;
    --aura-fg: #f8fafc;
    --aura-muted: rgba(226, 232, 240, 0.72);
    --aura-border: rgba(148, 163, 184, 0.22);
    --aura-aura-bg: rgba(148, 163, 184, 0.14);
  }
}
:root[data-theme='dark'] .aura-root {
  --aura-bg: #0e1626;
  --aura-fg: #f8fafc;
  --aura-muted: rgba(226, 232, 240, 0.72);
  --aura-border: rgba(148, 163, 184, 0.22);
  --aura-aura-bg: rgba(148, 163, 184, 0.14);
}
:root[data-theme='light'] .aura-root {
  --aura-bg: #ffffff;
  --aura-fg: #0f172a;
  --aura-muted: #475569;
  --aura-border: rgba(15, 23, 42, 0.12);
  --aura-aura-bg: #f1f5f9;
}

/* Premium Aura launcher */
.aura-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 148px;
  min-height: 58px;
  padding: 8px 14px 8px 8px;
  font: inherit;
  color: #f8fafc;
  background:
    linear-gradient(135deg, rgba(7, 17, 31, 0.92), rgba(15, 23, 42, 0.96)) padding-box,
    linear-gradient(135deg, var(--aura-accent), var(--aura-accent-strong)) border-box;
  border: 1px solid transparent;
  border-radius: 999px;
  box-shadow:
    0 18px 42px rgba(2, 6, 23, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

.aura-launcher:hover {
  transform: translateY(-2px);
  box-shadow:
    0 24px 54px rgba(2, 6, 23, 0.44),
    0 0 28px rgba(64, 211, 255, 0.24);
}

.aura-launcher:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(64, 211, 255, 0.5),
    0 24px 54px rgba(2, 6, 23, 0.44);
}

.aura-avatar-shell {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-grid;
  place-items: center;
}

.aura-avatar-glow {
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  background: conic-gradient(
    from 120deg,
    rgba(64, 211, 255, 0.85),
    rgba(111, 125, 255, 0.72),
    rgba(64, 211, 255, 0.85)
  );
  filter: blur(7px);
  opacity: 0.55;
  animation: aura-avatar-breathe 2.8s ease-in-out infinite;
}

.aura-avatar-svg {
  position: relative;
  z-index: 1;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.14),
    0 8px 18px rgba(0, 0, 0, 0.3);
}

.aura-avatar-status {
  position: absolute;
  z-index: 2;
  right: 1px;
  bottom: 2px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #22c55e;
  border: 2px solid #07111f;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
}

.aura-launcher-copy {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.05;
}

.aura-launcher-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.01em;
  color: #ffffff;
}

.aura-launcher-subtitle {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.72);
  white-space: nowrap;
}

@keyframes aura-avatar-breathe {
  0%, 100% {
    opacity: 0.42;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.72;
    transform: scale(1.04);
  }
}

@keyframes aura-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 129, 0.35); }
  70% { box-shadow: 0 0 0 8px rgba(255, 107, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 129, 0); }
}

.aura-root.is-open .aura-launcher {
  display: none;
}

/* Panel */
.aura-panel {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 96px));
  background: var(--aura-bg);
  color: var(--aura-fg);
  border: 1px solid var(--aura-border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.4);
  overflow: hidden;
}

.aura-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--aura-accent), var(--aura-accent-strong));
  color: #04121f;
}
.aura-header-title { font-weight: 700; letter-spacing: 0.02em; }
.aura-close {
  font-size: 22px;
  line-height: 1;
  color: #04121f;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 4px;
}
.aura-close:focus-visible {
  outline: 2px solid #04121f;
  outline-offset: 2px;
  border-radius: 4px;
}

.aura-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aura-msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aura-msg-user { align-items: flex-end; }
.aura-msg-aura { align-items: flex-start; }

.aura-options,
.aura-lead-form,
.aura-confirm-actions {
  max-width: 88%;
}

.aura-msg-aura .aura-options,
.aura-msg-aura .aura-lead-form,
.aura-msg-aura .aura-confirm-actions {
  align-self: flex-start;
}

.aura-msg-user .aura-options,
.aura-msg-user .aura-lead-form,
.aura-msg-user .aura-confirm-actions {
  align-self: flex-end;
}

.aura-bubble {
  max-width: 80%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.aura-msg-user .aura-bubble {
  background: var(--aura-user-bg);
  color: var(--aura-user-fg);
  border-bottom-right-radius: 4px;
}
.aura-msg-aura .aura-bubble {
  background: var(--aura-aura-bg);
  color: var(--aura-fg);
  border-bottom-left-radius: 4px;
}

.aura-confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-left: 2px;
}
.aura-btn {
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--aura-border);
}
.aura-btn-confirm {
  color: #04121f;
  background: linear-gradient(135deg, var(--aura-accent), var(--aura-accent-strong));
  border: none;
}
.aura-btn-cancel {
  color: var(--aura-fg);
  background: transparent;
}
.aura-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.aura-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(64, 211, 255, 0.5);
}

.aura-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.aura-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--aura-fg);
  text-decoration: none;
  background: var(--aura-bg);
  border: 1px solid var(--aura-accent);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.aura-chip:hover {
  background: rgba(64, 211, 255, 0.14);
}
.aura-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(64, 211, 255, 0.5);
}
.aura-chip-primary {
  color: #04121f;
  background: linear-gradient(135deg, var(--aura-accent), var(--aura-accent-strong));
  border: none;
}

.aura-lead-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
}
.aura-lead-input {
  padding: 9px 11px;
  font: inherit;
  color: var(--aura-fg);
  background: var(--aura-bg);
  border: 1px solid var(--aura-border);
  border-radius: 10px;
}
.aura-lead-input:focus-visible {
  outline: none;
  border-color: var(--aura-accent);
  box-shadow: 0 0 0 3px rgba(64, 211, 255, 0.35);
}
.aura-lead-form .aura-btn-confirm { align-self: flex-start; }
.aura-lead-status {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--aura-muted);
}

.aura-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--aura-border);
  background: var(--aura-bg);
}
.aura-input {
  flex: 1 1 auto;
  padding: 10px 12px;
  font: inherit;
  color: var(--aura-fg);
  background: var(--aura-aura-bg);
  border: 1px solid var(--aura-border);
  border-radius: 10px;
}
.aura-input:focus-visible {
  outline: none;
  border-color: var(--aura-accent);
  box-shadow: 0 0 0 3px rgba(64, 211, 255, 0.35);
}
.aura-icon-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--aura-fg);
  background: transparent;
  border: 1px solid var(--aura-border);
  border-radius: 10px;
  cursor: pointer;
}
.aura-icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(64, 211, 255, 0.5);
}
.aura-mic.is-listening {
  background: rgba(255, 107, 129, 0.2);
  border-color: #ff6b81;
  animation: aura-pulse 1.5s infinite;
}
.aura-speaker.is-on {
  background: rgba(64, 211, 255, 0.18);
  border-color: var(--aura-accent);
}

.aura-root.aura-mode-pharmacy,
.aura-root.aura-has-chat-dock {
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

.aura-root.aura-mode-pharmacy .aura-panel,
.aura-root.aura-has-chat-dock .aura-panel {
  height: min(520px, calc(100vh - 150px));
}

@media (max-width: 480px) {
  .aura-root {
    right: 12px;
    bottom: 12px;
  }

  .aura-root.aura-mode-pharmacy,
  .aura-root.aura-has-chat-dock {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .aura-launcher {
    min-width: 116px;
    min-height: 54px;
    padding: 7px 12px 7px 7px;
  }

  .aura-avatar-shell,
  .aura-avatar-svg {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .aura-launcher-subtitle {
    display: none;
  }

  .aura-panel {
    width: min(420px, calc(100vw - 24px));
    height: min(70vh, calc(100vh - 80px));
  }
}

/* -------------------------------------------------------------------------
 * Rich response cards (delivery / summary / tracking status)
 * ---------------------------------------------------------------------- */
.aura-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.aura-card {
  border: 1px solid var(--aura-border);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--aura-bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.aura-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.aura-card-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--aura-fg);
  word-break: break-all;
}
.aura-card-badge {
  flex: none;
  padding: 3px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 999px;
  color: var(--aura-user-fg);
  background: var(--aura-user-bg);
  white-space: nowrap;
}
/* Add-delivery: patient choice + preview cards */
.aura-card-patient-choice,
.aura-card-add-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.aura-card-note-src {
  margin-top: 4px;
  font-size: 0.72rem;
  font-style: italic;
  color: var(--aura-muted, #64748b);
}
.aura-card-btn-select {
  align-self: flex-start;
  margin-top: 4px;
}
.aura-card-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
  padding: 2px 0;
}
.aura-card-label {
  color: var(--aura-muted);
}
.aura-card-value {
  color: var(--aura-fg);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}
.aura-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.aura-card-btn {
  flex: 1 1 auto;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--aura-fg);
  background: var(--aura-bg);
  border: 1px solid var(--aura-accent);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.aura-card-btn:hover {
  background: rgba(64, 211, 255, 0.14);
}
.aura-card-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(64, 211, 255, 0.5);
}
.aura-card-btn-cancel {
  border-color: rgba(220, 38, 38, 0.6);
  color: #dc2626;
}
.aura-card-btn-cancel:hover {
  background: rgba(220, 38, 38, 0.1);
}

/* Summary card grid */
.aura-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.aura-summary-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border-radius: 10px;
  background: var(--aura-aura-bg);
}
.aura-summary-num {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--aura-fg);
}
.aura-summary-label {
  font-size: 0.68rem;
  color: var(--aura-muted);
  text-align: center;
  margin-top: 2px;
}

/* Contextual helper chips shown when Aura repeats itself */
.aura-helper-chips {
  margin-top: 8px;
}

/* Proof / route cards + proof action buttons */
.aura-card-proof .aura-card-value,
.aura-card-route .aura-card-value {
  font-weight: 600;
}
.aura-card-btn-proof {
  border-color: var(--aura-accent-strong);
}

/* Mic button when speech recognition is unsupported: visible but subdued.
   It stays clickable so it can explain why voice input isn't available. */
.aura-mic-unsupported {
  opacity: 0.55;
}
