/* ==========================================================================
   PRISMA — Concierge chat widget
   Frontend styling only; all backend behaviour unchanged.
   Requires wedding-ge.css :root variables loaded first.
   ========================================================================== */

.wg-chat {
  position: fixed;
  right: clamp(18px, 3vw, 32px);
  bottom: clamp(18px, 3vw, 32px);
  z-index: 1300;
  font-family: var(--font-sans, 'Inter', sans-serif);
}

/* --- Launcher ------------------------------------------------------------ */
.wg-chat-launcher-shell {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

/* Presence dot — the only green that remains */
.wg-chat-live-ring {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4FA36C;
  border: 1.5px solid var(--ink, #0B0A09);
  pointer-events: none;
}

.wg-chat-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 56px;
  min-width: 56px;
  padding: 0 15px;
  background: rgba(11, 10, 9, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ivory, #F2EEE7);
  border: 1px solid rgba(175, 149, 103, 0.4);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              background-color 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              gap 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.wg-chat-launcher-icon {
  width: 22px;
  height: 22px;
  flex: none;
}

/* Hover expansion — "prisma.ge Concierge" */
.wg-chat-launcher-label {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: max-width 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.wg-chat-launcher:hover,
.wg-chat-launcher:focus-visible {
  border-color: rgba(196, 174, 133, 0.75);
  background: rgba(11, 10, 9, 0.98);
  gap: 10px;
}

.wg-chat-launcher:hover .wg-chat-launcher-label,
.wg-chat-launcher:focus-visible .wg-chat-launcher-label {
  max-width: 220px;
  opacity: 1;
}

.wg-chat-launcher[aria-expanded="true"] {
  border-color: rgba(196, 174, 133, 0.75);
}

/* --- Backdrop ------------------------------------------------------------ */
.wg-chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 10, 9, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.4s;
}

.wg-chat-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* --- Panel --------------------------------------------------------------- */
.wg-chat-panel {
  position: fixed;
  right: clamp(18px, 3vw, 32px);
  bottom: calc(clamp(18px, 3vw, 32px) + 68px);
  width: min(calc(100vw - 36px), 400px);
  max-height: min(calc(100vh - 130px), 620px);
  max-height: min(calc(100dvh - 130px), 620px);
  display: flex;
  flex-direction: column;
  background: var(--ivory, #F2EEE7);
  border: 1px solid rgba(11, 10, 9, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.45s;
  overflow: hidden;
}

.wg-chat-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.wg-chat-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(242, 238, 231, 0.85);
  border: 1px solid rgba(242, 238, 231, 0.25);
  font-size: 1.25rem;
  line-height: 1;
  transition: color 0.3s, border-color 0.3s, transform 0.3s;
}

.wg-chat-close:hover,
.wg-chat-close:focus-visible {
  color: #fff;
  border-color: rgba(196, 174, 133, 0.7);
  transform: rotate(90deg);
}

/* --- Header — dark, cinematic, with refracted hairline ------------------- */
.wg-chat-header {
  position: relative;
  padding: 26px 60px 22px 26px;
  background:
    radial-gradient(130% 180% at 90% 0%, rgba(90, 20, 43, 0.55), transparent 60%),
    #0B0A09;
  color: #F2EEE7;
}

.wg-chat-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg,
    rgba(175, 149, 103, 0.5),
    rgba(201, 154, 158, 0.3) 40%,
    rgba(155, 196, 201, 0.25) 75%,
    transparent);
}

.wg-chat-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.wg-chat-subtitle {
  margin-top: 8px;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: rgba(242, 238, 231, 0.68);
}

.wg-chat-status {
  margin-top: 10px;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(196, 174, 133, 0.85);
}

/* --- Body ---------------------------------------------------------------- */
.wg-chat-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.wg-chat-error {
  margin: 14px 22px 0;
  padding: 10px 14px;
  font-size: 0.8125rem;
  color: #5A142B;
  border: 1px solid rgba(90, 20, 43, 0.35);
  background: rgba(90, 20, 43, 0.05);
}

/* --- Pre-chat form ------------------------------------------------------- */
.wg-chat-prechat {
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.wg-chat-prechat.is-hidden {
  display: none;
}

.wg-chat-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.wg-chat-field {
  position: relative;
  padding: 10px 0 12px;
  border-bottom: 1px solid rgba(11, 10, 9, 0.16);
  transition: border-color 0.3s;
}

.wg-chat-field:focus-within {
  border-bottom-color: #5A142B;
}

.wg-chat-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #8E8478;
  transition: color 0.3s;
}

.wg-chat-field:focus-within label {
  color: #5A142B;
}

.wg-chat-field input,
.wg-chat-field textarea {
  display: block;
  width: 100%;
  padding: 2px 0;
  font-family: inherit;
  font-size: 0.9375rem;
  color: #0B0A09;
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.wg-chat-field textarea {
  resize: vertical;
  min-height: 60px;
}

.wg-chat-field.is-invalid {
  border-bottom-color: rgba(90, 20, 43, 0.85);
}

.wg-chat-field.is-invalid label {
  color: #5A142B;
}

.wg-chat-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 20px;
  padding: 15px 24px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #F2EEE7;
  background: #5A142B;
  border: 1px solid rgba(242, 238, 231, 0.14);
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
}

.wg-chat-submit::after {
  content: '\2192';
  font-size: 0.875rem;
  letter-spacing: 0;
  transition: transform 0.3s;
}

.wg-chat-submit:hover,
.wg-chat-submit:focus-visible {
  background: #430F20;
}

.wg-chat-submit:hover::after {
  transform: translateX(4px);
}

.wg-chat-submit:disabled {
  opacity: 0.55;
  cursor: default;
}

/* --- Thread -------------------------------------------------------------- */
.wg-chat-thread {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 260px;
}

.wg-chat-thread.is-active {
  display: flex;
}

.wg-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wg-chat-msg {
  max-width: 84%;
  padding: 11px 15px;
  font-size: 0.875rem;
  line-height: 1.6;
  word-break: break-word;
}

.wg-chat-msg--visitor {
  align-self: flex-end;
  background: #5A142B;
  color: #F2EEE7;
}

.wg-chat-msg--admin,
.wg-chat-msg--system {
  align-self: flex-start;
  background: rgba(11, 10, 9, 0.05);
  color: #0B0A09;
  border: 1px solid rgba(11, 10, 9, 0.08);
}

.wg-chat-msg-time {
  margin-top: 5px;
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  opacity: 0.55;
}

/* --- Compose ------------------------------------------------------------- */
.wg-chat-compose {
  display: flex;
  gap: 0;
  border-top: 1px solid rgba(11, 10, 9, 0.14);
  background: rgba(11, 10, 9, 0.02);
}

.wg-chat-compose input {
  flex: 1;
  min-width: 0;
  padding: 15px 18px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: #0B0A09;
  background: transparent;
  border: none;
  outline: none;
}

.wg-chat-compose input:focus-visible {
  outline: none;
  box-shadow: inset 0 -1px 0 #5A142B;
}

.wg-chat-compose button {
  flex: none;
  padding: 0 22px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5A142B;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(11, 10, 9, 0.14);
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

.wg-chat-compose button:hover,
.wg-chat-compose button:focus-visible {
  background: #5A142B;
  color: #F2EEE7;
}

.wg-chat-compose button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* --- Small screens --------------------------------------------------------- */
@media (max-width: 480px) {
  .wg-chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: calc(clamp(18px, 3vw, 32px) + 68px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wg-chat-panel,
  .wg-chat-backdrop,
  .wg-chat-launcher,
  .wg-chat-launcher-label {
    transition-duration: 0.01ms !important;
  }
}
