/*
 * aurora.css — Aurora (atendente virtual do Auroria Shard)
 *
 * Componente isolado. Usa os tokens globais definidos em auroria.css
 * (--gold-*, --teal*, --bg-*, --txt-*, --ff-*).
 *
 * Componentes:
 *   .aurora-card / .aurora-card-header / .aurora-card-body
 *   .aurora-chat                — área rolável das mensagens
 *   .aurora-msg                 — bloco de uma mensagem (avatar + bubble)
 *   .aurora-msg-bubble          — balão de texto
 *   .aurora-typing              — indicador "digitando..."
 *   .aurora-suggestions         — chips de pergunta sugerida
 *   .aurora-form / .aurora-input / .aurora-send-btn
 *   .aurora-meta                — barra inferior (contador + cooldown)
 */

/* ============================================================
 * 1. CARD
 * ============================================================ */
.aurora-card {
  overflow: hidden;
}

.aurora-card-header {
  align-items: center;
  gap: 0.85rem !important;
}

.aurora-avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(240, 210, 114, 0.75) 0%, rgba(201, 150, 42, 0.45) 35%, rgba(106, 74, 12, 0.15) 70%, transparent 100%),
    linear-gradient(160deg, #1a2a4a 0%, #131f38 100%);
  border: 1px solid rgba(201, 150, 42, 0.45);
  box-shadow:
    0 0 18px rgba(201, 150, 42, 0.35),
    inset 0 1px 0 rgba(245, 233, 196, 0.18);
  color: var(--gold-light);
  font-size: 1.15rem;
  text-shadow: 0 0 8px rgba(201, 150, 42, 0.6);
  position: relative;
}
.aurora-avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(201, 150, 42, 0.22);
  animation: aurora-ring 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes aurora-ring {
  0%, 100% { transform: scale(1);    opacity: 0.5; }
  50%      { transform: scale(1.12); opacity: 0.95; }
}

.aurora-header-stack {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.aurora-title {
  margin: 0 !important;
  line-height: 1.1;
}

.aurora-subtitle {
  margin: 0;
  font-family: var(--ff-head);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--txt-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.aurora-online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 6px var(--online-glow);
  margin-left: 0.2rem;
  animation: aurora-pulse-online 1.8s ease-in-out infinite;
}
.aurora-online-text {
  font-size: 0.65rem;
  color: var(--online);
  letter-spacing: 0.16em;
}
@keyframes aurora-pulse-online {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

.aurora-clear-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(7, 12, 24, 0.55);
  border: 1px solid rgba(30, 46, 78, 0.7);
  color: var(--txt-muted);
  font-family: var(--ff-head);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s, box-shadow .18s;
}
.aurora-clear-btn:hover {
  color: var(--gold-light);
  border-color: rgba(201, 150, 42, 0.55);
  background: rgba(13, 22, 40, 0.75);
  box-shadow: 0 0 12px rgba(201, 150, 42, 0.18);
}
.aurora-clear-btn:active { transform: translateY(1px); }

.aurora-card-body {
  padding: 1rem 1.1rem 1rem 1.1rem !important;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.aurora-debug-flag { font-size: .8rem; padding: .55rem .75rem; }

/* ============================================================
 * 2. CHAT FEED
 * ============================================================ */
.aurora-chat {
  position: relative;
  flex: 1 1 auto;
  min-height: 360px;
  max-height: 58vh;
  overflow-y: auto;
  padding: 0.85rem 0.7rem 0.6rem 0.7rem;
  background:
    linear-gradient(180deg, rgba(7, 12, 24, 0.85) 0%, rgba(13, 22, 40, 0.55) 100%);
  border: 1px solid rgba(30, 46, 78, 0.65);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 2px 14px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(201, 150, 42, 0.05);
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 150, 42, 0.35) transparent;
}
.aurora-chat::-webkit-scrollbar { width: 7px; }
.aurora-chat::-webkit-scrollbar-track { background: transparent; }
.aurora-chat::-webkit-scrollbar-thumb {
  background: rgba(201, 150, 42, 0.35);
  border-radius: 4px;
}
.aurora-chat::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 150, 42, 0.55);
}

/* ============================================================
 * 3. MESSAGE BUBBLES
 * ============================================================ */
