/* ============================================================
   CASA LUNA — Luna AI Chatbot Styles
   ============================================================ */

/* ── Launcher Button ─────────────────────────────────────────── */
.luna-launcher {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 8000;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #C2714F 0%, #A05A38 100%);
  box-shadow: 0 4px 20px rgba(194,113,79,0.5), 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
  color: white;
}
.luna-launcher:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(194,113,79,0.6), 0 2px 8px rgba(0,0,0,0.2);
}
.luna-launcher.open {
  background: linear-gradient(135deg, #5A4A3A 0%, #2C2418 100%);
}
.luna-launcher-icon,
.luna-launcher-close {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Unread badge */
.luna-unread {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #E2C97E;
  color: #2C2418;
  font-family: 'Jost', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  animation: badgePop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Chat Window ─────────────────────────────────────────────── */
.luna-window {
  position: fixed;
  bottom: 5.5rem;
  right: 2rem;
  z-index: 7999;
  width: 360px;
  max-height: 560px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(44,36,24,0.22), 0 4px 16px rgba(44,36,24,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #F9F5EC;
  animation: chatSlideUp 0.35s cubic-bezier(0.34,1.2,0.64,1);
  border: 1px solid rgba(196,181,165,0.4);
}
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ── Header ──────────────────────────────────────────────────── */
.luna-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #2C2418 0%, #4A3828 100%);
  flex-shrink: 0;
}
.luna-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(201,168,76,0.2);
  border: 1.5px solid rgba(201,168,76,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.luna-header-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}
.luna-header-name {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: #E2C97E;
  letter-spacing: 0.08em;
}
.luna-header-sub {
  font-family: 'Jost', sans-serif;
  font-size: 0.62rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.08em;
}
.luna-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4CAF50;
  box-shadow: 0 0 6px rgba(76,175,80,0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.7; transform: scale(1.15); }
}

/* ── Messages Area ───────────────────────────────────────────── */
.luna-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}
.luna-messages::-webkit-scrollbar { width: 4px; }
.luna-messages::-webkit-scrollbar-track { background: transparent; }
.luna-messages::-webkit-scrollbar-thumb { background: #C4B5A5; border-radius: 2px; }

.luna-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 82%;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.luna-msg-user { align-self: flex-end; align-items: flex-end; }
.luna-msg-bot  { align-self: flex-start; align-items: flex-start; }

.luna-bubble {
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  font-family: 'Jost', sans-serif;
  font-size: 0.82rem;
  line-height: 1.6;
  font-weight: 300;
}
.luna-msg-user .luna-bubble {
  background: linear-gradient(135deg, #C2714F, #A05A38);
  color: white;
  border-radius: 14px 14px 4px 14px;
}
.luna-msg-bot .luna-bubble {
  background: white;
  color: #2C2418;
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 1px 4px rgba(44,36,24,0.08);
  border: 1px solid #EDE3CC;
}

.luna-time {
  font-family: 'Jost', sans-serif;
  font-size: 0.58rem;
  color: #C4B5A5;
  letter-spacing: 0.05em;
  padding: 0 0.25rem;
}

/* ── Typing Indicator ────────────────────────────────────────── */
.luna-typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.65rem 0.95rem;
  min-width: 54px;
}
.luna-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #C4B5A5;
  animation: dotBounce 1.2s ease-in-out infinite;
}
.luna-dot:nth-child(2) { animation-delay: 0.2s; }
.luna-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.5; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* ── Suggestion Chips ────────────────────────────────────────── */
.luna-suggestions {
  padding: 0 1rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex-shrink: 0;
}
.luna-chip {
  font-family: 'Jost', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.8rem;
  border: 1.5px solid #C2714F;
  border-radius: 20px;
  background: transparent;
  color: #C2714F;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.luna-chip:hover {
  background: #C2714F;
  color: white;
}

/* ── Input Row ───────────────────────────────────────────────── */
.luna-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #EDE3CC;
  background: white;
  flex-shrink: 0;
}
.luna-input {
  flex: 1;
  font-family: 'Jost', sans-serif;
  font-size: 0.82rem;
  color: #2C2418;
  border: 1.5px solid #EDE3CC;
  border-radius: 24px;
  padding: 0.55rem 1rem;
  outline: none;
  background: #F9F5EC;
  transition: border-color 0.2s;
}
.luna-input:focus {
  border-color: #C2714F;
  background: white;
}
.luna-input::placeholder { color: #C4B5A5; }

.luna-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #C2714F;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
.luna-send:hover {
  background: #A05A38;
  transform: scale(1.05);
}
.luna-send:active { transform: scale(0.95); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .luna-window {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    bottom: 5rem;
    max-height: 70vh;
  }
  .luna-launcher {
    right: 1rem;
    bottom: 1rem;
  }
}
