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

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

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --orange: #e8641a;
  --orange-hover: #d4571a;
  --text: #f0ede8;
  --muted: #888480;
  --green: #1d9e75;
  --red: #e24b4a;
  --radius: 8px;
}

body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); }

.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box { background: var(--surface); border: 0.5px solid var(--border); border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 380px; }
.logo { font-size: 28px; font-weight: 700; letter-spacing: -1px; margin-bottom: 4px; }
.logo span { color: var(--orange); }
.auth-sub { font-size: 13px; color: var(--muted); margin-bottom: 2rem; }
.alert-error { background: #2a0f0f; border: 0.5px solid var(--red); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; color: var(--red); margin-bottom: 1rem; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.field input { width: 100%; background: var(--surface2); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 10px 14px; color: var(--text); font-size: 14px; font-family: inherit; outline: none; }
.field input:focus { border-color: var(--orange); }

.btn-primary { background: var(--orange); color: #fff; border: none; border-radius: var(--radius); padding: 11px 20px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-primary:hover { background: var(--orange-hover); }
.btn-primary.full { width: 100%; }
.btn-orange { background: var(--orange); color: #fff; border: none; border-radius: var(--radius); padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn-orange:hover { background: var(--orange-hover); }
.btn-ghost { background: none; border: 0.5px solid var(--border); border-radius: var(--radius); padding: 7px 14px; font-size: 13px; color: var(--muted); cursor: pointer; font-family: inherit; text-decoration: none; }
.btn-ghost:hover { color: var(--text); }
.btn-icon { background: var(--surface2); border: 0.5px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 12px; color: var(--muted); cursor: pointer; font-family: inherit; white-space: nowrap; }
.btn-icon:hover { color: var(--text); border-color: #444; }
.btn-icon.danger:hover { color: var(--red); border-color: var(--red); }

.topbar { background: var(--surface); border-bottom: 0.5px solid var(--border); padding: 0 1.5rem; height: 52px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.topbar-logo { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
.topbar-logo span { color: var(--orange); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { font-size: 13px; color: var(--muted); }

.layout { display: flex; min-height: calc(100vh - 52px); }
.sidebar { width: 200px; background: var(--surface); border-right: 0.5px solid var(--border); padding: 1.5rem 0; flex-shrink: 0; }
.sidebar-item { display: block; padding: 9px 1.25rem; font-size: 13px; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; }
.sidebar-item:hover { color: var(--text); background: var(--surface2); }
.sidebar-item.active { color: var(--orange); border-left-color: var(--orange); background: #1a1207; }
.content { flex: 1; padding: 1.5rem; overflow-x: hidden; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; }
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.page-meta { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; gap: 10px; }
.page-meta b { color: var(--text); }

/* MODELS GRID */
.models-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.model-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: 12px; overflow: hidden; }

.model-header { display: flex; align-items: center; gap: 10px; padding: 1rem 1.25rem; border-bottom: 0.5px solid var(--border); }
.model-avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.model-info { flex: 1; }
.model-name { font-weight: 600; font-size: 15px; }
.model-stats { font-size: 11px; color: var(--muted); margin-top: 2px; }
.model-actions { display: flex; gap: 4px; }

/* CALL TYPES */
.calltypes-list { padding: 0.5rem 0; }

.calltype-row { padding: 8px 1.25rem; border-bottom: 0.5px solid var(--border); }
.calltype-row:last-child { border-bottom: none; }

.calltype-name { font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }

.calltype-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.btn-share { width: 28px; height: 28px; background: var(--orange); color: #fff; border: none; border-radius: 50%; font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-share:hover { background: var(--orange-hover); }

.link-field { flex: 1; min-width: 0; background: var(--surface2); border: 0.5px solid var(--border); border-radius: 6px; padding: 5px 8px; color: var(--orange); font-size: 11px; font-family: monospace; outline: none; cursor: pointer; }

.btn-copy { background: var(--surface2); border: 0.5px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 13px; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.btn-copy:hover { color: var(--text); }

.btn-history { background: var(--surface2); border: 0.5px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 13px; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.btn-history:hover { color: var(--text); }

/* HISTORY PANEL */
.history-panel { background: var(--surface2); border-top: 0.5px solid var(--border); padding: 0.75rem 1.25rem; }
.history-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 0.5rem; }
.history-table { width: 100%; font-size: 11px; border-collapse: collapse; }
.history-table th { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.06em; padding: 4px 6px; text-align: left; border-bottom: 0.5px solid var(--border); }
.history-table td { padding: 6px 6px; border-bottom: 0.5px solid var(--border); color: var(--text); }
.history-table tr:last-child td { border-bottom: none; }

.btn-add-calltype { display: block; width: 100%; background: none; border: none; border-top: 0.5px solid var(--border); padding: 10px 1.25rem; font-size: 12px; color: var(--orange); cursor: pointer; font-family: inherit; text-align: left; }
.btn-add-calltype:hover { background: var(--surface2); }

/* NEW MODEL CARD */
.model-card-new { display: flex; align-items: center; justify-content: center; cursor: pointer; min-height: 120px; border: 1.5px dashed var(--border); background: transparent; }
.model-card-new:hover { border-color: var(--orange); background: #1a1207; }
.new-model-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.new-model-icon { font-size: 2rem; color: var(--orange); }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-active { background: #0a2318; color: var(--green); border: 0.5px solid var(--green); }
.badge-inactive { background: #1e1010; color: #666; border: 0.5px solid #333; }
.badge-ended { background: #1e1010; color: #666; border: 0.5px solid #333; }
.badge-pending { background: #1a1510; color: #c8961a; border: 0.5px solid #c8961a; }
.badge-cancelled { background: #2a1111; color: #e05252; border: 0.5px solid #e05252; }

/* MODAL */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex !important; }
.modal { background: var(--surface); border: 0.5px solid var(--border); border-radius: 14px; padding: 1.75rem; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px; }
.modal-sub { font-size: 12px; color: var(--muted); margin-bottom: 1.5rem; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 1.5rem; }

.upload-zone { border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.upload-zone:hover { border-color: var(--orange); }
.upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-sub { font-size: 11px; margin-top: 6px; }

.toast { position: fixed; bottom: 1.5rem; right: 1.5rem; background: var(--surface2); border: 0.5px solid #444; border-radius: 8px; padding: 10px 16px; font-size: 13px; color: var(--text); z-index: 200; transform: translateY(80px); opacity: 0; transition: all 0.25s; max-width: 350px; word-break: break-all; }
.toast.show { transform: translateY(0); opacity: 1; }

/* BARRA DE PROGRESSO DE UPLOAD */
.progress-bar-bg { width: 100%; height: 8px; background: #e0e0e0; border-radius: 4px; margin-top: 8px; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; background: var(--orange); border-radius: 4px; transition: width 0.3s ease; }
.progress-text { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: center; }

/* ── MONITOR DE SESSÕES EM TEMPO REAL ──────────────────────────────────── */
.monitor-panel { background: #111; border-top: 0.5px solid var(--border); margin-top: 8px; border-radius: 0 0 8px 8px; overflow: hidden; }

.monitor-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-bottom: 0.5px solid var(--border); }
.monitor-title { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.monitor-live { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--green); font-weight: 600; }
.live-dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; animation: pulse-live 1.5s infinite; }
@keyframes pulse-live { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.monitor-body { padding: 4px 0; }
.monitor-empty { font-size: 11px; color: var(--muted); text-align: center; padding: 10px; }

.monitor-table { width: 100%; font-size: 11px; border-collapse: collapse; }
.monitor-table th { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.06em; padding: 5px 10px; text-align: left; border-bottom: 0.5px solid var(--border); }
.monitor-table td { padding: 6px 10px; border-bottom: 0.5px solid #1a1a1a; color: var(--text); vertical-align: middle; }
.monitor-table tr:last-child td { border-bottom: none; }
.monitor-table tr:hover td { background: #181818; }

.monitor-lead-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: #2a2a2a; border-radius: 50%; font-size: 10px; font-weight: 700; color: var(--muted); margin-right: 6px; }

.monitor-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; }
.monitor-badge-online { background: #0a2318; color: #1d9e75; border: 0.5px solid #1d9e75; }
.monitor-badge-waiting { background: #1a1510; color: #c8961a; border: 0.5px solid #c8961a; }
.monitor-badge-ended { background: #1e1010; color: #666; border: 0.5px solid #333; }
.monitor-badge-cancelled { background: #2a1111; color: #e05252; border: 0.5px solid #e05252; }

.btn-cancel-session { background: transparent; border: 0.5px solid #e05252; color: #e05252; border-radius: 6px; padding: 3px 8px; font-size: 10px; font-weight: 600; cursor: pointer; }
.btn-cancel-session:hover { background: #2a1111; }