.aurora-msg {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  margin: 0.55rem 0;
  animation: aurora-msg-in .22s cubic-bezier(.22,1,.36,1) both;
}
@keyframes aurora-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.aurora-msg-assistant { justify-content: flex-start; }
.aurora-msg-user      { justify-content: flex-end; }

.aurora-msg-avatar {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(240, 210, 114, 0.55) 0%, rgba(106, 74, 12, 0.18) 65%, transparent 100%),
    linear-gradient(160deg, #1a2a4a 0%, #131f38 100%);
  border: 1px solid rgba(201, 150, 42, 0.4);
  box-shadow: 0 0 10px rgba(201, 150, 42, 0.25);
  color: var(--gold-light);
  font-size: 0.85rem;
}

.aurora-msg-bubble {
  max-width: 78%;
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  font-family: var(--ff-body);
  font-size: 0.95rem;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  position: relative;
}

.aurora-msg-assistant .aurora-msg-bubble {
  background: linear-gradient(160deg, rgba(19, 31, 56, 0.95) 0%, rgba(13, 22, 40, 0.95) 100%);
  border: 1px solid rgba(30, 46, 78, 0.85);
  color: var(--txt-parchment);
  border-bottom-left-radius: 4px;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(201, 150, 42, 0.06);
}

.aurora-msg-user .aurora-msg-bubble {
  background: linear-gradient(160deg, rgba(106, 74, 12, 0.55) 0%, rgba(74, 50, 8, 0.85) 100%);
  border: 1px solid rgba(201, 150, 42, 0.45);
  color: var(--gold-glow);
  border-bottom-right-radius: 4px;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(245, 233, 196, 0.08);
}

.aurora-msg-bubble p { margin: 0 0 0.55rem; }
.aurora-msg-bubble p:last-child { margin-bottom: 0; }
.aurora-msg-bubble ul,
.aurora-msg-bubble ol {
  margin: 0.25rem 0 0.55rem 1.15rem;
  padding: 0;
}
.aurora-msg-bubble li { margin: 0.15rem 0; }
.aurora-msg-bubble strong { color: var(--gold-light); }
.aurora-msg-bubble a {
  color: var(--gold-bright);
  text-decoration: underline;
  text-decoration-color: rgba(201, 150, 42, 0.35);
  text-underline-offset: 2px;
  transition: color .18s, text-decoration-color .18s;
}
.aurora-msg-bubble a:hover {
  color: var(--gold-glow);
  text-decoration-color: var(--gold-bright);
}
.aurora-msg-bubble code {
  font-family: ui-monospace, "Fira Mono", "Courier New", monospace;
  font-size: 0.85em;
  background: rgba(7, 12, 24, 0.7);
  border: 1px solid rgba(30, 46, 78, 0.6);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  color: var(--gold-light);
}

/* ============================================================
 * 4. WELCOME / SUGGESTIONS
 * ============================================================ */
.aurora-msg-welcome .aurora-msg-bubble { max-width: 100%; }

.aurora-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px dashed rgba(201, 150, 42, 0.22);
}

.aurora-suggestion {
  font-family: var(--ff-head);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: none;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  background: rgba(7, 12, 24, 0.6);
  border: 1px solid rgba(201, 150, 42, 0.35);
  color: var(--gold-light);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s, transform .12s, box-shadow .18s;
}
.aurora-suggestion:hover {
  color: var(--gold-glow);
  border-color: var(--gold-bright);
  background: rgba(13, 22, 40, 0.85);
  box-shadow: 0 0 12px rgba(201, 150, 42, 0.25);
}
.aurora-suggestion:active { transform: translateY(1px); }

/* ============================================================
 * 5. TYPING INDICATOR
 * ============================================================ */
.aurora-typing-wrap .aurora-msg-bubble {
  padding: 0.7rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}
.aurora-typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 6px rgba(201, 150, 42, 0.45);
  opacity: 0.4;
  animation: aurora-typing-bounce 1.2s ease-in-out infinite;
}
.aurora-typing-dot:nth-child(2) { animation-delay: .15s; }
.aurora-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes aurora-typing-bounce {
  0%, 80%, 100% { transform: translateY(0);    opacity: 0.4; }
  40%           { transform: translateY(-4px); opacity: 1;   }
}

