/* ============================================================
   ESTILOS CRM AZEVEDO NETO ADVOGADOS - LAW FIRM DARK GLASSMORPHISM
   ============================================================ */

:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --border-color: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #c5a059;
  --accent-cyan: #38bdf8;
  --accent-green: #34d399;
  --accent-amber: #fbbf24;
  --accent-red: #f87171;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Modal de Login (Proteção de Acesso) */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.95);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--accent-gold);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  padding: 32px 28px;
  box-shadow: 0 0 30px rgba(197, 160, 89, 0.15);
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo .logo-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

.login-logo h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-gold);
}

.login-logo p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.login-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.login-group input {
  background: var(--bg-primary);
  border: 1px solid #334155;
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.login-group input:focus {
  border-color: var(--accent-gold);
}

.btn-login-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-gold), #92400e);
  color: #000;
  font-weight: 800;
  font-size: 14px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-login-submit:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.login-error-msg {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--accent-red);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  text-align: center;
}

/* Header */
.app-header {
  height: 64px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.header-left .logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 24px;
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent-gold);
}

.sub-title {
  font-size: 11px;
  color: var(--text-muted);
}

/* Search Box */
.header-center {
  flex: 1;
  max-width: 450px;
  margin: 0 24px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-card);
  border: 1px solid #334155;
  border-radius: 8px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent-gold);
}

/* Header Right Metrics */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-green);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.metric-pill {
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid #334155;
}

.btn-logout {
  background: rgba(248, 113, 113, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: rgba(248, 113, 113, 0.2);
}

/* Kanban Wrapper */
.kanban-wrapper {
  flex: 1;
  overflow-x: auto;
  padding: 20px 24px;
  background: var(--bg-primary);
}

.kanban-board {
  display: flex;
  gap: 16px;
  height: 100%;
  min-width: 100%;
}

.kanban-col {
  flex: 0 0 310px;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 104px);
}

.col-header {
  padding: 14px 16px;
  border-bottom: 1px solid #1e293b;
}

.col-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-gold);
}

.col-stats {
  font-size: 11px;
  color: var(--text-muted);
}

.col-cards-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Lead Cards */
.lead-card {
  background: var(--bg-card);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.lead-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.2);
}

.lead-card.paused-ai {
  border-left: 4px solid var(--accent-amber);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #334155;
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-phone {
  font-size: 11px;
  color: var(--text-muted);
}

.card-caso-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.card-last-msg {
  font-size: 11px;
  color: #cbd5e1;
  margin-bottom: 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-task, .badge-area, .badge-paused {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-task { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.badge-area { background: rgba(197, 160, 89, 0.15); color: var(--accent-gold); }
.badge-paused { background: rgba(251, 191, 36, 0.2); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); }

/* Modal Split View */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid #334155;
  border-radius: 12px;
  width: 95%;
  max-width: 1250px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-lead-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lead-avatar-lg {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), #92400e);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.modal-lead-info h2 {
  font-size: 16px;
  font-weight: 700;
}

.modal-phone {
  font-size: 12px;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.handoff-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.ai-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}
.ai-status-badge.active { background: rgba(52, 211, 153, 0.2); color: #34d399; }
.ai-status-badge.paused { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }

.btn-handoff {
  background: #334155;
  color: #f8fafc;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-handoff:hover { background: #475569; }
.btn-handoff.active { background: var(--accent-amber); color: #000; }

.stage-select-wrapper label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 6px;
}

.stage-select-wrapper select {
  background: var(--bg-card);
  border: 1px solid #334155;
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.btn-close:hover { color: #fff; }

/* Modal Body Split */
.modal-body-split {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.split-col-left {
  flex: 0 0 450px;
  border-right: 1px solid #1e293b;
  padding: 16px;
  overflow-y: auto;
  background: var(--bg-secondary);
}

.split-col-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #090d16;
}

/* Panel Card & Form */
.panel-card {
  background: var(--bg-card);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 14px;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
}

.btn-save-ficha {
  background: var(--accent-gold);
  color: #000;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.info-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.info-input {
  background: #090d16;
  border: 1px solid #334155;
  color: var(--text-main);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}

.info-input:focus { border-color: var(--accent-gold); }
.info-input.highlight { color: var(--accent-cyan); font-weight: 600; }

/* WhatsApp Chat Timeline */
.chat-tabs-header {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid #1e293b;
}

.chat-tab {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.chat-tab.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
  background: rgba(197, 160, 89, 0.08);
}

.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wpp-chat-header {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid #1e293b;
}

.wpp-lead-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wpp-avatar { font-size: 20px; }
.wpp-lead-info h4 { font-size: 13px; font-weight: 600; }
.wpp-status { font-size: 11px; color: var(--accent-green); }

.wpp-messages-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #05080f;
}

.msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
}

.msg-bubble.lead {
  align-self: flex-start;
  background: #1e293b;
  color: #f8fafc;
  border-bottom-left-radius: 2px;
}

.msg-bubble.juliane {
  align-self: flex-end;
  background: #0284c7;
  color: #fff;
  border-bottom-right-radius: 2px;
}

.msg-author {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 2px;
  opacity: 0.8;
}

.msg-time {
  font-size: 9px;
  opacity: 0.7;
  text-align: right;
  margin-top: 4px;
}

/* Operator Chat Input */
.wpp-footer {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid #1e293b;
  display: flex;
  gap: 8px;
}

.wpp-footer input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid #334155;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.wpp-footer input:focus { border-color: var(--accent-gold); }

.btn-wpp-send {
  background: var(--accent-gold);
  color: #000;
  border: none;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 30px;
}

.loading-spinner {
  text-align: center;
  color: var(--accent-gold);
  padding: 40px;
  font-weight: 600;
}
