/* Payment Store admin support chat — dark charcoal + gold (panel.paymentstore.org) */

.support-chat-overlay {
  --sc-ink: #f3efe6;
  --sc-muted: #a89f90;
  --sc-faint: #6f685c;
  --sc-bg: #0c0e14;
  --sc-panel: #12151c;
  --sc-panel-2: #181c27;
  --sc-panel-3: #1e2432;
  --sc-line: rgba(243, 239, 230, 0.09);
  --sc-line-strong: rgba(243, 239, 230, 0.18);
  --sc-gold: #f0b74a;
  --sc-gold-2: #c88820;
  --sc-gold-soft: rgba(240, 183, 74, 0.14);
  --sc-gold-mid: rgba(240, 183, 74, 0.28);
  --sc-danger: #ff8d7b;
  --sc-danger-line: rgba(255, 141, 123, 0.45);
  --sc-radius: 14px;
  --sc-radius-sm: 10px;
  --sc-font: Outfit, system-ui, sans-serif;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(6, 8, 12, 0.78);
  display: grid;
  place-items: center;
  padding: 16px;
  backdrop-filter: blur(6px);
}

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

.support-chat-dialog {
  width: min(1120px, 100%);
  height: min(840px, 93vh);
  background:
    linear-gradient(180deg, rgba(240, 183, 74, 0.04) 0%, transparent 120px),
    var(--sc-panel);
  border: 1px solid var(--sc-line-strong);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--sc-ink);
  font-family: var(--sc-font);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(240, 183, 74, 0.06);
}

.support-chat-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sc-line);
  background: rgba(0, 0, 0, 0.18);
}

.support-chat-dialog-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--sc-ink);
}

.support-chat-dialog-meta {
  margin: 3px 0 0;
  color: var(--sc-muted);
  font-size: 11.5px;
}

.support-chat-dialog-head .btn.ghost,
.support-chat-dialog-head .support-chat-icon-btn {
  border: 1px solid var(--sc-gold-mid) !important;
  background: transparent !important;
  color: #f6e2b8 !important;
  border-radius: 999px !important;
  padding: 0 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  min-height: 0 !important;
  width: 36px !important;
  height: 36px !important;
  display: inline-grid !important;
  place-items: center !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.support-chat-dialog-head .btn.ghost:hover,
.support-chat-dialog-head .support-chat-icon-btn:hover {
  background: var(--sc-gold-soft) !important;
  border-color: rgba(240, 183, 74, 0.55) !important;
  color: #ffe2a8 !important;
}

.support-chat-dialog-head .support-chat-icon-btn svg {
  display: block;
}

.support-chat-dialog-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--sc-bg);
}

.support-chat-list {
  border-right: 1px solid var(--sc-line);
  overflow: auto;
  padding: 10px;
  background: linear-gradient(180deg, var(--sc-panel-2), var(--sc-bg));
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 183, 74, 0.35) transparent;
}

.support-chat-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  border-radius: var(--sc-radius-sm);
  padding: 9px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.support-chat-item:hover {
  border-color: rgba(240, 183, 74, 0.22);
  background: rgba(240, 183, 74, 0.05);
}

.support-chat-item.is-active {
  border-color: rgba(240, 183, 74, 0.6);
  background: linear-gradient(135deg, rgba(240, 183, 74, 0.16), rgba(240, 183, 74, 0.06));
  box-shadow: inset 0 0 0 1px rgba(240, 183, 74, 0.08);
}

.support-chat-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 650;
  margin-bottom: 3px;
  color: var(--sc-ink);
}

.support-chat-item-preview {
  color: var(--sc-muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.support-chat-badge,
.payli-side-mail-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd06a, var(--sc-gold));
  color: #1a140c;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
}

.support-chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(ellipse 80% 40% at 70% 0%, rgba(240, 183, 74, 0.05), transparent 55%),
    var(--sc-panel);
}

.support-chat-main-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--sc-line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  background: rgba(0, 0, 0, 0.16);
}

.support-chat-main-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
}

