/* ══════════════════════════════════════════════════
   MONOLITH RESIDENCES — AI CHAT
   Floating chat button + slide-up panel
   ══════════════════════════════════════════════════ */

/* ── Chat Button ── */
.chat-button {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 5000;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.25s ease;
}
.chat-button:hover {
  opacity: 1;
}
.chat-button.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}

.chat-label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1),
              opacity 0.3s ease;
}
.chat-button:hover .chat-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.chat-button-img {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  padding: 8px;
  object-fit: contain;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1), background 0.3s ease;
}
.chat-button:hover .chat-button-img {
  transform: scale(1.08);
  background: rgba(0,0,0,0.55);
}

/* ── Chat Panel ── */
.chat-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 4999;
  width: 380px;
  height: 540px;
  max-height: calc(100vh - 140px);
  background: rgba(14,17,18,0.97);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16,1,0.3,1),
              transform 0.3s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 12px 48px rgba(0,0,0,0.4);
  overflow: hidden;
}
.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Header ── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.chat-title {
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
.chat-status {
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  line-height: 1.2;
}
.chat-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  transition: color 0.2s ease, background 0.2s ease;
  font-size: 16px;
  border: none;
  background: none;
  cursor: pointer;
}
.chat-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.chat-clear {
  font-family: var(--ff-body);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s ease, background 0.2s ease;
  margin-right: 8px;
}
.chat-clear:hover {
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.06);
}

/* ── Messages ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

.chat-message {
  display: flex;
  max-width: 85%;
}
.chat-message.user {
  align-self: flex-end;
}
.chat-message.ai {
  align-self: flex-start;
}

.chat-bubble {
  padding: 12px 16px;
  font-family: var(--ff-body);
  font-size: 14px;
  line-height: 1.55;
  color: #fff;
  border-radius: 14px;
  word-wrap: break-word;
}
.chat-message.user .chat-bubble {
  background: rgba(255,255,255,0.1);
  border-bottom-right-radius: 4px;
}
.chat-message.ai .chat-bubble {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom-left-radius: 4px;
}

.chat-message.ai .chat-bubble.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 20px;
}
.chat-message.ai .chat-bubble.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: chatTyping 1.2s infinite alternate;
}
.chat-message.ai .chat-bubble.typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.chat-message.ai .chat-bubble.typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes chatTyping {
  from { opacity: 0.2; transform: translateY(0); }
  to   { opacity: 1;   transform: translateY(-4px); }
}

/* ── Input Area ── */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: var(--ff-body);
  font-size: 14px;
  color: #fff;
  outline: none;
  transition: border-color 0.2s ease;
}
.chat-input::placeholder {
  color: rgba(255,255,255,0.3);
}
.chat-input:focus {
  border-color: rgba(255,255,255,0.2);
}

.chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}
.chat-send:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}
.chat-send svg {
  width: 16px;
  height: 16px;
  color: #fff;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .chat-button {
    bottom: 20px;
    right: 20px;
  }
  .chat-button.hidden {
    display: none;
  }
  .chat-button-img {
    width: 36px;
    height: 36px;
  }
}
