/* Sapphire Realty chat widget
   Palette: Ink Navy #0F2438, Sapphire #1E4D7B, Sapphire Mist #EAF2FA,
            Warm Gold #C9A227, Slate #4A5568, Cream #FAFAF8
   Type: "Fraunces" (display) / "Inter" (body, UI)
*/

#sr-chat-root {
  --sr-navy: #0f2438;
  --sr-sapphire: #1e4d7b;
  --sr-sapphire-mist: #eaf2fa;
  --sr-gold: #c9a227;
  --sr-slate: #4a5568;
  --sr-cream: #fafaf8;
  --sr-radius: 18px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999999;
}

#sr-chat-root * {
  box-sizing: border-box;
}

/* Launcher button ------------------------------------------------------ */
.sr-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--sr-sapphire), var(--sr-navy));
  box-shadow: 0 8px 24px rgba(15, 36, 56, 0.35);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sr-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 36, 56, 0.45);
}
.sr-launcher svg {
  width: 26px;
  height: 26px;
}
.sr-launcher-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--sr-gold);
  color: var(--sr-navy);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  border: 2px solid var(--sr-cream);
}

/* Panel ------------------------------------------------------------------ */
.sr-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--sr-cream);
  border-radius: var(--sr-radius);
  box-shadow: 0 20px 60px rgba(15, 36, 56, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.sr-panel.sr-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.sr-header {
  background: linear-gradient(120deg, var(--sr-navy), var(--sr-sapphire));
  color: var(--sr-cream);
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.sr-header-gem {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.sr-header-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.sr-header-sub {
  font-size: 12px;
  color: rgba(250, 250, 248, 0.72);
  margin-top: 1px;
}
.sr-header-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(250, 250, 248, 0.8);
  cursor: pointer;
  padding: 4px;
}
.sr-header-facet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 6px;
  background: repeating-linear-gradient(
    115deg,
    var(--sr-gold) 0px,
    var(--sr-gold) 10px,
    transparent 10px,
    transparent 20px
  );
  opacity: 0.55;
}

.sr-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sr-body::-webkit-scrollbar { width: 6px; }
.sr-body::-webkit-scrollbar-thumb { background: #d8dde3; border-radius: 3px; }

.sr-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.sr-msg-bot {
  align-self: flex-start;
  background: var(--sr-sapphire-mist);
  color: var(--sr-navy);
  border-bottom-left-radius: 4px;
}
.sr-msg-user {
  align-self: flex-end;
  background: var(--sr-navy);
  color: var(--sr-cream);
  border-bottom-right-radius: 4px;
}
.sr-msg-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--sr-sapphire-mist);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.sr-msg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sr-sapphire);
  opacity: 0.5;
  animation: sr-bounce 1.1s infinite ease-in-out;
}
.sr-msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.sr-msg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes sr-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.sr-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 14px;
}
.sr-quick-reply {
  border: 1.5px solid var(--sr-gold);
  color: var(--sr-navy);
  background: var(--sr-cream);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.sr-quick-reply:hover {
  background: var(--sr-gold);
  transform: translateY(-1px);
}
.sr-quick-reply.sr-agent {
  border-color: var(--sr-slate);
  color: var(--sr-slate);
  font-weight: 500;
}
.sr-quick-reply.sr-agent:hover {
  background: var(--sr-slate);
  color: var(--sr-cream);
}

.sr-inputbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e7e3d8;
  background: var(--sr-cream);
}
.sr-inputbar input {
  flex: 1;
  border: 1.5px solid #d8dde3;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.sr-inputbar input:focus {
  border-color: var(--sr-sapphire);
}
.sr-inputbar button {
  background: var(--sr-navy);
  color: var(--sr-cream);
  border: none;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.sr-inputbar button:disabled {
  opacity: 0.4;
  cursor: default;
}

.sr-welcome {
  padding: 4px 4px 8px;
}
.sr-welcome h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 16px;
  color: var(--sr-navy);
  margin: 0 0 6px;
}
.sr-welcome p {
  font-size: 13px;
  color: var(--sr-slate);
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 420px) {
  #sr-chat-root { right: 12px; bottom: 12px; }
  .sr-panel { width: calc(100vw - 24px); height: calc(100vh - 100px); }
}

@media (prefers-reduced-motion: reduce) {
  .sr-panel, .sr-launcher, .sr-quick-reply, .sr-msg-typing span {
    transition: none;
    animation: none;
  }
}
