/* ============================================================
   support.css — chat de suporte (user + admin)
   ============================================================ */

/* Modal maior pra caber a conversa */
.sp-modal { max-width: 520px !important; display: flex; flex-direction: column; }

/* Views (list / new / thread) */
.sp-view { display: flex; flex-direction: column; gap: 12px; }
.sp-view[hidden] { display: none; }

/* ─── Botão voltar ─────────────────────────────────────────── */
.sp-back {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none;
  color: var(--text-secondary, #475467);
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  padding: 4px 0; margin-bottom: 6px;
  cursor: pointer;
  transition: color .15s ease;
}
.sp-back:hover { color: var(--text-primary, #0B1220); }

/* ─── VIEW 1: Lista de tickets ─────────────────────────────── */
.sp-list-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 6px;
}
.sp-intro {
  font-size: 13px;
  color: var(--text-secondary, #475467);
  line-height: 1.5;
  margin: 0; max-width: 320px;
}
.sp-tickets-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 420px; overflow-y: auto;
}
.sp-ticket-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; text-align: left;
  background: #fff; font-family: inherit;
  border: 1px solid var(--border-subtle, #F0F2F5);
  border-radius: 12px; cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.sp-ticket-item:hover {
  border-color: var(--border-card, #E4E7EC);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15,23,42,.05);
}
.sp-ticket-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 2px;
}
.sp-ticket-head strong {
  font-size: 13.5px; color: var(--text-primary, #0B1220);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-ticket-preview {
  font-size: 12.5px; color: var(--text-secondary, #475467);
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-ticket-date {
  font-size: 11px; color: var(--text-muted, #667085); margin-top: 2px;
}

/* Pill de status */
.sp-status {
  font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 9px; border-radius: 999px; flex-shrink: 0;
  white-space: nowrap;
}
.sp-open     { background: rgba(245,158,11,.10); color: #B45309; }
.sp-answered { background: rgba(16,185,129,.10); color: #059669; }
.sp-closed   { background: var(--bg-elevated, #F2F4F7); color: var(--text-muted, #667085); }

/* ─── VIEW 3: Thread (conversa) ────────────────────────────── */
.sp-thread-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle, #F0F2F5);
  margin-bottom: 8px;
}
.sp-thread-title { flex: 1; min-width: 0; }
.sp-thread-title strong {
  display: block; font-size: 15px; font-weight: 800;
  color: var(--text-primary, #0B1220);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
}
.sp-thread-head .sp-back { margin: 0; padding: 6px; border-radius: 8px; }
.sp-thread-head .sp-back:hover { background: var(--bg-elevated, #F2F4F7); }

.sp-thread-messages {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 380px; overflow-y: auto;
  padding: 4px 4px 8px;
  scroll-behavior: smooth;
}

/* Bolhas do chat */
.sp-msg { display: flex; flex-direction: column; max-width: 82%; }
.sp-msg-user  { align-self: flex-end;   align-items: flex-end; }
.sp-msg-admin { align-self: flex-start; align-items: flex-start; }
.sp-msg-bubble {
  padding: 9px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.5;
  word-break: break-word; white-space: pre-wrap;
}
.sp-msg-user .sp-msg-bubble {
  background: var(--brand-ink, #0F172A);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sp-msg-admin .sp-msg-bubble {
  background: var(--bg-elevated, #F2F4F7);
  color: var(--text-primary, #0B1220);
  border-bottom-left-radius: 4px;
}
.sp-msg-time {
  font-size: 10.5px; color: var(--text-muted, #667085);
  margin-top: 3px; padding: 0 4px;
}

/* Form de resposta (chat input) */
.sp-thread-form {
  display: flex; align-items: flex-end; gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle, #F0F2F5);
}
.sp-thread-form textarea {
  flex: 1; min-height: 40px; max-height: 120px;
  padding: 8px 12px;
  border: 1px solid var(--border-card, #E4E7EC);
  border-radius: 12px;
  font-family: inherit; font-size: 13.5px; line-height: 1.4;
  color: var(--text-primary, #0B1220);
  resize: vertical;
  transition: border-color .15s ease;
}
.sp-thread-form textarea:focus {
  border-color: var(--brand-ink, #0F172A);
  box-shadow: 0 0 0 3px rgba(15,23,42,.08);
  outline: none;
}
.sp-thread-form .btn {
  padding: 8px 14px;
  height: 40px;
}

/* ────────────────────────────────────────────────────────────
   Admin — lista de chamados
   ──────────────────────────────────────────────────────────── */
.admin-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 8px;
  background: var(--bg-elevated, #F2F4F7);
  border-radius: 999px;
  font-size: 12px; font-weight: 800;
  color: var(--text-secondary, #475467);
}
.admin-tickets-list {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 14px;
}
.admin-ticket {
  display: flex; flex-direction: column;
  padding: 14px 16px; text-align: left;
  background: #fff; font-family: inherit;
  border: 1px solid var(--border-card, #E4E7EC);
  border-radius: 12px; cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.admin-ticket:hover {
  border-color: var(--brand-ink, #0F172A);
  box-shadow: 0 8px 20px rgba(15,23,42,.06);
  transform: translateY(-1px);
}
.admin-ticket-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 6px;
}
.admin-ticket-head strong {
  display: block; font-size: 14px; font-weight: 700;
  color: var(--text-primary, #0B1220); margin-bottom: 3px;
}
.admin-ticket-meta {
  display: block; font-size: 12px; color: var(--text-muted, #667085);
}
.admin-ticket-meta strong { display: inline; color: var(--text-secondary, #475467); font-size: inherit; }
.admin-ticket-status {
  font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 10px; border-radius: 999px;
  white-space: nowrap; flex-shrink: 0;
}
.admin-ticket-open     { background: rgba(245,158,11,.10); color: #B45309; border: 1px solid rgba(245,158,11,.28); }
.admin-ticket-answered { background: rgba(16,185,129,.10); color: #059669; border: 1px solid rgba(16,185,129,.28); }
.admin-ticket-closed   { background: var(--bg-elevated, #F2F4F7); color: var(--text-muted, #667085); border: 1px solid var(--border-subtle, #F0F2F5); }
.admin-ticket-msg {
  font-size: 13px;
  color: var(--text-secondary, #475467);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Checkbox opcional pra também disparar e-mail */
.admin-ticket-check {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-secondary, #475467);
  padding: 4px 0;
  user-select: none;
}
.admin-ticket-check input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--brand-ink, #0F172A);
  cursor: pointer; flex-shrink: 0;
}
.admin-ticket-check strong { color: var(--text-primary, #0B1220); }
