/* PazChat widget — visitor front-end
   Accent is injected as --pazchat-accent (configurable). Everything else is
   neutral so the widget adapts to any site. */

.pazchat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99998;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 18px;
  border: none;
  border-radius: 999px;
  background: var(--pazchat-accent, #d6006e);
  color: #fff;
  font: 600 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pazchat-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.28); }
.pazchat-launcher:focus-visible { outline: 3px solid rgba(255,255,255,.6); outline-offset: 2px; }
.pazchat-launcher svg { flex: none; }

.pazchat-panel {
  --pc-bg: #ffffff;
  --pc-fg: #1a1a1f;
  --pc-muted: #6b7280;
  --pc-line: #e6e7eb;
  --pc-visitor: var(--pazchat-accent, #d6006e);
  --pc-staff: #f1f2f5;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--pc-fg);
  box-sizing: border-box;
}
.pazchat-panel *, .pazchat-panel *::before, .pazchat-panel *::after { box-sizing: border-box; }

/* Floating panel */
.pazchat-panel-floating {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 99999;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--pc-bg);
  border: 1px solid var(--pc-line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.pazchat-panel-floating.pazchat-open { display: flex; }

/* Inline (shortcode) panel */
.pazchat-panel-inline {
  width: 100%;
  max-width: 480px;
  height: 560px;
  margin: 16px 0;
  background: var(--pc-bg);
  border: 1px solid var(--pc-line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pazchat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--pazchat-accent, #d6006e);
  color: #fff;
  flex: none;
}
.pazchat-title { font-weight: 600; font-size: 15px; }
.pazchat-close {
  background: none; border: none; color: #fff; font-size: 24px; line-height: 1;
  cursor: pointer; padding: 0 4px; opacity: .85;
}
.pazchat-close:hover { opacity: 1; }

.pazchat-screen { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pazchat-panel .pazchat-screen-off { display: none !important; }

/* Start screen */
.pazchat-start { padding: 22px 18px; gap: 12px; justify-content: center; }
.pazchat-start-prompt { margin: 0 0 4px; color: var(--pc-muted); font-size: 14px; }

.pazchat-input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--pc-line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--pc-fg);
  background: #fff;
}
.pazchat-input:focus { outline: none; border-color: var(--pazchat-accent, #d6006e); }

.pazchat-btn {
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  background: var(--pazchat-accent, #d6006e);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.pazchat-btn:hover { filter: brightness(1.05); }
.pazchat-btn:disabled { opacity: .6; cursor: default; }

/* Messages */
.pazchat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fafafb;
}
.pazchat-msg { display: flex; }
.pazchat-msg-visitor { justify-content: flex-end; }
.pazchat-msg-staff, .pazchat-msg-system { justify-content: flex-start; }
.pazchat-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  word-wrap: break-word;
}
.pazchat-msg-visitor .pazchat-bubble {
  background: var(--pc-visitor);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.pazchat-msg-staff .pazchat-bubble {
  background: var(--pc-staff);
  color: var(--pc-fg);
  border-bottom-left-radius: 4px;
}
.pazchat-msg-system .pazchat-bubble {
  background: transparent;
  color: var(--pc-muted);
  font-size: 12.5px;
  font-style: italic;
  max-width: 100%;
  text-align: center;
  margin: 0 auto;
  padding: 4px 8px;
}

/* Identify / save */
.pazchat-panel [hidden] { display: none !important; }
.pazchat-identify { border-top: 1px solid var(--pc-line); padding: 8px 14px; background: #fff; flex: none; }
.pazchat-save-toggle {
  background: none; border: none; color: var(--pazchat-accent, #d6006e);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 2px 0;
  display: inline-flex; align-items: center; gap: 5px;
}
.pazchat-save-toggle::before { content: "✚"; font-size: 12px; }
.pazchat-save-form { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
.pazchat-save-hint { margin: 0; font-size: 12.5px; color: var(--pc-muted); }

/* Composer */
.pazchat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--pc-line);
  background: #fff;
  flex: none;
}
.pazchat-textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--pc-line);
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
}
.pazchat-textarea:focus { outline: none; border-color: var(--pazchat-accent, #d6006e); }
.pazchat-send {
  flex: none;
  width: 42px; height: 42px;
  border: none; border-radius: 50%;
  background: var(--pazchat-accent, #d6006e);
  color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.pazchat-send:hover { filter: brightness(1.05); }

/* Mobile */
@media (max-width: 480px) {
  .pazchat-panel-floating {
    right: 0; bottom: 0;
    width: 100vw; max-width: 100vw;
    height: 100vh; max-height: 100vh;
    border-radius: 0;
  }
  .pazchat-launcher-text { display: none; }
  .pazchat-launcher { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .pazchat-launcher { transition: none; }
}