/* ============================================================
 * 6. INPUT FORM
 * ============================================================ */
.aurora-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.aurora-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem 0.45rem 0.85rem;
  background: rgba(7, 12, 24, 0.92);
  border: 1px solid var(--border-main);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(201, 150, 42, 0.04);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.aurora-input-wrap:focus-within {
  border-color: var(--gold);
  background: rgba(10, 16, 30, 0.95);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(201, 150, 42, 0.22),
    0 0 14px rgba(26, 144, 144, 0.14);
}

.aurora-input {
  flex: 1 1 auto;
  min-height: 1.6rem;
  max-height: 9rem;
  background: transparent;
  border: 0;
  color: var(--txt-parchment);
  font-family: var(--ff-body);
  font-size: 1rem;
  line-height: 1.45;
  padding: 0.35rem 0;
  resize: none;
  outline: none;
}
.aurora-input::placeholder {
  color: var(--txt-dim);
  font-style: italic;
}

.aurora-send-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(201, 150, 42, 0.6);
  border-radius: var(--r-sm);
  background:
    linear-gradient(180deg, var(--gold-cta-top) 0%, var(--gold-cta-mid) 60%, var(--gold-cta-bottom) 100%);
  color: #1c1208;
  font-size: 1rem;
  cursor: pointer;
  box-shadow:
    0 2px 10px rgba(201, 150, 42, 0.35),
    inset 0 1px 0 rgba(255, 245, 210, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35);
  transition: transform .12s, box-shadow .18s, filter .18s;
}
.aurora-send-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow:
    0 3px 14px rgba(201, 150, 42, 0.5),
    inset 0 1px 0 rgba(255, 245, 210, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}
.aurora-send-btn:active:not(:disabled) { transform: translateY(1px); }
.aurora-send-btn:disabled {
  filter: grayscale(0.6) brightness(0.65);
  cursor: not-allowed;
  box-shadow: none;
}

/* ============================================================
 * 7. META BAR (counter + cooldown)
 * ============================================================ */
.aurora-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-family: var(--ff-head);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--txt-muted);
}

.aurora-meta-left,
.aurora-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.aurora-meta-sep { color: var(--txt-dim); }

.aurora-counter {
  font-variant-numeric: tabular-nums;
  color: var(--txt-muted);
}
.aurora-counter.is-warning { color: var(--gold-light); }
.aurora-counter.is-danger  { color: #e07878; }

.aurora-cooldown-info {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  color: var(--gold-light);
}
.aurora-cooldown-info i { color: var(--gold-bright); }

.aurora-ready-info {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  color: var(--online);
}
.aurora-ready-info i { color: var(--online); }

.aurora-meta-hint {
  color: var(--txt-dim);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
}

/* ============================================================
 * 8. ERROR + FOOTNOTE
 * ============================================================ */
.aurora-error {
  margin: 0;
  font-size: 0.85rem;
}

.aurora-footnote {
  font-family: var(--ff-head);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--txt-dim);
  text-align: center;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(30, 46, 78, 0.6);
}
.aurora-footnote a { color: var(--gold-light); }

/* ============================================================
 * 9. RESPONSIVE
 * ============================================================ */
@media (max-width: 575.98px) {
  .aurora-card-body { padding: 0.8rem 0.7rem !important; gap: 0.7rem; }
  .aurora-avatar { width: 36px; height: 36px; font-size: 1rem; }
  .aurora-msg-bubble { max-width: 86%; font-size: 0.9rem; }
  .aurora-meta-hint { display: none; }
  .aurora-chat { min-height: 320px; max-height: 60vh; padding: 0.65rem 0.55rem; }
}

/* ============================================================
 * 10. CONSENT MODAL (pré-uso)
 * ============================================================ */
.aurora-consent-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.aurora-consent-modal[hidden] { display: none !important; }

