/* admin_base.css - Core design system, layout, tickets base, auth shell */

/* ZapSet - Admin UI (Design System)
   Paleta oficial:
   - Tech Blue: #1F3C88
   - Zap Green: #2ECC71
   - Teal Tech: #16A085
   - Neutros: dark #0F172A | gray #334155 | light #F8FAFC | border #E2E8F0
*/
:root{
  --primary:#1F3C88;
  --secondary:#2ECC71;
  --teal:#16A085;
  --warning:#F59E0B;
  --danger:#EF4444;

  --link: var(--primary);

  --radius:10px;

  --bg:#F8FAFC;
  --surface:#FFFFFF;
  --surface2:#F1F5F9;
  --text:#0F172A;
  --muted:#475569;
  --border:#E2E8F0;

  --shadow: 0 10px 28px rgba(15, 23, 42, .08);
  --shadow-sm: 0 6px 18px rgba(15, 23, 42, .06);

  --focus: 0 0 0 3px rgba(46, 204, 113, .25);
}

html[data-theme="dark"]{
  --link:#93C5FD;
  --bg:#0F172A;
  --surface:#020617;
  --surface2:#162037;
  --text:#E5E7EB;
  --muted:#94A3B8;
  --border:#1E293B;

  --shadow: 0 10px 28px rgba(0,0,0,.35);
  --shadow-sm: 0 6px 18px rgba(0,0,0,.28);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(900px 520px at 15% 0%, rgba(46,204,113,.20), transparent 60%),
    radial-gradient(900px 520px at 85% 0%, rgba(31,60,136,.18), transparent 55%),
    var(--bg);
}

/* Links */
a{color:inherit}
.link{
  color: var(--link);
  text-decoration: none;
}
.link:hover{text-decoration: underline}

/* Topbar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 16px;
  border-bottom:1px solid var(--border);
  background: color-mix(in srgb, var(--surface), transparent 6%);
  backdrop-filter: blur(10px);
}

.brandLink{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:inherit;
}
.brandIcon{
  width:34px;
  height:34px;
  display:block;
}
html[data-theme="dark"] .brandIcon{
  filter: brightness(0) invert(1);
}
.brandText{
  font-weight: 700;
  letter-spacing: .2px;
}

.right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
  flex-wrap:wrap;
  text-align:right;
}

.muted{color:var(--muted)}
.small{font-size:12px}

/* Layout */
.grid{
  display:grid;
  grid-template-columns: 1fr 1.4fr;
  gap:14px;
  padding:14px;
}
@media (max-width: 980px){
  .grid{grid-template-columns: 1fr}
}
.col{display:flex;flex-direction:column;gap:14px}

/* Cards */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding:16px;
  box-shadow: var(--shadow-sm);
}
.card2{
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding:14px;
}
.h1{font-size:22px;font-weight:700;margin:0 0 6px}
.h2{font-size:16px;font-weight:700;margin:0 0 4px}
.h3{font-size:14px;font-weight:700;margin:0 0 10px}

/* Controls */
input,select,textarea{
  width: 100%;
  background: var(--surface);
  border:1px solid var(--border);
  color:var(--text);
  padding:10px 12px;
  border-radius: var(--radius);
  outline:none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea{min-height:84px;resize:vertical}
input:focus,select:focus,textarea:focus{
  border-color: var(--border);
  box-shadow: var(--focus);
}

.inline{display:inline-flex;gap:8px;align-items:center}
.actions{display:flex;gap:8px;flex-wrap:wrap}

/*
  Icon buttons
  -------------
  IMPORTANT:
  - .btn é um botão "primário" (ex.: Salvar / Assumir / Enviar)
  - .iconBtn (e .btn2/.pill quando usados como ícone) são botões quadrados 34x34
  Durante melhorias anteriores, .btn acabou herdando o estilo de ícone, e
  botões de ação na dashboard ficaram "quadradinhos" (texto sumindo).
*/
.btn2,.pill,.iconBtn{
  width: 34px;
  height: 34px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, border-color .12s ease, opacity .15s ease;
}

/*
  Botão primário (padrão "Salvar")
  - Mantém compatibilidade com o sistema todo sem criar novas classes.
  - Não interfere nos ícones porque eles usam .iconBtn.
*/
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  width: auto;
  height: auto;
  padding: 14px 22px;
  border-radius: 14px;

  background: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary), #000 10%);
  color: #fff;
  font-weight: 800;
  letter-spacing: .2px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, opacity .15s ease;
}
.btn:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  filter: brightness(1.03);
}
.btn:active{
  transform: translateY(0);
  box-shadow: none;
}
.btn:focus-visible{
  outline: none;
  box-shadow: var(--focus);
}
.btn:disabled{
  opacity: .65;
  cursor: not-allowed;
}
.iconBtn:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--teal), var(--border) 65%);
  background: var(--surface2);
}
.iconBtn:active{
  transform: translateY(0);
  box-shadow: none;
}
.iconBtn:focus-visible{
  outline: none;
  box-shadow: var(--focus);
}
.icon{
  width:18px;
  height:18px;
  display:block;
}

