/* ============================================================
   DeskFederal — Design System Global
   Federal Energia · 2026
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ------------------------------------------------------------
   Variáveis CSS (Design Tokens)
   ------------------------------------------------------------ */
:root {
  /* Paleta Federal Energia */
  --fe-blue-900:  #0a2a5e;
  --fe-blue-800:  #0e3575;
  --fe-blue-700:  #1a56a4;
  --fe-blue-600:  #1f65c4;
  --fe-blue-500:  #2979d8;
  --fe-blue-400:  #4d91e6;
  --fe-blue-100:  #dbeafe;
  --fe-blue-50:   #eff6ff;

  --fe-green-700: #0d5c2e;
  --fe-green-500: #16a34a;
  --fe-green-400: #22c55e;
  --fe-green-100: #dcfce7;

  --fe-yellow:    #facc15;
  --fe-orange:    #f97316;
  --fe-red:       #ef4444;
  --fe-purple:    #7c3aed;

  /* Neutros */
  --gray-950: #09090b;
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;
  --white:    #ffffff;

  /* Semânticas */
  --color-primary:    var(--fe-blue-700);
  --color-primary-hover: var(--fe-blue-600);
  --color-success:    var(--fe-green-500);
  --color-danger:     var(--fe-red);
  --color-warning:    var(--fe-orange);
  --color-text:       var(--gray-900);
  --color-text-muted: var(--gray-500);
  --color-border:     var(--gray-200);
  --color-bg:         var(--gray-50);
  --color-surface:    var(--white);

  /* Tipografia */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs:   0.75rem;
  --font-size-sm:   0.875rem;
  --font-size-base: 1rem;
  --font-size-lg:   1.125rem;
  --font-size-xl:   1.25rem;
  --font-size-2xl:  1.5rem;
  --font-size-3xl:  1.875rem;
  --font-size-4xl:  2.25rem;

  /* Espaçamento */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-sm:  0.375rem;
  --radius-md:  0.5rem;
  --radius-lg:  0.75rem;
  --radius-xl:  1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-sm:  0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.10), 0 2px 4px -2px rgba(0,0,0,0.10);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.10), 0 4px 6px -4px rgba(0,0,0,0.10);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.10), 0 8px 10px -6px rgba(0,0,0,0.10);
  --shadow-blue: 0 4px 24px 0 rgba(26, 86, 164, 0.25);

  /* Transições */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-primary-hover); }

img, video { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; }

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

.text-center  { text-align: center; }
.text-muted   { color: var(--color-text-muted); }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

/* ------------------------------------------------------------
   Componentes: Botões
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--fe-blue-700);
  color: var(--white);
  box-shadow: var(--shadow-blue);
}
.btn-primary:hover {
  background: var(--fe-blue-600);
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(26,86,164,0.35);
  color: var(--white);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-border);
}
.btn-ghost:hover {
  background: var(--fe-blue-50);
  border-color: var(--fe-blue-400);
}

.btn-danger {
  background: var(--fe-red);
  color: var(--white);
}
.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
  color: var(--white);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-base);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-xs);
}

.btn-full { width: 100%; }

.btn-loading { position: relative; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 1rem; height: 1rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ------------------------------------------------------------
   Componentes: Formulários
   ------------------------------------------------------------ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background: var(--white);
  transition: all var(--transition-fast);
  outline: none;
}

.form-control::placeholder { color: var(--gray-400); }

.form-control:focus {
  border-color: var(--fe-blue-500);
  box-shadow: 0 0 0 3px rgba(41, 121, 216, 0.15);
}

.form-control.is-invalid {
  border-color: var(--fe-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  cursor: pointer;
  transition: color var(--transition-fast);
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}
.input-icon:hover { color: var(--fe-blue-600); }

/* ------------------------------------------------------------
   Componentes: Alertas
   ------------------------------------------------------------ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
}

.alert-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.alert-info {
  background: var(--fe-blue-50);
  border-color: var(--fe-blue-100);
  color: var(--fe-blue-800);
}

/* ------------------------------------------------------------
   Componentes: Badge
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.badge-blue   { background: var(--fe-blue-100); color: var(--fe-blue-800); }
.badge-green  { background: var(--fe-green-100); color: var(--fe-green-700); }
.badge-gray   { background: var(--gray-100); color: var(--gray-700); }
.badge-red    { background: #fef2f2; color: #b91c1c; }

/* ------------------------------------------------------------
   Animações
   ------------------------------------------------------------ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

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

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

.animate-fade-in  { animation: fadeIn 0.4s ease forwards; }
.animate-slide-up { animation: slideUp 0.5s ease forwards; }
.animate-pulse    { animation: pulse 2s ease infinite; }

/* ------------------------------------------------------------
   Scrollbar Customizada
   ------------------------------------------------------------ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ------------------------------------------------------------
   Print Styles (Relatórios e Exportação PDF)
   ------------------------------------------------------------ */
@media print {
  .sidebar, .topbar, .mobile-toggle-btn, .no-print, .action-footer, #btn-logout { 
      display: none !important; 
  }
  body, .main-content { 
      background: #fff !important; 
      margin: 0 !important; 
      padding: 0 !important; 
      width: 100% !important; 
  }
  .main-content { margin-left: 0 !important; }
  .admin-table-wrap, .stat-card, .card { 
      box-shadow: none !important; 
      border: 1px solid #e2e8f0 !important; 
      break-inside: avoid; 
  }
  .report-container { padding: 0 !important; }
}
