/* ============================================================
   NIGHT MACARON — Chat Widget
   ============================================================ */

.chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
}

/* Trigger button */
.chat-trigger-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4c2a8a 0%, #7c5cbf 100%);
  border: 1.5px solid rgba(200,169,110,0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(76,42,138,0.5);
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-trigger-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(76,42,138,0.7);
}

/* Panel */
.chat-panel {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 360px;
  height: 520px;
  background: #0a0a14;
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 60px rgba(0,0,0,0.7);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.chat-panel.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* Panel header */
.chat-panel-header {
  padding: 1.1rem 1.2rem;
  background: linear-gradient(135deg, #4c2a8a 0%, #7c5cbf 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header-info { display: flex; flex-direction: column; gap: 0.1rem; }
.chat-header-title {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--gold);
  letter-spacing: 0.12em;
}
.chat-header-sub {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.chat-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.2rem;
  transition: color 0.15s;
}
.chat-close-btn:hover { color: #fff; }

/* Status bar */
.chat-status-bar {
  padding: 0.5rem 1.2rem;
  background: rgba(255,255,255,0.02);
  border-bottom: 0.5px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74,222,128,0.5);
  flex-shrink: 0;
}
.chat-status-text {
  font-size: 0.62rem;
  color: var(--muted-light);
  letter-spacing: 0.04em;
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.chat-msg { display: flex; flex-direction: column; max-width: 80%; }
.chat-msg--admin { align-self: flex-start; }
.chat-msg--user  { align-self: flex-end; }

.chat-msg-bubble {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg--admin .chat-msg-bubble {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 4px 12px 12px 12px;
}
.chat-msg--user .chat-msg-bubble {
  background: linear-gradient(135deg, #4c2a8a 0%, #7c5cbf 100%);
  color: #fff;
  border-radius: 12px 4px 12px 12px;
}
.chat-msg-time {
  font-size: 0.55rem;
  color: var(--muted);
  margin-top: 0.2rem;
  letter-spacing: 0.04em;
}
.chat-msg--user .chat-msg-time { text-align: right; }

/* Input area */
.chat-input-area {
  padding: 0.8rem;
  border-top: 0.5px solid rgba(255,255,255,0.07);
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 0.5px solid rgba(200,169,110,0.2);
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  outline: none;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color 0.2s;
}
.chat-input::placeholder { color: var(--muted); }
.chat-input:focus { border-color: rgba(200,169,110,0.45); }

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4c2a8a 0%, #7c5cbf 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}
.chat-send-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 2px 10px rgba(76,42,138,0.5);
}

/* Mobile */
@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 2rem);
    right: -0.25rem;
    bottom: 72px;
    height: 440px;
  }
  .chat-widget {
    bottom: 1rem;
    right: 1rem;
  }
}