.support-chat-main-head p {
  margin: 3px 0 0;
  color: var(--sc-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.support-chat-status {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.support-chat-thread {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 183, 74, 0.35) transparent;
}

.support-chat-msg {
  max-width: 76%;
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.support-chat-msg.is-visitor {
  align-self: flex-start;
  background: var(--sc-panel-3);
  border: 1px solid var(--sc-line-strong);
  border-bottom-left-radius: 4px;
  color: var(--sc-ink);
}

.support-chat-msg.is-staff {
  align-self: flex-end;
  background: linear-gradient(160deg, rgba(240, 183, 74, 0.22), rgba(240, 183, 74, 0.1));
  border: 1px solid rgba(240, 183, 74, 0.42);
  border-bottom-right-radius: 4px;
  color: #fff6e4;
}

.support-chat-msg.is-system {
  align-self: center;
  max-width: 92%;
  color: var(--sc-muted);
  background: transparent;
  border: 0;
  font-size: 12px;
  text-align: center;
  padding: 4px 8px;
  line-height: 1.3;
}

.support-chat-msg a {
  color: var(--sc-gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(240, 183, 74, 0.35);
}

.support-chat-msg a:hover {
  color: #ffd06a;
  border-bottom-color: rgba(255, 208, 106, 0.7);
}

.support-chat-composer {
  --sc-composer-h: 48px;
  border-top: 1px solid var(--sc-line);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: stretch;
  background: rgba(0, 0, 0, 0.22);
}

/* Custom PS field — fixed height, no OS resize chrome */
.support-chat-composer textarea,
#supportChatReplyText {
  flex: 1 1 auto;
  width: 100%;
  height: var(--sc-composer-h) !important;
  min-height: var(--sc-composer-h) !important;
  max-height: var(--sc-composer-h) !important;
  resize: none !important;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid rgba(240, 183, 74, 0.28);
  background:
    linear-gradient(180deg, rgba(240, 183, 74, 0.06), transparent 40%),
    var(--sc-panel-2);
  color: var(--sc-ink);
  padding: 12px 14px;
  margin: 0;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.35;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  appearance: none;
  -webkit-appearance: none;
  field-sizing: fixed;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.support-chat-composer textarea:focus,
#supportChatReplyText:focus {
  border-color: rgba(240, 183, 74, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 3px var(--sc-gold-soft);
  background:
    linear-gradient(180deg, rgba(240, 183, 74, 0.1), transparent 45%),
    #1a2030;
}

.support-chat-composer textarea::placeholder,
#supportChatReplyText::placeholder {
  color: var(--sc-faint);
}

/* Hide native resize grip / OS chrome leftovers */
.support-chat-composer textarea::-webkit-resizer,
.support-chat-composer textarea::-webkit-scrollbar-corner {
  display: none;
  background: transparent;
}

/* Gold send CTA — same height as field */
.support-chat-composer > button[type="submit"],
.support-chat-composer .support-chat-send,
#supportChatReplyForm > button[type="submit"] {
  flex: 0 0 auto;
  align-self: stretch;
  height: var(--sc-composer-h) !important;
  min-height: var(--sc-composer-h) !important;
  max-height: var(--sc-composer-h) !important;
  min-width: 120px;
  border: 0 !important;
  border-radius: 12px !important;
  padding: 0 20px !important;
  font: inherit !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: #1a140c !important;
  background: linear-gradient(135deg, #ffd06a 0%, var(--sc-gold) 48%, var(--sc-gold-2) 100%) !important;
  box-shadow: 0 8px 20px rgba(200, 136, 32, 0.28) !important;
  transition: filter 0.15s ease, transform 0.12s ease;
  display: inline-grid !important;
  place-items: center !important;
}

.support-chat-composer > button[type="submit"]:hover,
#supportChatReplyForm > button[type="submit"]:hover {
  filter: brightness(1.06);
}

.support-chat-composer > button[type="submit"]:active,
#supportChatReplyForm > button[type="submit"]:active {
  transform: translateY(1px);
}

.support-chat-empty {
  color: var(--sc-muted);
  text-align: center;
  padding: 28px 12px;
  font-size: 13px;
}

.support-chat-error {
  color: var(--sc-danger);
  font-size: 12.5px;
  padding: 6px 16px 0;
}

.support-chat-delete-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--sc-danger-line);
  color: var(--sc-danger);
  background: rgba(255, 141, 123, 0.08);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.support-chat-delete-btn:hover:not(:disabled) {
  background: rgba(255, 141, 123, 0.18);
  border-color: rgba(255, 141, 123, 0.8);
  color: #ffb2a6;
}

.support-chat-delete-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.support-chat-delete-btn svg {
  display: block;
}

.payli-side-chat-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payli-side-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (max-width: 860px) {
  .support-chat-dialog-body {
    grid-template-columns: 1fr;
  }
  .support-chat-list {
    max-height: 26vh;
    border-right: 0;
    border-bottom: 1px solid var(--sc-line);
  }
  .support-chat-composer {
    flex-wrap: wrap;
  }
  .support-chat-composer > button[type="submit"],
  #supportChatReplyForm > button[type="submit"] {
    width: 100%;
    height: var(--sc-composer-h) !important;
  }
}
