/* ===== SHERLOCK PREV — Main Stylesheet ===== */
/* Dark industrial-professional theme */

:root {
  --bg-primary: #0e0f14;
  --bg-secondary: #151720;
  --bg-card: #1a1d28;
  --bg-hover: #1f2335;
  --border: rgba(255,255,255,0.07);
  --border-active: rgba(255,255,255,0.15);

  --text-primary: #e8eaf0;
  --text-secondary: #8b90a7;
  --text-muted: #565c75;

  --accent: #4f7cff;
  --accent-hover: #6b93ff;
  --accent-glow: rgba(79,124,255,0.15);

  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245,158,11,0.1);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.1);
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --orange: #f97316;

  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);

  --font-main: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

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

input, select, textarea, button { font-family: var(--font-main); }

/* ── Layout ───────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width); height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin 0.3s ease;
}

.top-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-height);
  background: rgba(14,15,20,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
}

.page-content { padding: 24px; }

/* ── Sidebar Brand ────────────────────────────────────── */
.sidebar-brand {
  padding: 20px 20px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: white;
  box-shadow: 0 0 20px var(--accent-glow);
}

.brand-name { font-size: 16px; font-weight: 700; color: var(--text-primary); display: block; }
.brand-sub { font-size: 10px; font-weight: 600; color: var(--accent); letter-spacing: 3px; display: block; }

/* ── Sidebar Empresa ──────────────────────────────────── */
.sidebar-empresa {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.empresa-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 6px;
}

.empresa-badge i { color: var(--accent); font-size: 11px; }

.creditos-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--yellow-bg);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 20px; padding: 3px 10px;
  font-size: 11px; color: var(--yellow);
  font-weight: 500;
}

/* ── Sidebar Nav ──────────────────────────────────────── */
.sidebar-nav {
  flex: 1; padding: 12px 12px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  transition: all 0.15s ease; cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-hover); color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(79,124,255,0.25);
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}

.nav-logout:hover { background: var(--red-bg); color: var(--red); }

/* ── Header ───────────────────────────────────────────── */
.sidebar-toggle {
  background: none; border: none; color: var(--text-secondary);
  font-size: 18px; cursor: pointer; padding: 4px;
  transition: color 0.15s;
}
.sidebar-toggle:hover { color: var(--text-primary); }

.header-breadcrumb {
  flex: 1;
  font-size: 13px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
}

.header-user { display: flex; align-items: center; gap: 10px; }
.user-info { text-align: right; }
.user-name { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { display: block; font-size: 11px; color: var(--text-muted); }

.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white;
}

/* ── Alerts ───────────────────────────────────────────── */
.alerts-container { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.fixed-alerts {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  min-width: 320px; max-width: 480px;
}

.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert span { flex: 1; font-size: 13.5px; }
.alert button { background: none; border: none; cursor: pointer; opacity: 0.6; transition: opacity 0.15s; }
.alert button:hover { opacity: 1; }

.alert-success { background: var(--green-bg); border-color: rgba(34,197,94,0.25); color: var(--green); }
.alert-danger { background: var(--red-bg); border-color: rgba(239,68,68,0.25); color: var(--red); }
.alert-info { background: var(--accent-glow); border-color: rgba(79,124,255,0.25); color: var(--accent); }
.alert-warning { background: var(--yellow-bg); border-color: rgba(245,158,11,0.25); color: var(--yellow); }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}

.card-title i { color: var(--accent); }

/* ── Stats Grid ───────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.stat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; margin-bottom: 12px;
}

.stat-icon.blue { background: rgba(59,130,246,0.15); color: var(--blue); }
.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.yellow { background: var(--yellow-bg); color: var(--yellow); }
.stat-icon.purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.stat-icon.orange { background: rgba(249,115,22,0.15); color: var(--orange); }
.stat-icon.accent { background: var(--accent-glow); color: var(--accent); }

.stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ── Tables ───────────────────────────────────────────── */
.table-container {
  overflow-x: auto; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }

thead tr { background: var(--bg-hover); }
thead th {
  padding: 11px 14px; text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: 12px 14px; font-size: 13.5px; color: var(--text-primary);
  vertical-align: middle;
}

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
}

.badge-green { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }
.badge-red { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.badge-blue { background: rgba(59,130,246,0.1); color: var(--blue); border: 1px solid rgba(59,130,246,0.2); }
.badge-purple { background: rgba(139,92,246,0.1); color: var(--purple); border: 1px solid rgba(139,92,246,0.2); }
.badge-gray { background: rgba(139,146,167,0.1); color: var(--text-secondary); border: 1px solid rgba(139,146,167,0.15); }
.badge-orange { background: rgba(249,115,22,0.1); color: var(--orange); border: 1px solid rgba(249,115,22,0.2); }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500;
  border: none; cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent); color: white;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover); color: white;
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-hover); color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-active); background: var(--bg-card); }

.btn-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.btn-success:hover { background: var(--green); color: white; }

.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: var(--red); color: white; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block; margin-bottom: 6px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  width: 100%; padding: 9px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary);
  font-size: 13.5px; transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-secondary); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ── Page Header ──────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ── Status badges by value ───────────────────────────── */
.status-badge { display: inline-block; }

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-secondary);
  font-size: 20px; cursor: pointer; transition: color 0.15s;
}
.modal-close:hover { color: var(--red); }

/* ── Teses Cards ──────────────────────────────────────── */
.tese-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
  transition: border-color 0.2s;
}

.tese-card.aplicavel {
  border-color: rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.04);
}

.tese-card.nao-aplicavel {
  opacity: 0.5;
}

.tese-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}

.tese-numero {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: white;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.tese-card.aplicavel .tese-numero { background: var(--green); }

.tese-nome { font-size: 14px; font-weight: 600; flex: 1; }
.tese-prob { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.prob-alta { background: var(--green-bg); color: var(--green); }
.prob-media { background: var(--yellow-bg); color: var(--yellow); }
.prob-baixa { background: rgba(139,146,167,0.1); color: var(--text-secondary); }

.tese-fundamentacao {
  font-size: 13px; color: var(--text-secondary); margin: 8px 0;
  line-height: 1.6;
}

.tese-evidencias {
  list-style: none; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
}

.tese-evidencias li {
  font-size: 12.5px; color: var(--text-secondary);
  display: flex; align-items: flex-start; gap: 6px;
}

.tese-evidencias li::before {
  content: '→'; color: var(--accent); font-size: 12px; margin-top: 1px;
}

/* ── History Timeline ─────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: flex; gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  margin-top: 2px;
}

.timeline-icon.ligacao { background: var(--accent-glow); color: var(--accent); }
.timeline-icon.whatsapp { background: var(--green-bg); color: var(--green); }
.timeline-icon.sistema { background: var(--yellow-bg); color: var(--yellow); }

.timeline-content { flex: 1; }
.timeline-desc { font-size: 13.5px; color: var(--text-primary); }
.timeline-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Search & Filter Bar ──────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}

.search-input {
  flex: 1; min-width: 200px;
  padding: 8px 12px 8px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary);
  font-size: 13.5px;
  position: relative;
}

.search-wrapper { position: relative; flex: 1; min-width: 200px; }
.search-wrapper i {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px;
}

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state i { font-size: 48px; margin-bottom: 12px; color: var(--text-muted); }
.empty-state h3 { font-size: 16px; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
