/* ── NORA Chat Widget ──────────────────────────────────────────────────────── */

#nora-root {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Toggle button ── */
#nora-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #bd3033;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(189, 48, 51, .38);
  transition: background .2s, transform .15s, box-shadow .2s;
  position: relative;
  z-index: 2;
  margin-left: auto;
}
#nora-toggle:hover {
  background: #8d2225;
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(189, 48, 51, .45);
}
#nora-toggle:active { transform: scale(.97) }

/* ── Chat window ── */
#nora-window {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 348px;
  max-height: 540px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .08);
  border: 1px solid #ede8e0;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: nora-pop .2s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes nora-pop {
  from { opacity: 0; transform: scale(.85) translateY(8px) }
  to   { opacity: 1; transform: scale(1) translateY(0) }
}
@media (max-width: 420px) {
  #nora-window {
    width: calc(100vw - 2rem);
    right: 0;
    left: auto;
  }
  #nora-root { right: 1rem; bottom: 1rem }
}

/* ── Header ── */
#nora-head {
  background: linear-gradient(135deg, #bd3033 0%, #8d2225 100%);
  color: #fff;
  padding: .9rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
#nora-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  border: 1.5px solid rgba(255, 255, 255, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  flex-shrink: 0;
  color: #fff;
  letter-spacing: .02em;
}
#nora-head-info { flex: 1 }
#nora-name {
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.2;
}
#nora-status {
  font-size: .7rem;
  opacity: .72;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: .35rem;
}
#nora-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

/* ── Messages ── */
#nora-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  scroll-behavior: smooth;
}
#nora-messages::-webkit-scrollbar { width: 4px }
#nora-messages::-webkit-scrollbar-track { background: transparent }
#nora-messages::-webkit-scrollbar-thumb { background: #e0d8d0; border-radius: 2px }

.nora-msg { display: flex; animation: nora-msg-in .18s ease }
@keyframes nora-msg-in {
  from { opacity: 0; transform: translateY(6px) }
  to   { opacity: 1; transform: translateY(0) }
}
.nora-user      { justify-content: flex-end }
.nora-assistant { justify-content: flex-start }

.nora-bubble {
  max-width: 84%;
  padding: .55rem .85rem;
  border-radius: 16px;
  font-size: .82rem;
  line-height: 1.55;
  word-break: break-word;
}
.nora-user .nora-bubble {
  background: #bd3033;
  color: #fff;
  border-bottom-right-radius: 5px;
}
.nora-assistant .nora-bubble {
  background: #f4f0ea;
  color: #1f1b18;
  border-bottom-left-radius: 5px;
}

/* ── Typing dots ── */
.nora-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: .1rem 0;
}
.nora-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9b8b7f;
  animation: nora-bounce 1.1s infinite ease-in-out;
}
.nora-dots span:nth-child(2) { animation-delay: .18s }
.nora-dots span:nth-child(3) { animation-delay: .36s }
@keyframes nora-bounce {
  0%, 80%, 100% { transform: scale(.65); opacity: .45 }
  40%           { transform: scale(1);   opacity: 1 }
}

/* ── Input form ── */
#nora-form {
  padding: .65rem .85rem;
  border-top: 1px solid #ede8e0;
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  flex-shrink: 0;
  background: #faf8f5;
}
#nora-input {
  flex: 1;
  resize: none;
  border: 1.5px solid #ddd8d0;
  border-radius: 12px;
  padding: .45rem .7rem;
  font-size: .82rem;
  font-family: inherit;
  outline: none;
  line-height: 1.45;
  max-height: 120px;
  transition: border-color .2s;
  background: #fff;
  color: #1f1b18;
}
#nora-input:focus { border-color: #bd3033 }
#nora-input::placeholder { color: #b0a89e }

#nora-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #c9a14a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background .2s, transform .15s;
}
#nora-send:hover   { background: #a8842f; transform: scale(1.07) }
#nora-send:active  { transform: scale(.95) }
#nora-send:disabled { opacity: .45; cursor: not-allowed; transform: none }
