/* ============================================
   NARDEEN ATELIER — Live Chat Widget
   ============================================ */
:root {
  --chat-gold: #c8a45e;
  --chat-gold-light: #d4b978;
  --chat-bg: #111111;
  --chat-surface: #1a1a1a;
  --chat-line: rgba(200, 164, 94, 0.14);
}

.chat-widget [hidden] { display: none !important; }

.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  font-family: 'Montserrat', 'Helvetica Neue', sans-serif;
}

/* Launcher */
.chat-launcher {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, var(--chat-gold-light), #a8873e);
  color: #111;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(200, 164, 94, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  margin-left: auto;
}
.chat-launcher:hover { transform: translateY(-2px) scale(1.04); }
.chat-launcher__close { display: none; }
.chat-widget.is-open .chat-launcher__open { display: none; }
.chat-widget.is-open .chat-launcher__close { display: block; }

.chat-launcher__badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #e5484d;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--chat-bg);
}

/* Panel */
.chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--chat-bg);
  border: 1px solid var(--chat-line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
}
.chat-widget.is-open .chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-panel__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 16px 18px;
  background: linear-gradient(135deg, rgba(200, 164, 94, 0.16), rgba(200, 164, 94, 0.04)), var(--chat-surface);
  border-bottom: 1px solid var(--chat-line);
}
.chat-panel__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(200, 164, 94, 0.3);
  flex: 0 0 auto;
  background: #000;
}
.chat-panel__avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-panel__heading { display: flex; flex-direction: column; line-height: 1.3; flex: 1; min-width: 0; }
.chat-panel__heading strong {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--chat-gold-light);
}
.chat-panel__heading span { font-size: 0.72rem; color: var(--chat-gold); opacity: 0.75; }
.chat-panel__min {
  background: none; border: none; color: var(--chat-gold); cursor: pointer;
  padding: 4px; display: flex; align-items: center; opacity: 0.8;
}
.chat-panel__min:hover { opacity: 1; }

.chat-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.chat-intro p {
  background: var(--chat-surface);
  border: 1px solid var(--chat-line);
  color: var(--chat-gold-light);
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
}

.cmsg { display: flex; max-width: 82%; }
.cmsg--visitor { align-self: flex-end; justify-content: flex-end; }
.cmsg--admin { align-self: flex-start; }
.cmsg__bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.cmsg--visitor .cmsg__bubble {
  background: linear-gradient(145deg, var(--chat-gold-light), #a8873e);
  color: #111;
  border-bottom-right-radius: 4px;
}
.cmsg--admin .cmsg__bubble {
  background: var(--chat-surface);
  border: 1px solid var(--chat-line);
  color: var(--chat-gold-light);
  border-bottom-left-radius: 4px;
}

.chat-error {
  align-self: center;
  font-size: 0.75rem;
  color: #e5837f;
  background: rgba(229, 72, 77, 0.1);
  padding: 6px 12px;
  border-radius: 10px;
}

.chat-panel__input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--chat-line);
  background: var(--chat-surface);
}
.chat-panel__input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--chat-line);
  background: var(--chat-bg);
  color: var(--chat-gold-light);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
  max-height: 120px;
  outline: none;
}
.chat-panel__input textarea:focus { border-color: rgba(200, 164, 94, 0.4); }
.chat-panel__input textarea::placeholder { color: rgba(200, 164, 94, 0.45); }
.chat-panel__input button {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, var(--chat-gold-light), #a8873e);
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.chat-panel__input button:hover { transform: scale(1.05); }
.chat-panel__input button:disabled { opacity: 0.5; cursor: default; transform: none; }

.chat-panel__foot {
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--chat-gold);
  opacity: 0.4;
  padding: 6px 0 10px;
  background: var(--chat-surface);
}

@media (max-width: 480px) {
  .chat-widget { right: 16px; bottom: 16px; }
  .chat-panel { bottom: 72px; height: calc(100vh - 100px); }
}

@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-launcher { transition: opacity 0.2s ease; }
}
