/* ============================================================
   Sistema Jurídico — Folha de estilo principal
   ============================================================ */

:root {
  --sidebar-w:         260px;
  --sidebar-bg:        #1e2538;
  --sidebar-text:      #a0aec0;
  --accent:            #c9a84c;
  --accent-hover:      #b8963e;
  --topbar-h:          60px;
  --content-bg:        #f4f6f9;
}

/* ── Base ── */
body {
  background: var(--content-bg);
  font-family: 'Segoe UI', Tahoma, sans-serif;
  font-size: 0.875rem;
  overflow-x: hidden;
}

/* ── Wrapper ── */
.wrapper { min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  transition: width .3s ease;
  overflow: hidden;
}

.sidebar-header {
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
}

.sidebar-brand {
  color: var(--accent);
  font-weight: 700;
  font-size: .85rem;
  line-height: 1.4;
}

.sidebar-logo {
  max-width: 100%;
  max-height: 56px;
  object-fit: contain;
}

.sidebar-menu {
  list-style: none;
  padding: 10px 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: all .2s;
  white-space: nowrap;
}

.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.05); }

.sidebar-item.active .sidebar-link {
  color: var(--accent);
  background: rgba(201,168,76,.12);
  border-right: 3px solid var(--accent);
}

.sidebar-link i { width: 18px; text-align: center; font-size: .9rem; flex-shrink: 0; }

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 6px 16px;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.user-avatar { color: var(--accent); font-size: 1.8rem; flex-shrink: 0; }
.user-details { flex: 1; overflow: hidden; }
.user-name  { color: #fff; font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.user-role  { color: var(--sidebar-text); font-size: .7rem; }

.btn-logout { color: var(--sidebar-text); text-decoration: none; padding: 6px; border-radius: 4px; transition: color .2s; }
.btn-logout:hover { color: #fc5c65; }

/* ── Collapsed sidebar ── */
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .user-details,
.sidebar.collapsed span { display: none; }
.sidebar.collapsed .sidebar-link { padding: 10px; justify-content: center; }
.sidebar.collapsed .sidebar-divider { margin: 6px 8px; }
.main-content.expanded { margin-left: 60px; }

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s ease;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e8ecef;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background .2s;
}
.sidebar-toggle:hover { background: #f0f0f0; }

.breadcrumb-area { flex: 1; }
.topbar h5 { color: #2d3748; font-weight: 600; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ── Content area ── */
.content-area { padding: 24px; flex: 1; }

/* ── Cards ── */
.card { border: none; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.card-header {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: 10px 10px 0 0 !important;
}

/* ── Stat cards (dashboard) ── */
.stat-card {
  border-radius: 10px;
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.stat-card .stat-icon {
  font-size: 2.8rem;
  opacity: .25;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.stat-card .stat-value { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .82rem; opacity: .85; margin-top: 6px; }

/* ── Tables ── */
.table { font-size: .85rem; }
.table thead th {
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
  font-weight: 600;
  color: #495057;
  white-space: nowrap;
}
.table-hover tbody tr:hover { background: #f8f9ff; }

/* ── Btn xs ── */
.btn-xs { padding: 2px 8px; font-size: .75rem; }

/* ── Badges / Status ── */
.bg-purple   { background-color: #7c3aed !important; }
.text-purple { color: #7c3aed !important; }

.status-ativo     { color: #16a34a; font-weight: 600; }
.status-encerrado { color: #6b7280; }
.status-suspenso  { color: #d97706; font-weight: 600; }
.status-arquivado { color: #9ca3af; }

/* ── Prazos ── */
.prazo-atrasado { background: #fff5f5 !important; }
.prazo-atrasado td:first-child { border-left: 3px solid #dc2626; }
.prazo-hoje     { background: #fffbeb !important; }
.prazo-hoje td:first-child { border-left: 3px solid #f59e0b; }
.prazo-proximo  { background: #f0fdf4 !important; }
.prazo-proximo td:first-child { border-left: 3px solid #22c55e; }
.prazo-concluido { opacity: .6; text-decoration: line-through; }

/* ── Priority badges ── */
.badge-alta  { background: #fee2e2; color: #dc2626; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-media { background: #fef3c7; color: #d97706; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-baixa { background: #dcfce7; color: #16a34a; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700; }

/* ── Forms ── */
.form-label { font-weight: 500; color: #374151; }
.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,168,76,.18);
}

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1e2538;
  font-weight: 600;
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #1e2538;
}
.btn-outline-primary { border-color: var(--accent); color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); color: #1e2538; }

/* ── Login ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
}
.login-card { width: 100%; max-width: 390px; }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: #e9ecef; }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .content-area { padding: 16px; }
}
