/* public/assets/css/app.css */
/* Stack: Plus Jakarta Sans · Design system inspirado em Linear + WhatsApp Web */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f0f11;
  --bg2:       #17171a;
  --bg3:       #1e1e22;
  --surface:   #25252a;
  --border:    #2e2e35;
  --border2:   #3a3a42;
  --text:      #e8e8ee;
  --text2:     #9898a8;
  --text3:     #5e5e70;
  --accent:    #25D366;
  --accent-dim:#1ea84f;
  --blue:      #4e8ef7;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --radius:    10px;
  --sidebar-w: 220px;
  --font:      'Plus Jakarta Sans', system-ui, sans-serif;
}

html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* ── Layout shell ──────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 8px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text2);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover  { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.active svg { stroke: #fff; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--border);
}
.agent-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.agent-info { flex: 1; min-width: 0; }
.agent-name { display: block; font-weight: 500; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-role { display: block; font-size: 11px; color: var(--text3); }
.logout-btn { color: var(--text3); text-decoration: none; padding: 4px; border-radius: 6px; transition: color 0.15s; }
.logout-btn:hover { color: var(--red); }

/* ── Main content ──────────────────────────────────── */
.main-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ── Chat layout ───────────────────────────────────── */
.chat-layout { display: flex; height: 100vh; overflow: hidden; }

/* Contacts list */
.contacts-panel {
  width: 300px;
  min-width: 300px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.contacts-header { padding: 16px; border-bottom: 1px solid var(--border); }
.contacts-header h2 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.search-box {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.search-box::placeholder { color: var(--text3); }
.search-box:focus { border-color: var(--accent); }

.contacts-list { flex: 1; overflow-y: auto; }
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  text-decoration: none;
}
.contact-item:hover     { background: var(--bg3); }
.contact-item.active    { background: var(--surface); }
.contact-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; color: var(--accent);
  flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-weight: 500; font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-preview { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.contact-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.contact-time { font-size: 11px; color: var(--text3); }
.badge { background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 600; padding: 1px 6px; }

/* Chat area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
}
.chat-header-info { flex: 1; }
.chat-header-name { font-weight: 600; font-size: 15px; }
.chat-header-status { font-size: 12px; color: var(--text2); }

.messages-area { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 65%; display: flex; flex-direction: column; }
.msg-lead  { align-self: flex-start; }
.msg-agent { align-self: flex-end; }
.msg-ai    { align-self: flex-end; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}
.msg-lead  .msg-bubble { background: var(--surface); color: var(--text); border-bottom-left-radius: 4px; }
.msg-agent .msg-bubble { background: var(--accent);  color: #fff;        border-bottom-right-radius: 4px; }
.msg-ai    .msg-bubble { background: #1a2f40;         color: #7dd3fc;     border-bottom-right-radius: 4px; border: 1px solid #1e4060; }
.msg-meta  { font-size: 11px; color: var(--text3); margin-top: 3px; padding: 0 4px; }
.msg-ai .msg-meta::before { content: '🤖 IA · '; }

.chat-input-area {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 14px;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 140px;
  transition: border-color 0.15s;
}
.chat-input:focus { border-color: var(--accent); }
.btn-send {
  width: 44px; height: 44px;
  background: var(--accent);
  border: none; border-radius: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.btn-send:hover { background: var(--accent-dim); }
.btn-send svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 2; }

/* Lead detail panel */
.lead-panel {
  width: 280px;
  min-width: 280px;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.lead-panel-section h3 { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.lead-field { margin-bottom: 10px; }
.lead-field label { display: block; font-size: 11px; color: var(--text3); margin-bottom: 4px; }
.lead-field input, .lead-field select, .lead-field textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.lead-field input:focus, .lead-field select:focus, .lead-field textarea:focus { border-color: var(--accent); }
.lead-field textarea { resize: vertical; min-height: 70px; }

/* ── Kanban ────────────────────────────────────────── */
.kanban-layout { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.kanban-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.kanban-header h1 { font-size: 18px; font-weight: 600; flex: 1; }
.kanban-board { flex: 1; overflow-x: auto; display: flex; gap: 16px; padding: 20px 24px; align-items: flex-start; }
.kanban-col {
  min-width: 260px;
  width: 260px;
  background: var(--bg2);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
}
.kanban-col-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.kanban-col-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-name { font-weight: 600; font-size: 13px; flex: 1; }
.kanban-col-count { background: var(--surface); color: var(--text2); font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.kanban-cards { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  user-select: none;
}
.kanban-card:hover { border-color: var(--border2); }
.kanban-card.dragging { opacity: 0.5; transform: scale(0.97); }
.kanban-card.drag-over { border-color: var(--accent); border-style: dashed; }
.card-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.card-phone { font-size: 12px; color: var(--text2); }
.card-agent { font-size: 11px; color: var(--text3); margin-top: 6px; }
.card-preview { font-size: 12px; color: var(--text2); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-family: var(--font);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  border: none; transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg3); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-sm        { padding: 5px 10px; font-size: 12px; }

/* ── Forms / Tables ────────────────────────────────── */
.page-wrapper { padding: 24px; overflow-y: auto; height: 100vh; }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.page-header h1 { font-size: 20px; font-weight: 600; flex: 1; }

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; font-weight: 500; }
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--accent); }
.form-control[type="range"] { padding: 0; background: none; border: none; }
select.form-control option { background: var(--bg3); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill-green  { background: #0d2e1a; color: #4ade80; }
.pill-blue   { background: #0d1e3a; color: #60a5fa; }
.pill-amber  { background: #2e1e05; color: #fbbf24; }
.pill-red    { background: #2e0d0d; color: #f87171; }
.pill-gray   { background: var(--surface); color: var(--text2); }

/* ── Alerts ────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #0d2e1a; color: #4ade80; border: 1px solid #166534; }
.alert-error   { background: #2e0d0d; color: #f87171; border: 1px solid #991b1b; }

/* ── Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 440px;
  max-width: 95vw;
}
.modal h2 { font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }

/* ── Auth ──────────────────────────────────────────── */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.auth-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 40px; width: 380px; max-width: 95vw; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-size: 18px; font-weight: 700; }
.auth-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-card p  { color: var(--text2); font-size: 14px; margin-bottom: 24px; }
