/* 
 * Sistema UCAC Produtividade - Padrão Oficial Polícia Federal (TEMA CLARO / LIGHT THEME)
 * Visual: Fundo Claro Limpo, Azul Institucional, Ouro PF (#b8860b / #d4af37), Alta Legibilidade
 */

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

:root {
  /* Paleta Polícia Federal em Modo Claro */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfdfe;
  --bg-glass: rgba(255, 255, 255, 0.95);
  
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-gold: rgba(184, 134, 11, 0.4);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-gold: #92400e;

  /* Ouros e Destaques Institucionais */
  --pf-gold: #c59b27;
  --pf-gold-light: #d4af37;
  --pf-gold-dark: #854d0e;
  --pf-gold-gradient: linear-gradient(135deg, #d4af37 0%, #eab308 50%, #ca8a04 100%);
  --pf-gold-glow: 0 4px 20px rgba(197, 155, 39, 0.25);

  --pf-blue: #1d4ed8;
  --pf-blue-bg: #eff6ff;
  --pf-red: #dc2626;
  --pf-red-bg: #fef2f2;
  --pf-green: #16a34a;
  --pf-green-bg: #f0fdf4;

  --accent-primary: var(--pf-gold);
  --accent-hover: var(--pf-gold-light);
  --accent-dark: var(--pf-gold-dark);

  /* Status */
  --status-ok: #15803d;
  --status-warning: #b45309;
  --status-info: #0284c7;
  --status-danger: #b91c1c;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.08);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #070c17;
  --bg-secondary: #0d172a;
  --bg-card: rgba(13, 23, 42, 0.85);
  --bg-card-hover: rgba(19, 34, 62, 0.95);
  --bg-glass: rgba(10, 18, 33, 0.85);
  --border-color: rgba(35, 56, 93, 0.6);
  --border-gold: rgba(212, 175, 55, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-gold: #f3d36b;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.45;
  background-image: 
    radial-gradient(at 0% 0%, rgba(212, 175, 55, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(29, 78, 216, 0.04) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Container Otimizado */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem 1.25rem;
}

/* Navbar Polícia Federal em Tom Claro */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: var(--bg-glass);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05), 0 2px 0 var(--border-gold);
  padding: 0.6rem 0;
  margin-bottom: 1.25rem;
}

.nav-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.pf-shield-icon {
  width: 36px;
  height: 42px;
  background: var(--pf-gold-gradient);
  clip-path: polygon(0 0, 100% 0, 100% 75%, 50% 100%, 0 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e1b4b;
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: -0.05em;
  box-shadow: 0 2px 8px rgba(197, 155, 39, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title-main {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #1e293b;
  text-transform: uppercase;
}

.brand-title-sub {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--pf-gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--pf-gold);
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.nav-link.active {
  background: var(--pf-gold-gradient);
  color: #1e1b4b !important;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--pf-gold-gradient);
  color: #1e1b4b;
  border: 1px solid #d4af37;
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: var(--pf-gold);
  color: var(--pf-gold);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Cards & Layout Compacto */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-lg);
}

/* Grid KPIs Otimizado */
.grid-kpi-compact {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1200px) {
  .grid-kpi-compact {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 768px) {
  .grid-kpi-compact {
    grid-template-columns: 1fr;
  }
}

.card-kpi-compact {
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--pf-gold);
  background: #ffffff;
}

.kpi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 900;
  color: #0f172a;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

.kpi-footer {
  font-size: 0.73rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-weight: 600;
}

/* Charts Grid */
.grid-charts-compact {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 992px) {
  .grid-charts-compact {
    grid-template-columns: 1fr;
  }
}

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

.card-title-compact {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Tabelas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.custom-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #cbd5e1;
  white-space: nowrap;
}

.custom-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: #1e293b;
  vertical-align: middle;
}

.custom-table tbody tr:hover {
  background: #f1f5f9;
}

/* Badges em Tom Claro */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-sinarm {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-sei {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-info {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-gold {
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.req-number {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: #1e293b;
}

/* Modals em Tom Claro */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  padding: 1rem;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 840px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(212, 175, 55, 0.4);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
}

.modal-body {
  padding: 1.25rem;
  background: #ffffff;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 1.25rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--pf-gold);
}

.tab-btn.active {
  color: #1e1b4b;
  border-bottom-color: var(--pf-gold);
  font-weight: 800;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Forms em Tom Claro */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: #0f172a;
  font-family: inherit;
  font-size: 0.85rem;
  transition: var(--transition);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.form-control:focus {
  outline: none;
  border-color: var(--pf-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
  background: #ffffff;
}

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

/* Timeline em Tom Claro */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0.45rem;
  height: 100%;
  width: 2px;
  background: #e2e8f0;
}

.timeline-item {
  position: relative;
  margin-bottom: 0.85rem;
}

.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--pf-gold);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px rgba(197, 155, 39, 0.4);
}

.timeline-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.timeline-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toast {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--pf-gold);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.1rem;
  color: #0f172a;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
}
