/* =============================================================================
   NyViA Concierge: Beekman Pretoria — Architectural Light edition.
   Minimalist, gallery-grade. White surfaces, obsidian ink, signal-red accent.
   DOM hooks remain compatible with nyvia.js.
   ========================================================================== */

:root {
  --nv-ink: #111111;
  --nv-graphite: #52525B;
  --nv-mist: #A1A1AA;
  --nv-platinum: #E5E5E5;
  --nv-snow: #F4F4F5;
  --nv-white: #FFFFFF;
  --nv-red: #C8102E;
  --nv-red-deep: #9E0C24;
  --nv-shadow-1: 0 4px 16px rgba(17, 17, 17, 0.08);
  --nv-shadow-2: 0 24px 64px rgba(17, 17, 17, 0.14);
}

/* ---- Bubble trigger ----------------------------------------------------- */
.nyvia-bubble {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 600;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--nv-ink);
  color: var(--nv-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--nv-shadow-2), 0 0 0 0 rgba(200, 16, 46, 0);
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0.16, 1),
              box-shadow 220ms ease,
              background 220ms ease;
  border: 0;
  animation: nv-pulse 3s ease-in-out infinite;
}
.nyvia-bubble:hover {
  transform: scale(1.06);
  background: var(--nv-red);
  box-shadow: var(--nv-shadow-2), 0 0 0 8px rgba(200, 16, 46, 0.12);
  animation: none;
}
.nyvia-bubble:focus-visible {
  outline: 2px solid var(--nv-red);
  outline-offset: 4px;
}
.nyvia-bubble svg { width: 24px; height: 24px; fill: currentColor; }
.nyvia-bubble__badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  background: var(--nv-red);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: var(--nv-white);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--nv-white);
}
.nyvia-bubble__badge.is-hidden { display: none; }
@keyframes nv-pulse {
  0%, 100% { box-shadow: var(--nv-shadow-2), 0 0 0 0 rgba(200, 16, 46, 0); }
  50%      { box-shadow: var(--nv-shadow-2), 0 0 0 14px rgba(200, 16, 46, 0); }
}

/* ---- Widget panel ------------------------------------------------------- */
.nyvia-widget {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  z-index: 599;
  width: min(380px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 8rem));
  display: flex;
  flex-direction: column;
  background: var(--nv-white);
  border: 1px solid var(--nv-platinum);
  border-radius: 12px;
  box-shadow: var(--nv-shadow-2);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--nv-ink);
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 220ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 220ms;
}
.nyvia-widget.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  transition: opacity 220ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}

/* ---- Header ------------------------------------------------------------- */
.nyvia-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  background: var(--nv-ink);
  color: var(--nv-white);
}
.nyvia-header__left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.nyvia-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--nv-red);
  color: var(--nv-white);
  display: grid;
  place-items: center;
  font-family: 'Anton', 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nyvia-header__name {
  font-family: 'Anton', 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}
.nyvia-header__status {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 3px;
}
.nyvia-header__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}
.nyvia-header__actions { display: flex; align-items: center; gap: 0.35rem; }
.nyvia-header__wa,
.nyvia-header__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--nv-white);
  border: 0;
  cursor: pointer;
  transition: background 160ms ease;
}
.nyvia-header__wa:hover { background: #25D366; }
.nyvia-header__close:hover { background: var(--nv-red); }
.nyvia-header__wa svg,
.nyvia-header__close svg { width: 16px; height: 16px; }

/* ---- Messages ----------------------------------------------------------- */
.nyvia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--nv-snow);
  scrollbar-width: thin;
  scrollbar-color: var(--nv-platinum) transparent;
}
.nyvia-messages::-webkit-scrollbar { width: 6px; }
.nyvia-messages::-webkit-scrollbar-thumb { background: var(--nv-platinum); border-radius: 3px; }

.nyvia-msg {
  max-width: 84%;
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: nv-msg-in 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes nv-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nyvia-msg--bot {
  background: var(--nv-white);
  color: var(--nv-ink);
  border: 1px solid var(--nv-platinum);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.nyvia-msg--user {
  background: var(--nv-ink);
  color: var(--nv-white);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.nyvia-msg a { color: var(--nv-red); text-decoration: underline; text-underline-offset: 2px; }
.nyvia-msg--bot strong { font-weight: 700; color: var(--nv-ink); }

.nyvia-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 0.7rem 0.95rem;
  background: var(--nv-white);
  border: 1px solid var(--nv-platinum);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.nyvia-typing span {
  width: 6px;
  height: 6px;
  background: var(--nv-mist);
  border-radius: 50%;
  animation: nv-typing 1.2s ease-in-out infinite;
}
.nyvia-typing span:nth-child(2) { animation-delay: 0.15s; }
.nyvia-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes nv-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Quick chips -------------------------------------------------------- */
.nyvia-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.nyvia-chip {
  padding: 0.4rem 0.75rem;
  background: var(--nv-white);
  border: 1px solid var(--nv-platinum);
  color: var(--nv-graphite);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 160ms ease;
}
.nyvia-chip:hover {
  background: var(--nv-ink);
  color: var(--nv-white);
  border-color: var(--nv-ink);
}

/* ---- Input area --------------------------------------------------------- */
.nyvia-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1rem 1rem;
  background: var(--nv-white);
  border-top: 1px solid var(--nv-platinum);
}
.nyvia-input {
  flex: 1;
  padding: 0.7rem 0.95rem;
  background: var(--nv-snow);
  border: 1px solid var(--nv-platinum);
  border-radius: 999px;
  color: var(--nv-ink);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease;
}
.nyvia-input::placeholder { color: var(--nv-mist); }
.nyvia-input:focus { border-color: var(--nv-ink); background: var(--nv-white); }

.nyvia-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--nv-ink);
  color: var(--nv-white);
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 160ms ease, transform 160ms ease;
}
.nyvia-send-btn:hover { background: var(--nv-red); transform: scale(1.05); }
.nyvia-send-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ---- Proactive nudge ---------------------------------------------------- */
.nyvia-proactive {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  z-index: 598;
  max-width: 280px;
  padding: 0.85rem 2rem 0.85rem 1rem;
  background: var(--nv-white);
  border: 1px solid var(--nv-platinum);
  border-radius: 12px;
  box-shadow: var(--nv-shadow-1);
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--nv-graphite);
  cursor: pointer;
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 220ms ease, transform 220ms ease, visibility 0s linear 220ms;
}
.nyvia-proactive.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity 220ms ease, transform 220ms ease, visibility 0s linear 0s;
}
.nyvia-proactive .text-accent { color: var(--nv-red); font-weight: 600; }
.nyvia-proactive__close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--nv-mist);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.nyvia-proactive__close:hover { background: var(--nv-snow); color: var(--nv-ink); }

/* ---- Mobile ------------------------------------------------------------- */
@media (max-width: 480px) {
  .nyvia-widget {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    height: min(540px, calc(100vh - 6rem));
    bottom: 5rem;
  }
  .nyvia-bubble { right: 1rem; bottom: 1rem; }
  .nyvia-proactive { right: 1rem; left: 1rem; max-width: none; }
}

/* ---- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .nyvia-bubble { animation: none; }
  .nyvia-msg, .nyvia-typing span, .nyvia-widget, .nyvia-proactive { animation: none !important; transition: none !important; }
}
