/* ============================================================
   II-Chat Monitor — Pro Light Theme (Clean / Flat UI)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-page:     #F3F4F6; /* Vercel/Linear light mode page bg */
  --bg-card:     #FFFFFF;
  --bg-sidebar:  #FFFFFF;
  
  --surface-hover: #F8FAFC;
  --surface-active:#EFF6FF;
  
  --border:      #E5E7EB;
  --border-h:    #D1D5DB;

  --accent:      #2563EB; /* Clean vibrant blue */
  --accent-h:    #1D4ED8;
  --accent-soft: #EFF6FF;
  
  --green:       #10B981;
  --green-soft:  #ECFDF5;
  --yellow:      #F59E0B;
  --yellow-soft: #FFFBEB;
  --red:         #EF4444;
  --red-soft:    #FEF2F2;

  --text-main:   #111827; /* Near black */
  --text-2:      #4B5563; /* Slate grey */
  --text-3:      #9CA3AF; /* Light slate */

  --radius:      16px;
  --radius-sm:   8px;
  --radius-pill: 999px;

  --sidebar-w:   260px;
  --header-h:    72px;

  --shadow-sm:   0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-float:0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);

  --transition:  0.2s ease-in-out;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-h); }
button, input, select, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ── Layout ────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo {
  height: var(--header-h);
  padding: 0 24px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid transparent;
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--text-main);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
}
.sidebar-logo-text { font-weight: 700; font-size: 16px; letter-spacing: -0.3px; }

.sidebar-nav { padding: 24px 16px; flex: 1; }
.nav-section {
  padding: 0 12px 8px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-3);
  margin-top: 16px;
}
.nav-section:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  margin-bottom: 4px;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text-main); }
.nav-item.active {
  background: var(--surface-active);
  color: var(--accent);
}
.nav-item .nav-icon { font-size: 16px; width: 22px; text-align: center; color: var(--text-3); }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-item:hover .nav-icon { color: var(--text-main); }
.nav-item.active:hover .nav-icon { color: var(--accent); }

.nav-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--radius-pill);
}

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg-page);
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  background: var(--accent-h); color: #fff;
  border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.sidebar-user-role { font-size: 12px; color: var(--text-3); }
.sidebar-logout {
  display: block; width: 100%; text-align: center;
  margin-top: 12px; padding: 8px;
  color: var(--text-2); font-size: 13px; font-weight: 500;
  transition: var(--transition);
}
.sidebar-logout:hover { color: var(--red); background: var(--red-soft); border-radius: var(--radius-sm); }

/* ── Main Area ─────────────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w); flex: 1;
  display: flex; flex-direction: column;
}
.topbar {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { 
  font-size: 20px; font-weight: 600; letter-spacing: -0.3px; 
  display: flex; align-items: center; gap: 8px;
}
.topbar-title-date { color: var(--text-3); font-size: 14px; font-weight: 400; margin-left: 8px;}
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 32px 40px; max-width: 1440px; margin: 0 auto; width: 100%; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.card-title {
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-main);
}
.card-title .icon { color: var(--text-3); font-size: 18px; }

/* ── Stats Grid (Flat style) ───────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
}
.stat-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.stat-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.stat-icon { 
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.stat-icon.blue { background: var(--accent-soft); color: var(--accent); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.yellow { background: var(--yellow-soft); color: var(--yellow); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }

.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1; color: var(--text-main); }
.stat-footer { display: flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 12px; color: var(--text-3); }
.stat-trend.positive { color: var(--green); font-weight: 500; }
.stat-trend.negative { color: var(--red); font-weight: 500; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent; transition: var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn-primary {
  background: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-h); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-card); color: var(--text-main); border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-page); border-color: var(--border-h); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 16px 20px; border-radius: var(--radius-sm); font-size: 14px;
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
  border: 1px solid transparent;
}
.alert-warning { background: var(--yellow-soft); border-color: rgba(245, 158, 11, 0.2); color: #B45309; }
.alert-error { background: var(--red-soft); border-color: rgba(239, 68, 68, 0.2); color: #B91C1C; }
.alert-success { background: var(--green-soft); border-color: rgba(16, 185, 129, 0.2); color: #047857; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; line-height: 1;
}
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-yellow { background: var(--yellow-soft); color: #D97706; }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-gray { background: var(--bg-page); color: var(--text-2); border: 1px solid var(--border); }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-top: 16px;}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th {
  text-align: left; padding: 12px 16px;
  font-size: 12px; font-weight: 500; color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--surface-hover); }
tbody td {
  padding: 16px; font-size: 13px; color: var(--text-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
.td-main { color: var(--text-main); font-weight: 500; }
.td-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.td-avatar { 
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  background: var(--bg-page); color: var(--text-2);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border);
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-main); margin-bottom: 8px; }
.form-control {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 14px; color: var(--text-main); transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── Score Bar (Flat) ──────────────────────────────────────── */
.score-row { display: flex; align-items: center; gap: 8px; }
.score-badge { font-weight: 600; font-family: monospace; font-size: 14px; }

