/* rosie-widget.css — floating operator widget for SZL Holdings surfaces.
   Dark-glass Vessels DNA: deep purple glass, gold hairlines, JetBrains Mono.
   Rosie's own accent is coral-rose. No external dependencies. */

:root {
  --rz-coral: #ff7a59;
  --rz-coral-soft: rgba(255, 122, 89, 0.18);
  --rz-gold: #d4af37;
  --rz-gold-dim: rgba(212, 175, 55, 0.55);
  --rz-border: rgba(212, 175, 55, 0.18);
  --rz-glass: rgba(26, 15, 46, 0.92);
  --rz-glass-soft: rgba(45, 27, 94, 0.55);
  --rz-purple-deep: #14091f;
  --rz-text: #f3ecff;
  --rz-text-muted: rgba(243, 236, 255, 0.62);
  --rz-ok: #4caf50;
  --rz-warn: #e53935;
  --rz-font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --rz-font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --rz-z: 2147483000;
}

/* ---- Root container ---- */
.rz-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--rz-z);
  font-family: var(--rz-font-body);
  color: var(--rz-text);
  -webkit-font-smoothing: antialiased;
}
.rz-root *,
.rz-root *::before,
.rz-root *::after {
  box-sizing: border-box;
}

/* ---- Floating button (FAB) ---- */
.rz-fab {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid var(--rz-border);
  padding: 0;
  cursor: pointer;
  background: var(--rz-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 22px rgba(255, 122, 89, 0.18);
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: rz-breathe 4.5s ease-in-out infinite;
}
.rz-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 122, 89, 0.3);
}
.rz-fab:focus-visible {
  outline: 2px solid var(--rz-coral);
  outline-offset: 3px;
}
.rz-fab img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  display: block;
  pointer-events: none;
  user-select: none;
}
/* Fallback monogram if the portrait fails to load */
.rz-fab .rz-fab-fallback {
  font-family: var(--rz-font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--rz-coral);
}

@keyframes rz-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

/* ---- Notification badge dot ---- */
.rz-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--rz-coral);
  color: #1a0f2e;
  font-family: var(--rz-font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--rz-purple-deep);
  display: none;
}
.rz-root[data-unread="true"] .rz-badge { display: block; }

/* ---- Panel ---- */
.rz-panel {
  position: absolute;
  right: 0;
  bottom: 80px;
  width: 360px;
  max-height: 520px;
  height: 70vh;
  display: none;
  flex-direction: column;
  background: var(--rz-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--rz-border);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transform-origin: bottom right;
}
.rz-root[data-open="true"] .rz-panel {
  display: flex;
  animation: rz-panel-in 0.22s ease;
}
@keyframes rz-panel-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Panel header ---- */
.rz-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--rz-border);
  background: linear-gradient(180deg, rgba(255, 122, 89, 0.06), transparent);
}
.rz-head-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 28%;
  border: 1px solid var(--rz-border);
  flex: none;
}
.rz-head-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rz-eyebrow {
  font-family: var(--rz-font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rz-coral);
  display: flex;
  align-items: center;
  gap: 6px;
}
.rz-eyebrow::before {
  content: '';
  width: 14px;
  height: 1px;
  background: var(--rz-coral);
  display: inline-block;
}
.rz-head-name { font-size: 15px; font-weight: 600; color: var(--rz-text); }
.rz-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--rz-font-mono);
  font-size: 10px;
  color: var(--rz-text-muted);
}
.rz-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--rz-text-muted);
}
.rz-status[data-state="ok"] .rz-status-dot { background: var(--rz-ok); }
.rz-status[data-state="down"] .rz-status-dot { background: var(--rz-warn); }
.rz-close {
  background: none; border: none; color: var(--rz-text-muted);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 6px;
  border-radius: 6px;
}
.rz-close:hover { color: var(--rz-text); background: rgba(255,255,255,0.06); }
.rz-close:focus-visible { outline: 2px solid var(--rz-coral); outline-offset: 1px; }

/* ---- Thread ---- */
.rz-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--rz-gold-dim) transparent;
}
.rz-thread::-webkit-scrollbar { width: 6px; }
.rz-thread::-webkit-scrollbar-thumb { background: var(--rz-gold-dim); border-radius: 3px; }

