.mr-chat {
  --mr-navy: #1B2A4A;
  --mr-rust: #B94E2B;
  --mr-cream: #F5F0E8;
  --mr-white: #fff;
  --mr-shadow: 0 10px 40px rgba(27, 42, 74, 0.25);

  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  font-family: 'Libre Baskerville', Georgia, serif;
}

.mr-chat__bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--mr-rust);
  color: var(--mr-white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--mr-shadow);
  transition: transform 150ms ease;
}

.mr-chat__bubble:hover {
  transform: scale(1.05);
}

.mr-chat__panel {
  display: none;
  position: absolute;
  bottom: 0;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 3rem);
  height: 560px;
  max-height: calc(100vh - 3rem);
  background: var(--mr-cream);
  border-radius: 12px;
  box-shadow: var(--mr-shadow);
  overflow: hidden;
  flex-direction: column;
}

.mr-chat.open .mr-chat__panel {
  display: flex;
}

.mr-chat.open .mr-chat__bubble {
  display: none;
}

.mr-chat__header {
  background: var(--mr-navy);
  color: var(--mr-cream);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mr-chat__header-name {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mr-chat__close {
  background: transparent;
  border: none;
  color: var(--mr-cream);
  cursor: pointer;
  font-size: 1.25rem;
}

.mr-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mr-chat__msg {
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.mr-chat__msg--inbound {
  align-self: flex-end;
  background: var(--mr-navy);
  color: var(--mr-cream);
  border-bottom-right-radius: 2px;
}

.mr-chat__msg--outbound {
  align-self: flex-start;
  background: var(--mr-white);
  color: var(--mr-navy);
  border-bottom-left-radius: 2px;
}

.mr-chat__msg--typing {
  align-self: flex-start;
  font-style: italic;
  color: #4A5568;
  font-size: 0.85rem;
}

.mr-chat__typing {
  padding: 0.85rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  max-width: 70px;
}

.mr-chat__typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mr-navy);
  opacity: 0.4;
  animation: mr-chat-typing 1.3s infinite ease-in-out;
}

.mr-chat__typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.mr-chat__typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes mr-chat-typing {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.mr-chat__input-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(27, 42, 74, 0.1);
  background: var(--mr-white);
}

.mr-chat__input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(27, 42, 74, 0.2);
  border-radius: 8px;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.95rem;
  outline: none;
}

.mr-chat__input:focus {
  border-color: var(--mr-rust);
}

.mr-chat__send {
  background: var(--mr-rust);
  color: var(--mr-white);
  border: none;
  border-radius: 8px;
  padding: 0 1rem;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.mr-chat__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .mr-chat {
    bottom: 0;
    right: 0;
  }
  .mr-chat__panel {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}
