/* Romecityflats — floating virtual assistant */
.rcf-chat {
  --rcf-chat-z: 9400;
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: var(--rcf-chat-z);
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  color: var(--color-text, #1a1a1a);
}

.rcf-chat__toggle {
  width: 3.5rem;
  height: 3.5rem;
  min-width: var(--touch-target, 44px);
  min-height: var(--touch-target, 44px);
  border: none;
  border-radius: 50%;
  background: linear-gradient(160deg, #d4b06e 0%, var(--color-primary, #c5a059) 48%, var(--color-primary-dark, #a8893e) 100%);
  color: #fff;
  box-shadow: 0 10px 28px rgba(168, 137, 62, 0.38);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.rcf-chat__toggle:hover,
.rcf-chat__toggle:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(168, 137, 62, 0.45);
  outline: none;
}
.rcf-chat__toggle[aria-expanded='true'] {
  transform: scale(0.96);
}
.rcf-chat__toggle svg {
  width: 1.45rem;
  height: 1.45rem;
  display: block;
}

.rcf-chat__panel {
  position: absolute;
  right: 0;
  bottom: calc(3.5rem + 0.7rem);
  width: min(23rem, calc(100vw - 1.6rem));
  height: min(34rem, calc(100vh - 7rem));
  display: flex;
  flex-direction: column;
  background: var(--color-card-bg, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 0.45rem;
  box-shadow: 0 16px 40px rgba(26, 26, 26, 0.12);
  overflow: hidden;
}
.rcf-chat__panel[hidden] {
  display: none !important;
}

.rcf-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(180deg, #fbf8f1 0%, #fff 100%);
  border-bottom: 1px solid rgba(197, 160, 89, 0.28);
}
.rcf-chat__title {
  margin: 0;
  font-family: var(--font-heading, 'Playfair Display', Georgia, serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.rcf-chat__close {
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  background: transparent;
  color: var(--color-text-light, #555);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 0.25rem;
}
.rcf-chat__close:hover,
.rcf-chat__close:focus-visible {
  color: var(--color-text, #1a1a1a);
  outline: 2px solid rgba(197, 160, 89, 0.45);
  outline-offset: 1px;
}

.rcf-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: var(--color-bg, #f8f9fa);
  min-height: 0;
}

.rcf-chat__bubble {
  max-width: 90%;
  padding: 0.7rem 0.85rem;
  border-radius: 0.35rem;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.rcf-chat__bubble--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--color-border, #e5e7eb);
}
.rcf-chat__bubble strong {
  font-weight: 700;
}
.rcf-chat__bubble--user {
  align-self: flex-end;
  background: rgba(197, 160, 89, 0.16);
  border: 1px solid rgba(197, 160, 89, 0.35);
}
.rcf-chat__bubble--pending {
  opacity: 0.75;
  font-style: italic;
}

.rcf-chat__form {
  display: flex;
  gap: 0.4rem;
  padding: 0.7rem 0.8rem;
  border-top: 1px solid var(--color-border, #e5e7eb);
  background: #fff;
}
.rcf-chat__form input {
  flex: 1;
  min-width: 0;
  min-height: var(--touch-target, 44px);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 0.3rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
}
.rcf-chat__form input:focus {
  outline: 2px solid rgba(197, 160, 89, 0.45);
  outline-offset: 1px;
}
.rcf-chat__send {
  min-width: var(--touch-target, 44px);
  min-height: var(--touch-target, 44px);
  border: none;
  border-radius: 0.3rem;
  background: var(--color-primary, #c5a059);
  color: #fff;
  padding: 0 0.95rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.rcf-chat__send:hover,
.rcf-chat__send:focus-visible {
  background: var(--color-primary-dark, #a8893e);
  outline: none;
}
.rcf-chat__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .rcf-chat {
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
  body:has(.mobile-cta-bar) .rcf-chat {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }
  .rcf-chat__panel {
    width: min(100vw - 1.5rem, 23rem);
    height: min(70vh, 32rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rcf-chat__toggle {
    transition: none;
  }
}
