/* STYLESHEET - SISTEMA JURÍDICO DE GERENCIAMENTO (COM RESPONSIVIDADE MOBILE E ACESSIBILIDADE) */
: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.25rem; }

* { 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; }

/* BARRA DE ACESSIBILIDADE E MENU MOBILE */
.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; }

/* BOTÃO DO MENU HAMBÚRGUER MOBILE */
.btn-mobile-menu {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.85rem;
  font-size: 13px !important;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.2s;
  margin-right: auto;
}
.btn-mobile-menu:hover, .btn-mobile-menu:focus {
  background-color: var(--primary-hover);
  outline: 2px solid #f59e0b;
}

/* INDICADOR DE AGUARDE DA API (PISCANDO VERMELHO E BRANCO) */
.a11y-loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.85rem;
  font-weight: 800;
  font-size: 13px !important;
  border-radius: var(--radius-sm);
  margin-right: auto;
  animation: blink-red-white 0.7s infinite alternate;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

@keyframes blink-red-white {
  0% {
    background-color: #dc2626;
    color: #ffffff;
    border: 1px solid #ffffff;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.9);
  }
  50% {
    background-color: #ffffff;
    color: #dc2626;
    border: 1px solid #dc2626;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
  }
  100% {
    background-color: #dc2626;
    color: #ffffff;
    border: 1px solid #ffffff;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.9);
  }
}

.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; }

#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; }

/* LAYOUT PRINCIPAL E NAVEGAÇÃO */
.main-layout { display: flex; min-height: calc(100vh - 45px); position: relative; }
.sidebar { width: 250px; background-color: var(--bg-sidebar); color: #ffffff; padding: 1.5rem 1rem; display: flex; flex-direction: column; flex-shrink: 0; transition: transform 0.3s ease-in-out; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding-left: 0.75rem; }
.sidebar-header h3 { font-size: 1.25em; font-weight: 700; color: #f8fafc; }
.btn-close-sidebar { display: none; background: none; border: none; color: #ffffff; font-size: 1.75em; cursor: pointer; }
.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; }

/* CONTAINER RESPONSIVO DE TABELAS */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 1rem; border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; 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; }

/* MODAIS E OVERLAYS */
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.6); z-index: 998; backdrop-filter: blur(2px); }
.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); }

/* ==========================================================================
   REGRAS DE RESPONSIVIDADE E DISPOSITIVOS MOBILE (@media queries)
   ========================================================================== */
@media (max-width: 768px) {
  /* EXIBE BOTÃO HAMBÚRGUER E BOTÃO DE FECHAR SIDEBAR */
  .btn-mobile-menu {
    display: inline-flex !important;
  }
  .btn-close-sidebar {
    display: block !important;
  }

  /* SIDEBAR EM MODO RETRÁTIL (DRAWER SLIDE-OVER) */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 270px;
    z-index: 999;
    transform: translateX(-100%);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.4);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* ÁREA DE CONTEÚDO E PADDING MOBILE */
  .content-area {
    padding: 1.25rem 1rem;
    max-width: 100%;
  }

  .page-title {
    font-size: 1.4em;
  }

  .page-subtitle {
    font-size: 0.85em;
    margin-bottom: 1.25rem;
  }

  /* GRIDS DE MÉTRICAS E FORMULÁRIOS EMPILHADOS */
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .flex-1 {
    width: 100%;
  }

  /* BARRA DE ACESSIBILIDADE RESPONSIVA */

  /* OCULTA O BOTÃO DE ATALHOS DE TECLADO EM DISPOSITIVOS MÓVEIS */
  #btn-a11y-help {
    display: none !important;
  }

  .a11y-controls {
    justify-content: space-between;
    gap: 0.4rem;
  }

  .a11y-loading-indicator {
    margin-right: 0;
    width: 100%;
    justify-content: center;
    margin-bottom: 0.25rem;
  }

  /* DADOS E BOTÕES DA TABELA EM TELAS PEQUENAS */
  .info-card, .card-form, .card-table {
    padding: 1.15rem;
  }

  .data-table th, .data-table td {
    padding: 0.55rem 0.65rem;
    font-size: 0.82em;
    white-space: nowrap;
  }

  .btn-action {
    padding: 0.3rem 0.5rem;
    font-size: 0.78em;
  }

  .login-card {
    padding: 1.75rem 1.25rem;
  }

  .modal-card {
    padding: 1.25rem;
    max-height: 88vh;
  }
}