.rz-empty {
  margin: auto 0;
  text-align: center;
  color: var(--rz-text-muted);
  font-size: 13px;
  line-height: 1.55;
  padding: 0 8px;
}
.rz-empty strong { color: var(--rz-text); font-weight: 600; }

.rz-msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.rz-msg-user {
  align-self: flex-end;
  background: var(--rz-coral-soft);
  border: 1px solid rgba(255, 122, 89, 0.35);
  color: var(--rz-text);
}
.rz-msg-rosie {
  align-self: flex-start;
  background: var(--rz-glass-soft);
  border: 1px solid var(--rz-border);
}
.rz-msg-meta {
  font-family: var(--rz-font-mono);
  font-size: 10px;
  color: var(--rz-gold-dim);
  margin-top: 5px;
  word-break: break-all;
}
.rz-msg code, .rz-mono {
  font-family: var(--rz-font-mono);
  font-size: 11px;
  background: rgba(0,0,0,0.25);
  padding: 1px 5px;
  border-radius: 4px;
}

.rz-typing { display: flex; gap: 4px; padding: 4px 2px; }
.rz-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--rz-gold-dim);
  animation: rz-bounce 1.2s infinite ease-in-out;
}
.rz-typing span:nth-child(2) { animation-delay: 0.15s; }
.rz-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes rz-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Input ---- */
.rz-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--rz-border);
  background: rgba(10, 5, 20, 0.55);
}
.rz-input {
  flex: 1;
  background: var(--rz-glass-soft);
  border: 1px solid var(--rz-border);
  border-radius: 10px;
  color: var(--rz-text);
  font-family: var(--rz-font-body);
  font-size: 13px;
  padding: 9px 11px;
  resize: none;
  max-height: 90px;
  outline: none;
}
.rz-input::placeholder { color: var(--rz-text-muted); }
.rz-input:focus { border-color: rgba(255, 122, 89, 0.5); }
.rz-send {
  flex: none;
  width: 38px;
  border: none;
  border-radius: 10px;
  background: var(--rz-coral);
  color: #1a0f2e;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.rz-send:hover { background: #ff8e72; }
.rz-send:disabled { opacity: 0.5; cursor: not-allowed; }
.rz-send:focus-visible { outline: 2px solid var(--rz-text); outline-offset: 1px; }

/* ---- Toasts ---- */
.rz-toasts {
  position: absolute;
  right: 0;
  bottom: 80px;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.rz-root[data-open="true"] .rz-toasts { display: none; }
.rz-toast {
  pointer-events: auto;
  background: var(--rz-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--rz-border);
  border-left: 3px solid var(--rz-coral);
  border-radius: 12px;
  padding: 11px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 12.5px;
  line-height: 1.45;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  animation: rz-toast-in 0.28s ease;
}
.rz-toast[data-kind="denial"] { border-left-color: var(--rz-warn); }
.rz-toast[data-kind="build-red"] { border-left-color: var(--rz-warn); }
.rz-toast[data-kind="build-green"] { border-left-color: var(--rz-ok); }
.rz-toast-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  object-fit: cover; object-position: center 28%; flex: none;
  border: 1px solid var(--rz-border);
}
.rz-toast-body { flex: 1; min-width: 0; }
.rz-toast-body .rz-toast-meta {
  font-family: var(--rz-font-mono);
  font-size: 10px;
  color: var(--rz-gold-dim);
  margin-top: 4px;
  word-break: break-all;
}
.rz-toast-x {
  background: none; border: none; color: var(--rz-text-muted);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; flex: none;
}
.rz-toast-x:hover { color: var(--rz-text); }
@keyframes rz-toast-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.rz-toast.rz-toast-out { animation: rz-toast-out 0.2s ease forwards; }
@keyframes rz-toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .rz-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 110px);
    max-height: none;
    right: -8px;
  }
  .rz-toasts { width: calc(100vw - 40px); }
  .rz-fab { width: 56px; height: 56px; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .rz-fab { animation: none; }
  .rz-fab:hover { transform: none; }
  .rz-root[data-open="true"] .rz-panel { animation: none; }
  .rz-toast { animation: none; }
  .rz-toast.rz-toast-out { animation: none; opacity: 0; }
  .rz-typing span { animation: none; }
}