/* Utilities */
.zs-centerText{text-align:center}
.zs-mb10{margin-bottom:10px}
.zs-formMax360{max-width:360px}
.zs-alertCompact{margin:0 0 12px 0;padding:8px 10px}
.zs-h2-lg{font-size:18px}
.zs-bubbleMeta{margin-bottom:6px}
.zs-actionsTop{margin-top:10px}
.zs-actionCol{width:110px}
.zs-spacer-6{height:6px}
.zs-spacer-8{height:8px}
.zs-spacer-10{height:10px}
.zs-spacer-12{height:12px}

/* Lists */
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 12px;
  margin-bottom:8px;
  background: color-mix(in srgb, var(--surface), var(--teal) 2%);
}

.ticket{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 12px;
  margin-bottom:8px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.ticket:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--primary), var(--border) 65%);
}
.ticketLink{text-decoration:none;color:inherit;display:block}

/* =============================
   Tickets (fila) - layout compacto (Outlook-like)
   Objetivo: alta densidade de informação, responsivo
============================= */
.card.card-tickets .ticket{
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 12px;
}
.card.card-tickets .ticket:hover{
  transform: none; /* evita “pular” e gastar espaço visual */
}

/* quebra inteligente: se não couber, vai pra linha de baixo (desktop e mobile) */
.zs-ticketRow{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* conteúdo principal ocupa o máximo e pode quebrar */
.zs-ticketMain{
  flex: 1 1 320px; /* cresce, encolhe, e quebra se precisar */
  min-width: 0;
}

/* Meta da direita: permite quebra do nome do atendente em linha de baixo quando necessário */
.zs-ticketMeta{
  display: flex;            /* não inline-flex */
  flex-direction: row;
  flex-wrap: wrap;          /* permite quebrar */
  align-items: center;
  justify-content: flex-end;
  gap: 8px;

  margin-left: auto;        /* mantém à direita quando cabe */
  max-width: 42%;           /* limita a coluna da direita em telas médias */
  min-width: 220px;         /* evita ficar pequeno demais */
}

/* Nome do atendente: pode quebrar pra linha de baixo */
.zs-ticketAttendant{
  flex: 1 1 140px;          /* deixa “cair” quando precisar */
  min-width: 0;
  white-space: nowrap;      /* mantém 1 linha */

  text-overflow: ellipsis;  /* se for muito grande */
}

/* Badge do status: não quebra */
.zs-ticketStatus{
  flex: 0 0 auto;
}


.zs-ticketTop{
  display: flex;
  flex-wrap: wrap;        /* <- permite pular para baixo */
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}


.zs-ticketId{
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
}
.zs-ticketPhone{
  font-weight: 600;
  white-space: nowrap;
}
.zs-ticketReason{
  color: var(--muted);
  font-size: 12px;
  min-width: 0;

  /* permite cair pra linha de baixo sem “encavalar” */
  flex: 1 1 240px;

  /* mantém 1 linha com ellipsis, mesmo quando vira a linha de baixo */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;

}


.zs-ticketBottom{
  margin-top: 2px;
  display:flex;
  gap: 8px;
  align-items:center;
  min-width:0;
}
.zs-slaLabel{
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.zs-slaOk{color: color-mix(in srgb, var(--teal), var(--text) 35%);}
.zs-slaOver{color: var(--danger);}
.zs-slaDetail{
  font-size: 12px;
  color: var(--muted);
  min-width:0;
  white-space: nowrap;

  text-overflow: ellipsis;
}


.zs-statusPill{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface), var(--primary) 4%);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  text-transform: lowercase;
}
.zs-attName{
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* Status variants (safe default) */
.zs-st--open{
  border-color: color-mix(in srgb, var(--teal), var(--border) 50%);
  background: color-mix(in srgb, var(--surface), var(--teal) 10%);
}
.zs-st--assigned{
  border-color: color-mix(in srgb, var(--primary), var(--border) 55%);
  background: color-mix(in srgb, var(--surface), var(--primary) 10%);
}
.zs-st--closed{
  opacity: .75;
}

@media (max-width: 680px){
  .zs-ticketRow{grid-template-columns: 1fr}
  .zs-ticketMeta{justify-content:flex-start}
  .zs-slaDetail{max-width:100%}
}

/* Chat */
.chat{
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height:55vh;
  overflow:auto;
  padding-right:6px;
}
.bubble{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 12px;
  background: var(--surface);
}
.bubble.user{border-left:4px solid var(--primary)}
.bubble.assistant{border-left:4px solid var(--secondary)}
.bubble.system{border-left:4px solid #F59E0B}

.send{display:flex;gap:10px;margin-top:10px}
.send textarea{flex:1}
/* Attachments (composer) */
.zs-attachBtn{
  border-color: var(--border);
}
.zs-attachBtn:hover{
  border-color: color-mix(in srgb, var(--primary), var(--border) 60%);
  background: color-mix(in srgb, var(--surface), var(--primary) 6%);
}
.zs-attachPreview{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
}
.zs-attachItem{
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--border);
  border-radius:14px;
  padding:6px 8px;
  background: color-mix(in srgb, var(--surface), var(--primary) 3%);
  max-width:100%;
}
.zs-attachThumb{
  width:32px;
  height:32px;
  border-radius:10px;
  object-fit:cover;
  border:1px solid var(--border);
  flex:0 0 auto;
}
.zs-attachFileIcon{
  width:32px;
  height:32px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  background: color-mix(in srgb, var(--surface), var(--secondary) 6%);
  flex:0 0 auto;
  font-size:16px;
}
.zs-attachMeta{min-width:0}
.zs-attachName{
  font-size:12px;
  font-weight:600;
  line-height:1.1;
  max-width:240px;
  white-space:nowrap;

  text-overflow:ellipsis;
}
.zs-attachSize{
  font-size:11px;
  opacity:.75;
  margin-top:2px;
}
.zs-attachRemove{
  border:1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  width:26px;
  height:26px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  flex:0 0 auto;
}
.zs-attachRemove:hover{
  border-color: color-mix(in srgb, var(--danger), var(--border) 60%);
  background: color-mix(in srgb, var(--surface), var(--danger) 6%);
}

/* SLA */
.ticketOverdue{
  border-color: color-mix(in srgb, var(--danger), var(--border) 45%) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .10);
}
.ticketOverdue:hover{
  border-color: color-mix(in srgb, var(--danger), var(--border) 30%) !important;
}

