/* =================================================================
   chat-widget.css
   All rules scoped to .ps-hero-*, .ps-bubble-*,
   .ps-escalation-*, .ps-modal-*, .ps-accordion-*, .ps-case-*,
   .ps-field-*, .ps-btn-*.
   No floating launcher styles — launcher has been removed.
   Custom hero styles are defined in style.css
================================================================= */

/* ── Pre-chat trigger pill ── */
.ps-hero-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  margin: 0 auto 0;
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 10px 32px rgba(6, 60, 80, 0.10);
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  color: #5f7782;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.ps-hero-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px rgba(6, 60, 80, 0.14);
}

.ps-hero-trigger:focus-visible {
  outline: 3px solid rgba(0, 163, 163, 0.4);
  outline-offset: 2px;
}

.ps-hero-trigger-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  color: #00A3A3;
}

/* ── Active chat area ── */
.ps-hero-chat {
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Transcript ── */
.ps-hero-transcript {
  min-height: 130px;
  max-height: 340px;
  overflow-y: auto;
  padding: 20px;
  border-radius: 20px 20px 0 0;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(213, 229, 229, 0.8);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* ── Message bubbles ── */
.ps-bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 22px;
  word-break: break-word;
  white-space: pre-wrap;
}

.ps-bubble-user {
  margin-left: auto;
  background: #1C5972;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ps-bubble-assistant {
  background: #EAF7F4;
  color: #1C5972;
  border-bottom-left-radius: 4px;
}

.ps-bubble-system {
  align-self: center;
  background: #fff8e1;
  color: #5f4800;
  border-radius: 10px;
  font-size: 13px;
  padding: 8px 14px;
  max-width: 90%;
  text-align: center;
}

/* ── Typing indicator (…) ── */
.ps-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  min-width: 56px;
}

.ps-typing-indicator span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00A3A3;
  animation: ps-typing-bounce 1.2s infinite ease-in-out;
}

.ps-typing-indicator span:nth-child(1) { animation-delay: 0s; }
.ps-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ps-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ps-typing-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.35; }
  30%           { transform: translateY(-6px); opacity: 1;    }
}

/* ── Escalation CTA ── */
.ps-escalation-cta-wrap {
  display: flex;
  justify-content: flex-start;
}

.ps-escalation-cta {
  margin-top: 4px;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: #00A3A3;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.ps-escalation-cta:hover {
  background: #008f8f;
  transform: translateY(-1px);
}

.ps-escalation-cta:focus-visible {
  outline: 3px solid rgba(0, 163, 163, 0.4);
  outline-offset: 2px;
}

/* ── Hero input form ── */
.ps-hero-form {
  border: 1px solid rgba(213, 229, 229, 0.8);
  border-top: none;
  border-radius: 0 0 20px 20px;
  background: #ffffff;
  padding: 12px 14px 14px;
}

.ps-hero-label {
  display: block;
  font-size: 12px;
  color: #5f7782;
  margin-bottom: 6px;
}

.ps-hero-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.ps-hero-textarea {
  flex: 1;
  min-width: 0;
  min-height: 28px;
  max-height: 120px;
  border: 1px solid rgba(28, 89, 114, 0.18);
  border-radius: 14px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 22px;
  color: #063c50;
  resize: none;
  overflow: hidden;
  background: transparent;
}

.ps-hero-textarea:focus-visible {
  outline: none;
  border-color: #00A3A3;
  box-shadow: 0 0 0 3px rgba(0, 163, 163, 0.15);
}

.ps-hero-send {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 999px;
  background: #00A3A3;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 163, 163, 0.28);
  transition: transform 160ms ease, opacity 160ms ease;
}

.ps-hero-send:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ps-hero-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ps-hero-send svg {
  width: 18px;
  height: 18px;
}

