/**
 * REVO - Maven Homes AI Assistant
 * Widget Stylesheet v1.0
 * All selectors prefixed with .revo- to prevent conflicts with host page styles
 */

/* ─── Floating Launcher Button ──────────────────────────────────────────────── */

.revo-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: #1A1A1A;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2147483646;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  border: none;
  outline: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.revo-launcher:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
}

.revo-launcher svg {
  width: 28px;
  height: 28px;
  fill: #C8A951;
  pointer-events: none;
}

/* Pulse ring — fires every 30s until first open */
@keyframes revo-pulse-ring {
  0%   { box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 0   rgba(200, 169, 81, 0.65); }
  70%  { box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 18px rgba(200, 169, 81, 0);   }
  100% { box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 0   rgba(200, 169, 81, 0);   }
}

.revo-launcher.revo-pulsing {
  animation: revo-pulse-ring 1.6s ease-out;
}

/* Notification badge */
.revo-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  background: #C8A951;
  border-radius: 50%;
  color: #1A1A1A;
  font-size: 11px;
  font-weight: 700;
  font-family: Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
}

/* ─── Chat Window ────────────────────────────────────────────────────────────── */

.revo-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  min-height: 380px;
  height: 640px;
  max-height: 80vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.12);
  z-index: 2147483645;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Hidden state */
  transform: scale(0.82) translateY(24px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              opacity 0.22s ease;
  font-family: Arial, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.revo-window.revo-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ─── Header ─────────────────────────────────────────────────────────────────── */

.revo-header {
  background: #1A1A1A;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.revo-header-info {
  display: flex;
  align-items: center;
  gap: 11px;
}

.revo-avatar {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #C8A951 0%, #a8893e 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Palatino Linotype', Palatino, Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  color: #1A1A1A;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.revo-header-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.revo-header-name {
  font-family: 'Palatino Linotype', Palatino, Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  color: #C8A951;
  line-height: 1;
  letter-spacing: 0.2px;
}

.revo-header-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.revo-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4CAF50;
  flex-shrink: 0;
}

.revo-status-dot.revo-offline {
  background: #FF9800;
}

.revo-header-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  outline: none;
}

.revo-header-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.revo-header-close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ─── Messages Area ──────────────────────────────────────────────────────────── */

.revo-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f5f5f5;
  scroll-behavior: smooth;
}

.revo-messages::-webkit-scrollbar { width: 3px; }
.revo-messages::-webkit-scrollbar-track { background: transparent; }
.revo-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ─── Message Bubbles ────────────────────────────────────────────────────────── */

@keyframes revo-msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.revo-msg {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  animation: revo-msg-in 0.28s ease;
}

.revo-msg.revo-bot { justify-content: flex-start; }
.revo-msg.revo-user { justify-content: flex-end; }

.revo-msg-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #C8A951 0%, #a8893e 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Palatino Linotype', Palatino, Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  color: #1A1A1A;
  flex-shrink: 0;
}

.revo-msg-icon.revo-ghost {
  opacity: 0;
  pointer-events: none;
}

.revo-msg-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 76%;
}

.revo-msg.revo-bot .revo-msg-body {
  max-width: 88%;
}

.revo-msg.revo-user .revo-msg-body {
  align-items: flex-end;
}

.revo-bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}

.revo-msg.revo-bot .revo-bubble {
  background: #1A1A1A;
  color: #ffffff;
  border-bottom-left-radius: 4px;
}

.revo-msg.revo-user .revo-bubble {
  background: #C8A951;
  color: #1A1A1A;
  border-bottom-right-radius: 4px;
}

/* Bold/italic inside bubbles */
.revo-bubble strong { font-weight: 700; }
.revo-bubble em { font-style: italic; }
.revo-bubble p { margin: 0 0 6px 0; }
.revo-bubble p:last-child { margin-bottom: 0; }

/* Long bot responses get a bit more breathing room between paragraphs */
.revo-msg.revo-bot .revo-bubble p { margin: 0 0 8px 0; }
.revo-msg.revo-bot .revo-bubble p:last-child { margin-bottom: 0; }

