/* STYLESHEET - SISTEMA JURÍDICO DE GERENCIAMENTO (COM ACESSIBILIDADE E CRONÔMETRO V18) */

:root {
  --bg-login: #0f172a;
  --bg-main: #f1f5f9;
  --bg-sidebar: #0b1329;
  --bg-card: #ffffff;
  --bg-a11y: #1e293b;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  --border-color: #cbd5e1;
  --table-header-bg: #e2e8f0;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --font-base: 1rem;
}

body.dark-mode {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #020617;
  --text-dark: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --table-header-bg: #334155;
}

body.font-small { font-size: 0.875rem; }
body.font-normal { font-size: 1rem; }
body.font-large { font-size: 1.5rem; }

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.25s, color 0.2s;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 10px;
  background: var(--primary-color);
  color: #ffffff;
  padding: 8px 16px;
  z-index: 10000;
  border-radius: 4px;
  font-weight: bold;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 10px;
  outline: 3px solid #f59e0b;
}

.a11y-bar {
  background-color: var(--bg-a11y);
  color: #ffffff;
  padding: 0.5rem 1.25rem;
  font-size: 14px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 999;
}

.a11y-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  max-width: 1300px;
  margin: 0 auto;
}

.font-size-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
}

.btn-a11y {
  background-color: transparent;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.35rem 0.75rem;
  font-size: 13px !important;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.2;
}

.btn-a11y:hover, .btn-a11y:focus {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: #ffffff;
  outline: 2px solid #f59e0b;
}

/* ESTILOS DO CRONÔMETRO DE SESSÃO */
.session-timer {
  font-weight: bold;
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
  font-family: monospace, monospace;
}

.session-timer.timer-warning {
  color: #ef4444;
  border-color: #ef4444;
  animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

#login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 45px);
  background-color: var(--bg-login);
  padding: 1.5rem;
}

.login-card {
  background-color: var(--bg-card);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 420px;
}

.login-card h2 {
  text-align: center;
  color: var(--primary-color);
  font-size: 1.75em;
  font-weight: 700;
  margin-bottom: 2rem;
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9em;
  color: var(--text-dark);
  margin-bottom: 0.4rem;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.95em;
  background-color: var(--bg-card);
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.2s;
  pointer-events: auto !important;
  user-select: text !important;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
  outline: 2px solid #f59e0b;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.flex-1 { flex: 1; min-width: 200px; }

.filter-card {
  background-color: rgba(37, 99, 235, 0.05);
  border: 1px solid var(--primary-color);
}

.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.95em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--primary-hover);
  outline: 2px solid #f59e0b;
}

.btn-block { width: 100%; margin-top: 0.5rem; }

.btn-back {
  background: none;
  border: none;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.95em;
  cursor: pointer;
  margin-bottom: 1rem;
  display: inline-block;
}

.btn-action {
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.85em;
  border-radius: 4px;
  cursor: pointer;
  margin: 0.15rem;
}

.btn-action:hover, .btn-action:focus {
  opacity: 0.9;
  outline: 2px solid #f59e0b;
}

.btn-cnj { background-color: #059669; }
.btn-secondary { background-color: #475569; }

.main-layout { display: flex; min-height: calc(100vh - 45px); }

.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  color: #ffffff;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header h3 {
  font-size: 1.25em;
  font-weight: 700;
  margin-bottom: 2rem;
  padding-left: 0.75rem;
  color: #f8fafc;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.5rem; }

.nav-item {
  background-color: transparent;
  color: #cbd5e1;
  border: none;
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.95em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item:hover, .nav-item:focus, .nav-item.active {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
  outline: 2px solid #f59e0b;
}

.btn-logout { margin-top: auto; color: #f87171; }
.btn-logout:hover { background-color: rgba(239, 68, 68, 0.2); }

.content-area {
  flex: 1;
  padding: 2.5rem;
  max-width: 1300px;
  width: 100%;
}

.page-title {
  font-size: 1.85em;
  color: var(--text-dark);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95em;
  margin-bottom: 2rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background-color: var(--bg-card);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metric-label { font-size: 0.9em; font-weight: 600; color: var(--text-muted); }
.metric-value { font-size: 2em; font-weight: 700; color: var(--primary-color); }

.info-card, .card-form, .card-table {
  background-color: var(--bg-card);
  padding: 1.75rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.info-card h3, .card-table h3 { font-size: 1.15em; margin-bottom: 1rem; color: var(--text-dark); }
.info-card p { color: var(--text-muted); line-height: 1.6; font-size: 0.95em; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9em;
}

.data-table caption {
  caption-side: top;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-size: 0.85em;
}

.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: var(--table-header-bg);
  color: var(--text-dark);
  font-weight: 600;
}

.cnj-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.8em;
  font-weight: 600;
  background-color: rgba(37, 99, 235, 0.15);
  color: var(--primary-color);
  border-radius: 4px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 1rem;
}

.modal-card {
  background-color: var(--bg-card);
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
}

.modal-large { max-width: 800px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.5em;
  color: var(--text-muted);
  cursor: pointer;
}

.a11y-shortcuts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.95em;
}

.cnj-meta-box {
  background-color: var(--table-header-bg);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9em;
}

.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.25rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--primary-color);
}

.timeline-item { position: relative; padding-left: 1rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.35rem;
  top: 0.3rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--primary-color);
}

.timeline-date { font-size: 0.8em; color: var(--text-muted); font-weight: 600; }
.timeline-title { font-weight: 700; font-size: 0.95em; margin: 0.2rem 0; }
.timeline-desc { font-size: 0.85em; color: var(--text-muted); }
.divider { margin: 1.5rem 0; border: None; border-top: 1px solid var(--border-color); }

/* RESPONSIVIDADE E MENU MOBILE */
#btn-toggle-menu {
  display: none !important;
}

@media (max-width: 768px) {
  #btn-toggle-menu {
    display: inline-flex !important;
  }
  #btn-open-a11y-modal, #btn-a11y-help {
    display: none !important;
  }
  .main-layout {
    flex-direction: column;
    position: relative;
  }
  .sidebar {
    width: 100%;
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  .sidebar.active {
    display: flex !important;
  }
  .content-area {
    padding: 1.25rem 1rem;
  }
  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