/* ── Modal overlay ── */
.ps-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(6, 60, 80, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ps-modal-overlay[hidden] {
  display: none;
}

.ps-modal {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 24px 56px rgba(6, 60, 80, 0.24);
  width: min(100%, 520px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
}

.ps-modal-form {
  width: min(100%, 600px);
}

.ps-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 14px;
  border-bottom: 1px solid rgba(28, 89, 114, 0.08);
  gap: 12px;
  flex-shrink: 0;
}

.ps-modal-title {
  margin: 0;
  font-size: 20px;
  line-height: 26px;
  color: #063c50;
}

.ps-modal-close {
  border: 0;
  background: transparent;
  color: #1C5972;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0 2px;
}

.ps-modal-body {
  padding: 18px 24px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 23px;
  color: #1C5972;
}

.ps-modal-body p {
  margin: 0 0 12px;
}

.ps-tc-scroll {
  max-height: 220px;
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid rgba(28, 89, 114, 0.12);
  border-radius: 10px;
  background: #f8fbfb;
  font-size: 14px;
  line-height: 22px;
  margin-top: 4px;
}

.ps-tc-scroll ul {
  margin: 8px 0 12px 0;
  padding-left: 20px;
}

.ps-tc-scroll li {
  margin-bottom: 6px;
}

.ps-tc-scroll a {
  color: #00A3A3;
  font-weight: 600;
}

.ps-btn-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.ps-modal-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid rgba(28, 89, 114, 0.08);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.ps-submit-error {
  width: 100%;
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: #c0392b;
  text-align: right;
}

/* ── Buttons ── */
.ps-btn-primary {
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: #00A3A3;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.ps-btn-primary:hover {
  background: #008f8f;
  transform: translateY(-1px);
}

.ps-btn-primary:focus-visible {
  outline: 3px solid rgba(0, 163, 163, 0.4);
  outline-offset: 2px;
}

.ps-btn-secondary {
  min-height: 44px;
  padding: 0 22px;
  border: 1.5px solid rgba(28, 89, 114, 0.25);
  border-radius: 999px;
  background: transparent;
  color: #1C5972;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease;
}

.ps-btn-secondary:hover {
  background: rgba(28, 89, 114, 0.05);
}

/* ── Case form fields ── */
.ps-case-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ps-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .ps-field-row {
    grid-template-columns: 1fr;
  }
}

.ps-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ps-field-label {
  font-size: 13px;
  font-weight: 600;
  color: #1C5972;
}

.ps-field-label span {
  color: #c0392b;
}

.ps-field-input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(28, 89, 114, 0.22);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  color: #063c50;
  background: #ffffff;
  transition: border-color 160ms ease;
}

.ps-field-input:focus-visible {
  outline: none;
  border-color: #00A3A3;
  box-shadow: 0 0 0 3px rgba(0, 163, 163, 0.15);
}

.ps-field-textarea {
  height: auto;
  padding: 10px 14px;
  resize: vertical;
  min-height: 90px;
}

.ps-field-error {
  font-size: 12px;
  color: #c0392b;
  min-height: 16px;
  line-height: 16px;
}

/* ── Contact-reason accordion ── */
.ps-accordion {
  border: 1px solid rgba(28, 89, 114, 0.22);
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}

.ps-accordion-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: #063c50;
  cursor: pointer;
  gap: 8px;
}

.ps-accordion-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 163, 163, 0.15) inset;
}

.ps-accordion-chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #5f7782;
  transition: transform 200ms ease;
}

.ps-accordion-toggle[aria-expanded="true"] .ps-accordion-chevron {
  transform: rotate(180deg);
}

.ps-accordion-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  border-top: 1px solid rgba(28, 89, 114, 0.08);
  max-height: 220px;
  overflow-y: auto;
}

.ps-accordion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 15px;
  color: #063c50;
  gap: 8px;
  transition: background 120ms ease;
}

.ps-accordion-item:hover {
  background: #EAF7F4;
}

.ps-accordion-item:focus-visible {
  outline: none;
  background: #EAF7F4;
}

.ps-accordion-check {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #00A3A3;
  opacity: 0;
  transition: opacity 160ms ease;
}

.ps-accordion-item-selected .ps-accordion-check {
  opacity: 1;
}

.ps-accordion-item-selected {
  color: #00A3A3;
  font-weight: 600;
}

/* ── Nested accordion: group (parent) ── */
.ps-accordion-group {
  list-style: none;
}

.ps-accordion-group-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: #EAF7F4;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #063c50;
  cursor: pointer;
  gap: 8px;
  border-bottom: 1px solid rgba(28, 89, 114, 0.08);
}

.ps-accordion-group-btn:hover {
  background: #d8f2ee;
}

.ps-accordion-group-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 163, 163, 0.15) inset;
}

.ps-accordion-group-chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: #5f7782;
  transition: transform 200ms ease;
}

.ps-accordion-group-btn[aria-expanded="true"] .ps-accordion-group-chevron {
  transform: rotate(180deg);
}

/* ── Nested accordion: children ── */
.ps-accordion-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ps-accordion-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 9px 26px;
  cursor: pointer;
  font-size: 14px;
  color: #1C5972;
  gap: 8px;
  border-bottom: 1px solid rgba(28, 89, 114, 0.06);
  transition: background 120ms ease;
}

.ps-accordion-child:last-child {
  border-bottom: none;
}

.ps-accordion-child:hover {
  background: #EAF7F4;
}

.ps-accordion-child:focus-visible {
  outline: none;
  background: #EAF7F4;
}

.ps-accordion-child-selected {
  color: #00A3A3;
  font-weight: 600;
  background: #f0fbf9;
}

.ps-accordion-child-selected .ps-accordion-check {
  opacity: 1;
}

/* ── File input ── */
.ps-file-input {
  height: auto;
  padding: 8px 10px;
  cursor: pointer;
}

.ps-field-help {
  font-size: 12px;
  color: #5f7782;
  margin-top: 2px;
  line-height: 16px;
}
