/* support.css – Chat-style support page */

.supportWrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
  height: calc(100vh - 70px);
  display: flex;
  flex-direction: column;
}

/* ── Gate (not logged in) ── */
.supportGate {
  text-align: center;
  padding: 80px 20px;
}
.supportGate h2 {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 8px;
}
.supportGate p {
  color: var(--muted);
  margin-bottom: 24px;
}
.supportGateBtn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
}
.supportGateBtn:hover { opacity: 0.9; }

/* ── Chat Header ── */
.chatHeader {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
}
.chatHeaderIcon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}
.chatHeaderInfo h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}
.chatHeaderInfo p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.chatTicketBadge {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 8px;
  font-family: var(--mono);
}

/* ── Chat Messages ── */
.chatMessages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chatMsg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: chatFadeIn 0.3s ease;
}
@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chatMsg.assistant { align-self: flex-start; }
.chatMsg.user { align-self: flex-end; flex-direction: row-reverse; }

.chatMsgAvatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  line-height: 1;
}
.chatMsg.assistant .chatMsgAvatar {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
}
.chatMsg.user .chatMsgAvatar {
  background: var(--bd);
  color: var(--text);
}

.chatMsgBubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
  word-break: break-word;
}
.chatMsg.assistant .chatMsgBubble {
  background: var(--card);
  border: 1px solid var(--bd);
  border-bottom-left-radius: 4px;
}
.chatMsg.user .chatMsgBubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chatMsgBubble strong { font-weight: 700; }
.chatMsgBubble ul, .chatMsgBubble ol {
  margin: 8px 0;
  padding-left: 20px;
}
.chatMsgBubble li { margin-bottom: 4px; }

.chatMsgTime {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
  padding: 0 4px;
}
.chatMsg.user .chatMsgTime { text-align: right; }

/* ── Category Picker ── */
.chatCategories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.chatCatBtn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-size: 0.88rem;
  color: var(--text);
}
.chatCatBtn:hover {
  border-color: var(--accent);
  background: var(--bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
}
.chatCatIcon {
  font-size: 1.4rem;
  line-height: 1;
}
.chatCatLabel strong {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.chatCatLabel span {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Chat Input ── */
.chatInputBar {
  padding: 12px 0 16px;
  border-top: 1px solid var(--bd);
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chatInputBar.hidden { display: none; }

.chatInput {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 14px;
  border: 1px solid var(--bd);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.4;
}
.chatInput:focus { border-color: var(--accent); }
.chatInput::placeholder { color: var(--muted); }

.chatSendBtn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.chatSendBtn:hover { opacity: 0.9; }
.chatSendBtn:disabled { opacity: 0.4; cursor: not-allowed; }
.chatSendBtn svg { width: 20px; height: 20px; }

/* ── Action Buttons (escalate, close) ── */
.chatActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
  flex-shrink: 0;
}
.chatActionBtn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--bd);
  background: var(--card);
  color: var(--text);
  transition: all 0.2s;
}
.chatActionBtn:hover { border-color: var(--accent); }
.chatActionBtn.escalate {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}
.chatActionBtn.escalate:hover { background: #fde68a; }
.chatActionBtn.close {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}
.chatActionBtn.close:hover { background: #bbf7d0; }
.chatActionBtn.newChat {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.chatActionBtn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Typing indicator ── */
.typingDots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}
.typingDots span {
  width: 8px;
  height: 8px;
  background: var(--muted);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typingDots span:nth-child(2) { animation-delay: 0.15s; }
.typingDots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Past tickets sidebar ── */
.chatPastTickets {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--bd);
}
.chatPastTickets h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 0 0 10px;
}
.pastTicketItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.pastTicketItem:hover { border-color: var(--accent); }
.pastTicketNum {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
}
.pastTicketSubject {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pastTicketStatus {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.pastTicketStatus.open { background: #fef3c7; color: #92400e; }
.pastTicketStatus.closed { background: #dcfce7; color: #166534; }
.pastTicketStatus.escalated { background: #fecaca; color: #991b1b; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .supportWrap {
    height: calc(100vh - 60px);
    padding: 0 10px;
  }
  .chatCategories {
    grid-template-columns: 1fr;
  }
  .chatMsg { max-width: 92%; }
  .chatMsgBubble { font-size: 0.88rem; padding: 10px 14px; }
  .chatTicketBadge { display: none; }
}