/* Toast */
.toast{
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  max-width: calc(100vw - 32px);
}
.toast.show{
  opacity: 1;
  transform: translateY(0);
}


/* ================================
   STATUS ATENDENTE – DARK MODE
================================ */

[data-theme="dark"] .status-btn {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

/* DISPONÍVEL */
[data-theme="dark"] .status-btn.available {
  border-color: #2ECC71;
  color: #2ECC71;
}

/* INDISPONÍVEL */
[data-theme="dark"] .status-btn.unavailable {
  border-color: #EF4444;
  color: #EF4444;
}

[data-theme="dark"] .status-btn.unavailable:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* =========================================
   Status badge (Atendentes) - pill with dot
   (Used on dashboard attendants availability)
========================================= */
.status-badge{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text);
  font-weight:600;
  line-height:1;
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.status-badge::before{
  content:"";
  width:10px;
  height:10px;
  border-radius:999px;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(31,60,136,.08);
}
.status-badge:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.status-badge:active{
  transform: translateY(0);
  box-shadow: none;
}
.status-badge.available{
  color: var(--secondary);
  border-color: rgba(46, 204, 113, .45);
  background: rgba(46, 204, 113, .08);
}
.status-badge.unavailable{
  color: var(--danger);
  border-color: rgba(239, 68, 68, .45);
  background: rgba(239, 68, 68, .08);
}

/* Dark mode tuning */
[data-theme="dark"] .status-badge{
  background: rgba(255,255,255,.03);
  border-color: rgba(226,232,240,.14);
}
[data-theme="dark"] .status-badge.available{
  border-color: rgba(46, 204, 113, .55);
  background: rgba(46, 204, 113, .10);
}
[data-theme="dark"] .status-badge.unavailable{
  border-color: rgba(239, 68, 68, .55);
  background: rgba(239, 68, 68, .10);
}


/* =========================================================
   ZapSet Auth Pages (login/forgot/reset) – FIX (scoped)
   - This block is SAFE to append at the END of style.css
   - Scoped to .auth-page to avoid affecting dashboard/admin UI
   ========================================================= */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg, #F8FAFC);
  color: var(--text, #0F172A);
}

.auth-page .auth-center {
  width: 100%;
  max-width: 600px; /* matches public/index.php card feel */
}

.auth-page .auth-card {
  width: 100%;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 16px;
  background: var(--card, #FFFFFF);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  padding: clamp(18px, 3vw, 28px);
}


.auth-page .auth-logo {
  display: flex;
  justify-content: center;
  margin: 0 0 16px 0;
}

.auth-page .auth-logo img {
  width: 100%;
  max-width: 200px;
  height: auto;
}


.auth-page .auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 8px 0 14px;
  text-align: center;
}

.auth-page .auth-subtitle {
  text-align: center;
  color: var(--muted, #475569);
  margin-bottom: 14px;
}

.auth-page form {
  display: grid;
  gap: 12px;
}

.auth-page input[type="text"],
.auth-page input[type="email"],
.auth-page input[type="password"],
.auth-page input[type="tel"]{
  width: 100%;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 10px;
  padding: 12px 12px;
  font-size: 0.98rem;
  background: #fff;
}

.auth-page .btnPrimary,
.auth-page button[type="submit"],
.auth-page .btn {
  border-radius: 10px;
}

.zs-contactHeadingInline{
  display:inline-flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}

.zs-idBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:20px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--border), transparent 12%);
  background: color-mix(in srgb, var(--surface), var(--bg) 18%);
  color: var(--muted);
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  line-height:1;
  white-space:nowrap;
}

.zs-idBadge--phone{
  color: color-mix(in srgb, var(--secondary), var(--text) 30%);
  border-color: color-mix(in srgb, var(--secondary), var(--border) 65%);
}

.zs-idBadge--waid{
  color: color-mix(in srgb, var(--teal), var(--text) 28%);
  border-color: color-mix(in srgb, var(--teal), var(--border) 68%);
}

.zs-idBadge--lid{
  color: color-mix(in srgb, var(--primary), var(--text) 22%);
  border-color: color-mix(in srgb, var(--primary), var(--border) 62%);
}

.zs-idBadge--parent-bsuid{
  color: color-mix(in srgb, var(--warning), var(--text) 26%);
  border-color: color-mix(in srgb, var(--warning), var(--border) 68%);
}

.zs-idBadge--bsuid,
.zs-idBadge--unknown{
  color: var(--muted);
  border-color: color-mix(in srgb, var(--muted), var(--border) 70%);
}

.zs-ticketRef{
  color: var(--muted);
  font-size:12px;
}

.zs-contactSummary{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
