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

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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #222;
  --border: #2a2a2a;
  --border2: #333;
  --accent: #00d4aa;
  --accent-dim: rgba(0,212,170,0.15);
  --accent-hover: #00b894;
  --text: #e8e8e8;
  --text-muted: #888;
  --text-dim: #555;
  --danger: #e74c3c;
  --danger-dim: rgba(231,76,60,0.15);
  --warning: #f39c12;
  --warning-dim: rgba(243,156,18,0.15);
  --success: #00d4aa;
  --info: #3498db;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* === LAYOUT === */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}

.sidebar-logo .logo-text { font-weight: 600; font-size: 15px; color: var(--text); }
.sidebar-logo .logo-sub { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { padding: 8px 0; flex: 1; }
.sidebar-nav .nav-section { padding: 16px 16px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-dim); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-muted);
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
  position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); border-radius: 0 2px 2px 0; }

.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-item .nav-label { font-size: 13px; font-weight: 500; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center; }
.nav-badge.green { background: var(--accent); color: #000; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; background: var(--accent-dim); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--accent); flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text-muted); }

.main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

.page-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--surface);
}

.page-title { font-size: 20px; font-weight: 600; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.page-body { padding: 24px 28px; flex: 1; }

/* === CARDS === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card.accent { border-color: var(--accent); }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.danger { border-color: var(--danger); }
.stat-card.danger .stat-value { color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
@media(max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; font-family: inherit; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover:not(:disabled) { background: #2a2a2a; border-color: #444; }
.btn-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(231,76,60,0.3); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); padding: 6px 10px; }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* === TABLE === */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--surface2); }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
.table-actions { display: flex; align-items: center; gap: 6px; }

/* === BADGES === */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-inbound { background: rgba(0,212,170,0.15); color: #00d4aa; }
.badge-outbound { background: rgba(52,152,219,0.15); color: #3498db; }
.badge-ended { background: rgba(136,136,136,0.15); color: #888; }
.badge-ongoing { background: rgba(0,212,170,0.15); color: #00d4aa; }
.badge-error { background: var(--danger-dim); color: var(--danger); }
.badge-pending { background: rgba(136,136,136,0.15); color: #888; }
.badge-called { background: rgba(52,152,219,0.15); color: #3498db; }
.badge-qualified { background: rgba(0,212,170,0.15); color: #00d4aa; }
.badge-callback { background: rgba(243,156,18,0.15); color: #f39c12; }
.badge-not_interested { background: var(--danger-dim); color: var(--danger); }

/* === FILTERS === */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select, .filter-bar input { background: var(--surface); border: 1px solid var(--border2); color: var(--text); padding: 7px 12px; border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; }
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--accent); }
.filter-bar select option { background: var(--surface); }

/* === FORMS === */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-control { width: 100%; background: var(--surface2); border: 1px solid var(--border2); color: var(--text); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; transition: border-color 0.15s; }
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control::placeholder { color: var(--text-dim); }
select.form-control option { background: #1a1a1a; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* === MODAL === */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); width: 90%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-lg { max-width: 720px; }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; padding: 0; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* === PAGINATION === */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 20px 0 4px; }
.page-btn { background: var(--surface2); border: 1px solid var(--border2); color: var(--text-muted); padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-family: inherit; }
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { color: var(--text-muted); font-size: 13px; }

/* === LIVE CALLS === */
.live-count { font-size: 64px; font-weight: 700; color: var(--accent); text-align: center; }
.live-count-label { text-align: center; color: var(--text-muted); font-size: 16px; margin-top: 4px; margin-bottom: 32px; }
.live-calls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.live-call-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden; }
.live-call-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); }
.pulse-dot { width: 10px; height: 10px; background: var(--accent); border-radius: 50%; display: inline-block; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(1.3); } }
.live-number { font-size: 18px; font-weight: 600; margin: 8px 0 4px; }
.live-timer { font-size: 22px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* === LOGIN === */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 40px; width: 380px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon-big { width: 52px; height: 52px; background: var(--accent); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: #000; margin-bottom: 12px; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.login-error { background: var(--danger-dim); border: 1px solid rgba(231,76,60,0.3); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: none; }

/* === TOAST === */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface2); border: 1px solid var(--border2); color: var(--text); padding: 12px 18px; border-radius: var(--radius); font-size: 13px; min-width: 240px; max-width: 360px; animation: slideIn 0.25s ease; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; }
.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === PROGRESS BAR === */
.progress-bar { background: var(--border); border-radius: 4px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.5s; }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* === UPLOAD ZONE === */
.upload-zone { border: 2px dashed var(--border2); border-radius: var(--radius); padding: 40px; text-align: center; cursor: pointer; transition: all 0.2s; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-dim); }
.upload-zone .upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-zone p { color: var(--text-muted); font-size: 14px; }
.upload-zone .upload-link { color: var(--accent); cursor: pointer; }

/* === AUDIO PLAYER === */
.inline-player { padding: 10px 14px; background: var(--surface2); border-top: 1px solid var(--border); }
.inline-player audio { width: 100%; height: 36px; accent-color: var(--accent); }

/* === TRANSCRIPT MODAL === */
.transcript-text { white-space: pre-wrap; font-size: 13px; line-height: 1.7; color: var(--text); max-height: 400px; overflow-y: auto; background: var(--surface2); padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.summary-box { background: var(--accent-dim); border: 1px solid rgba(0,212,170,0.3); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: 13px; }

/* === BULK ACTION BAR === */
.bulk-bar { display: none; align-items: center; gap: 12px; background: var(--accent-dim); border: 1px solid rgba(0,212,170,0.3); border-radius: var(--radius-sm); padding: 10px 16px; margin-bottom: 12px; }
.bulk-bar.visible { display: flex; }
.bulk-count { font-weight: 600; color: var(--accent); }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* === RESPONSIVE === */
@media(max-width: 768px) {
  .sidebar { width: 200px; }
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