/* ── Userbot Status List ───────────────────────────────────── */
.status-list { display: flex; flex-direction: column; gap: 12px; }
.status-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); transition: var(--transition);
}
.status-item:hover { border-color: var(--border-h); box-shadow: var(--shadow-sm); }
.status-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.active { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.status-dot.inactive { background: var(--text-3); }

/* ── Utilities ─────────────────────────────────────────────── */
.flex { display: flex; }
.flex-c { display: flex; align-items: center; }
.flex-b { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.w-full { width: 100%; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.text-main { color: var(--text-main); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.font-500 { font-weight: 500; }
.font-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 12px; z-index: 9999; }
.toast {
  padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float); display: flex; align-items: center; gap: 12px; font-size: 14px;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-state-icon { font-size: 40px; margin-bottom: 16px; color: var(--text-3); }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-main); margin-bottom: 8px; }
.empty-state-text { font-size: 14px; max-width: 400px; margin: 0 auto; color: var(--text-3); }

/* ── Lead Row Detail ───────────────────────────────────────── */
.lead-msg-preview { max-width: 300px; font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* Responsive Grid Helper */
.grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 24px; }
.col-span-2 { grid-column: span 2; }
.col-span-1 { grid-column: span 1; }

/* ── Additional Grids & Utils ──────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; display: block; }
.mb-16 { margin-bottom: 24px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 24px; }
.mt-24 { margin-top: 24px; }

/* ── Buttons (Extra states) ─────────────────────────────────── */
.btn-danger { background: var(--red-soft); color: var(--red); border-color: rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-soft); color: var(--green); border-color: rgba(16, 185, 129, 0.2); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

/* ── Badges & Status (Extra states) ─────────────────────────── */
.badge-teal { background: #ECFEFF; color: #0D9488; border: 1px solid #99F6E4; }
.alert-info { background: #EFF6FF; border-color: #BFDBFE; color: #1D4ED8; }
.status-dot.pending { background: var(--yellow); }
.status-dot.banned { background: var(--red); }

/* ── Tooltips ──────────────────────────────────────────────── */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip); position: absolute;
  bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text-main); color: #fff;
  font-size: 11px; padding: 4px 8px; border-radius: 4px;
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity 0.2s; z-index: 100;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Progress ring ─────────────────────────────────────────── */
.progress-ring { transform: rotate(-90deg); }
.progress-ring-track { fill: none; stroke: var(--border); stroke-width: 3; }
.progress-ring-fill  { fill: none; stroke-linecap: round; stroke-width: 3; transition: stroke-dashoffset 0.5s ease; stroke: var(--accent); }

/* ── Lead Specific Components (leads.php) ──────────────────── */
.lead-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  overflow: hidden; transition: var(--transition);
}
.lead-card:hover { border-color: var(--border-h); }
.lead-card-header {
  padding: 16px 24px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.lead-card-body { padding: 24px; }
.lead-card-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--bg-page);
}
.lead-msg {
  background: var(--bg-page);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px; font-size: 14px; color: var(--text-main);
  margin-bottom: 24px; line-height: 1.6;
}
.lead-msg::before {
  content: '“'; font-family: serif; font-size: 32px; color: var(--border-h);
  line-height: 0; vertical-align: -12px; margin-right: 4px;
}
.lead-drafts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.draft-box {
  background: #fff; border: 1px dashed var(--border-h);
  border-radius: var(--radius-sm); padding: 20px;
}
.draft-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-2); margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}

@media (max-width: 1200px) {
  .stats-grid, .grid-cols-3, .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .col-span-2, .col-span-1 { grid-column: span 1; }
}

@media (max-width: 768px) {
  .stats-grid, .grid-cols-3, .grid-2, .lead-drafts { grid-template-columns: 1fr; }
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%; max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-size: 18px; font-weight: 600; color: var(--text-main); letter-spacing: -0.3px; }
.modal-close { 
  background: transparent; border: none;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 20px; transition: var(--transition); cursor: pointer;
}
.modal-close:hover { background: var(--surface-hover); color: var(--text-main); }
.modal-footer { 
  display: flex; justify-content: flex-end; gap: 12px; 
  margin-top: 32px; padding-top: 24px; 
  border-top: 1px solid var(--border); 
}

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-page);
}
.login-card {
  width: 100%; max-width: 400px;
  padding: 40px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.login-icon {
  width: 56px; height: 56px; background: var(--accent-h); color: #fff;
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin: 0 auto 24px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.login-title { text-align: center; font-size: 24px; font-weight: 600; margin-bottom: 8px; color: var(--text-main); }
.login-sub { text-align: center; font-size: 14px; color: var(--text-3); margin-bottom: 32px; }