.aurora-consent-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(13, 22, 44, 0.78) 0%, rgba(5, 9, 19, 0.92) 60%, rgba(2, 4, 9, 0.96) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.aurora-consent-dialog {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: linear-gradient(160deg, #131f38 0%, #0e1830 100%);
  border: 1px solid rgba(201, 150, 42, 0.4);
  border-radius: 16px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(245, 233, 196, 0.04) inset,
    0 0 30px rgba(201, 150, 42, 0.18);
  color: var(--txt-base, #e7e2cf);
  animation: aurora-consent-pop 0.28s ease-out;
}

@keyframes aurora-consent-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.aurora-consent-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.05rem 1.25rem;
  border-bottom: 1px solid rgba(201, 150, 42, 0.18);
  background: linear-gradient(180deg, rgba(201, 150, 42, 0.08) 0%, transparent 100%);
}

.aurora-consent-headtxt { line-height: 1.15; }

.aurora-consent-title {
  margin: 0 0 0.15rem 0;
  font-family: var(--ff-head, serif);
  font-size: 1.18rem;
  letter-spacing: 0.02em;
  color: var(--gold-light, #f0d272);
  text-shadow: 0 0 10px rgba(201, 150, 42, 0.35);
}

.aurora-consent-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: var(--txt-muted, #9aa3b8);
  letter-spacing: 0.04em;
}

.aurora-consent-body {
  padding: 1rem 1.25rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.aurora-consent-callout {
  background: rgba(255, 196, 78, 0.08);
  border: 1px solid rgba(255, 196, 78, 0.28);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  color: #f5e9c4;
}
.aurora-consent-callout a { color: var(--gold-light, #f0d272); }

.aurora-consent-h3 {
  margin: 1.1rem 0 0.4rem;
  font-family: var(--ff-head, serif);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: var(--gold-light, #f0d272);
  text-transform: uppercase;
}

.aurora-consent-list {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.15rem;
  color: var(--txt-base, #e7e2cf);
}
.aurora-consent-list li { margin: 0.18rem 0; }

.aurora-consent-p {
  margin: 0.25rem 0 0.5rem;
  color: var(--txt-base, #e7e2cf);
}

.aurora-consent-small {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  color: var(--txt-muted, #9aa3b8);
}

.aurora-consent-form {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.aurora-consent-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  background: rgba(13, 22, 44, 0.55);
  border: 1px solid rgba(201, 150, 42, 0.18);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  font-size: 0.88rem;
  color: var(--txt-base, #e7e2cf);
}
.aurora-consent-check:hover {
  border-color: rgba(201, 150, 42, 0.45);
  background: rgba(20, 32, 60, 0.7);
}
.aurora-consent-check input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 0.18rem;
  accent-color: var(--gold-light, #f0d272);
  width: 1.05rem;
  height: 1.05rem;
}

.aurora-consent-error {
  margin: 0;
  font-size: 0.85rem;
}

.aurora-consent-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.aurora-consent-cancel {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--txt-muted, #9aa3b8);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.aurora-consent-cancel:hover {
  color: var(--txt-base, #e7e2cf);
  border-bottom-color: rgba(154, 163, 184, 0.55);
}

.aurora-consent-accept {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(201, 150, 42, 0.55);
  background: linear-gradient(180deg, rgba(240, 210, 114, 0.95) 0%, rgba(201, 150, 42, 0.95) 100%);
  color: #1a1004;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
  box-shadow: 0 6px 18px rgba(201, 150, 42, 0.3);
}
.aurora-consent-accept:hover:not(:disabled) { filter: brightness(1.08); }
.aurora-consent-accept:active:not(:disabled) { transform: translateY(1px); }
.aurora-consent-accept:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
  box-shadow: none;
}

/* Bloqueio visual do chat enquanto o modal está aberto */
.aurora-card[data-aurora-locked="1"] {
  position: relative;
}
.aurora-card[data-aurora-locked="1"]::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(5, 9, 19, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: none;
  z-index: 1;
}

@media (max-width: 575.98px) {
  .aurora-consent-header { padding: 0.85rem 1rem; }
  .aurora-consent-body { padding: 0.85rem 1rem 1rem; font-size: 0.88rem; }
  .aurora-consent-title { font-size: 1.05rem; }
  .aurora-consent-actions { justify-content: stretch; }
  .aurora-consent-accept { width: 100%; justify-content: center; }
  .aurora-consent-cancel { width: 100%; justify-content: center; }
}