.revo-msg-time {
  font-size: 10px;
  color: #aaa;
  padding: 0 3px;
}

/* ─── Typing Indicator ───────────────────────────────────────────────────────── */

.revo-typing-wrap {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  animation: revo-msg-in 0.2s ease;
}

.revo-typing-bubble {
  padding: 12px 14px;
  background: #1A1A1A;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.revo-dot {
  width: 6px;
  height: 6px;
  background: #C8A951;
  border-radius: 50%;
  animation: revo-dot-bounce 1.3s ease infinite;
  opacity: 0.5;
}

.revo-dot:nth-child(2) { animation-delay: 0.18s; }
.revo-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes revo-dot-bounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.4; }
  30%            { transform: translateY(-7px); opacity: 1;   }
}

/* ─── Quick Action Buttons ───────────────────────────────────────────────────── */

.revo-quick-wrap {
  padding: 10px 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #f5f5f5;
  border-top: 1px solid #ececec;
  flex-shrink: 0;
}

.revo-quick-btn {
  background: #ffffff;
  border: 1.5px solid #C8A951;
  color: #1A1A1A;
  padding: 6px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-family: Arial, sans-serif;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
  outline: none;
  line-height: 1.3;
}

.revo-quick-btn:hover {
  background: #C8A951;
  color: #1A1A1A;
}

/* ─── Input Area ─────────────────────────────────────────────────────────────── */

.revo-input-area {
  padding: 10px 12px;
  border-top: 1px solid #eee;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #ffffff;
  flex-shrink: 0;
}

.revo-input {
  flex: 1;
  border: 1.5px solid #e0e0e0;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: Arial, sans-serif;
  outline: none;
  resize: none;
  line-height: 1.4;
  transition: border-color 0.2s;
  max-height: 82px;
  overflow-y: auto;
  background: #fafafa;
  color: #1A1A1A;
}

.revo-input:focus {
  border-color: #C8A951;
  background: #ffffff;
}

.revo-input::placeholder { color: #bbb; }

.revo-send-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  background: #1A1A1A;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
  outline: none;
}

.revo-send-btn:hover {
  background: #C8A951;
}

.revo-send-btn svg {
  width: 17px;
  height: 17px;
  fill: #ffffff;
  pointer-events: none;
}

.revo-send-btn:hover svg {
  fill: #1A1A1A;
}

/* ─── Footer ─────────────────────────────────────────────────────────────────── */

.revo-footer {
  padding: 5px 0 7px;
  text-align: center;
  font-size: 10.5px;
  color: #bbb;
  background: #fff;
  font-family: Arial, sans-serif;
  flex-shrink: 0;
}

.revo-footer a {
  color: #1a6fb5;
  text-decoration: none;
}

.revo-footer a:hover {
  text-decoration: underline;
}

/* ─── Mobile ─────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .revo-launcher {
    width: 52px;
    height: 52px;
    bottom: 16px;
    right: 16px;
  }

  .revo-launcher svg {
    width: 24px;
    height: 24px;
  }

  .revo-window {
    width: calc(100vw - 20px);
    height: 88vh;
    max-height: 88vh;
    min-height: 320px;
    bottom: 74px;
    right: 10px;
    left: 10px;
    border-radius: 14px;
  }

  .revo-msg.revo-bot .revo-msg-body {
    max-width: 92%;
  }

  .revo-bubble {
    font-size: 13px;
  }

  /* Pad below input for iOS home indicator */
  .revo-footer {
    padding-bottom: max(7px, env(safe-area-inset-bottom, 7px));
  }
}

/* ─── High-contrast / accessibility ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .revo-launcher,
  .revo-window,
  .revo-msg,
  .revo-typing-wrap { animation: none; transition: none; }
  .revo-window { transform: none; }
  .revo-window.revo-open { opacity: 1; pointer-events: all; }
}
