/* ===== DESIGN TOKENS DO STUDIUM =====
   Fonte da verdade da identidade visual (especificação completa acordada
   com o usuário). Qualquer nova tela deve consumir estas variáveis em vez
   de inventar cores/sombras/raios próprios. */
:root {
  /* Brand */
  --primary: #0f62fe;
  --primary-hover: #0043ce;
  --primary-deep: #001d6c;
  --secondary: #007ab7;

  /* Background */
  --background: #f7f6f0;
  --background-secondary: #f3f2ea;
  --surface: #ffffff;
  --surface-blue: #e8f1ff;

  /* Text */
  --text-primary: #161616;
  --text-secondary: #6f7782;
  --text-tertiary: #8d95a1;

  /* Border */
  --border: #e2e2dc;
  --border-soft: #ececE8;

  /* Semantic */
  --success: #24a148;
  --warning: #ff832b;
  --danger: #da1e28;
  --attention: #f1c21b;

  /* Shape */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Shadow */
  --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px rgba(15, 23, 42, .04);

  /* ---- Compatibilidade com regras CSS existentes (mesma escala acima) ---- */
  --primary-50: #e8f1ff;
  --primary-200: #a6c8ff;
  --primary-500: #0f62fe;
  --primary-600: #0043ce;
  --primary-700: #002d9c;

  --brand-400: #4589ff;
  --brand-500: #0f62fe;
  --brand-600: #0043ce;

  --accent-400: #4a9fd6;
  --accent-500: #007ab7;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6f7782;
  --gray-700: #374151;
  --gray-900: #161616;

  --success-500: #24a148;
  --warning-500: #ff832b;
  --error-500: #da1e28;

  --shadow: var(--shadow-card);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px rgba(15, 98, 254, 0.15);

  --radius: var(--radius-sm);
  --radius-lg: var(--radius-md);

  /* Espaçamentos (escala 4/8/12/16/20/24/32/40/48) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Transições */
  --transition: 180ms ease;
}

/* ===== AURORA BACKGROUND ===== */
.aurora-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.07;
  will-change: transform;
}

.dark .aurora-blob {
  opacity: 0.18;
  mix-blend-mode: screen;
}

/* Um único tom (azul) em vez de manchas roxo/azul/rosa — visual mais calmo,
   sem "gradiente de várias cores" */
.aurora-1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, #0f62fe 0%, #001141 100%);
  top: -200px; left: -150px;
  animation: aurora-drift-1 32s ease-in-out infinite;
}
.aurora-2 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #4589ff 0%, #0043ce 100%);
  bottom: -120px; right: -100px;
  animation: aurora-drift-2 26s ease-in-out infinite;
}

@keyframes aurora-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(60px, -40px) scale(1.06); }
  66%       { transform: translate(-30px, 50px) scale(0.94); }
}
@keyframes aurora-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(-50px, 40px) scale(1.08); }
  66%       { transform: translate(30px, -55px) scale(0.92); }
}

/* ===== GLASS UTILITIES ===== */
.glass {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.dark .glass {
  background: rgba(8, 13, 26, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== BASE ===== */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: #F7F6F0;
  color: var(--gray-900);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ===== PREMIUM TYPOGRAPHY ===== */
h1, h2, h3, h4 {
  font-family: 'Outfit', system-ui, sans-serif;
  letter-spacing: -0.02em;
}

.font-heading {
  font-family: 'Outfit', system-ui, sans-serif;
}

/* ===== CONTAINERS ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md);
}

.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.chart-container {
  position: relative;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  height: 350px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

/* ===== NAVEGAÇÃO ===== */
.nav-link {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  transition: var(--transition);
  text-decoration: none;
  color: var(--gray-700);
}

.nav-link:hover {
  background: var(--primary-50);
  color: var(--primary-700);
  transform: translateY(-1px);
}

.nav-link.active {
  background: var(--primary-500);
  color: white;
  box-shadow: var(--shadow);
}

/* ===== BOTÕES ===== */
.btn {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  min-height: 36px;
}

.btn-primary {
  background: var(--primary-500);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-success {
  background: var(--success-500);
  color: white;
}

.btn-warning {
  background: var(--warning-500);
  color: white;
}

.btn-danger {
  background: var(--error-500);
  color: white;
}

.btn-success:hover,
.btn-warning:hover,
.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  filter: brightness(0.9);
}

/* Correções específicas para botões do header */
.bg-blue-600,
.bg-green-600,
.bg-red-600,
.bg-yellow-600,
.bg-orange-600,
.bg-purple-600 {
  padding: 0.375rem 0.75rem !important;
  font-size: 0.75rem !important;
  min-height: 32px !important;
  font-weight: 500 !important;
  border-radius: var(--radius) !important;
  line-height: 1.2 !important;
}

/* ===== FORMULÁRIOS ===== */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.15);
}

/* ===== CONTEÚDO ITEMS ===== */
.conteudo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  margin-bottom: var(--space-sm);
  transition: var(--transition);
}

.conteudo-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--primary-200);
}

.conteudo-nome {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-right: var(--space-md);
}

.conteudo-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.conteudo-actions button {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  border-radius: var(--radius);
}

.btn-edit {
  color: var(--primary-600);
  background: var(--primary-50);
}

.btn-delete {
  color: var(--error-500);
  background: rgba(218, 30, 40, 0.1);
}

.btn-edit:hover,
.btn-delete:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* ===== TOASTS ===== */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast-message {
  padding: var(--space-md) calc(var(--space-md) * 1.25);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.1);
  font-weight: 600;
  font-size: 0.875rem;
  max-width: 400px;
  animation: slideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.25);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.toast-success {
  background: linear-gradient(135deg, rgba(36,161,72,0.92), rgba(26,122,53,0.92));
  color: white;
}

.toast-error {
  background: linear-gradient(135deg, rgba(218,30,40,0.92), rgba(183,25,34,0.92));
  color: white;
}

.toast-info {
  background: linear-gradient(135deg, rgba(15,98,254,0.92), rgba(0,67,206,0.92));
  color: white;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-box {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: calc(var(--radius-lg) * 1.5);
  padding: var(--space-xl);
  box-shadow: 0 25px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.1);
  max-width: 450px;
  width: 90%;
}

.dark .modal-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

/* ===== TIMER FLUTUANTE ===== */
#floating-timer {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 300px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: calc(var(--radius-lg) * 1.5);
  box-shadow: 0 8px 32px rgba(15, 98, 254, 0.15), 0 2px 8px rgba(0,0,0,0.1);
  z-index: 10000;
  border: 1px solid rgba(255, 255, 255, 0.5);
  max-height: 90vh;
  overflow-y: auto;
}

.dark #floating-timer {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.timer-header {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timer-content {
  padding: var(--space-md);
}

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
  .container {
    padding: var(--space-sm);
  }
  
  .conteudo-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  
  .conteudo-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .toast-container {
    bottom: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
  }
  
  #floating-timer {
    width: calc(100vw - 40px);
    left: 20px;
    right: 20px;
  }
}

/* ===== UTILIDADES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.hidden { display: none; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

/* ===== ANIMAÇÕES DE ENTRADA ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out both;
}

/* Stagger para filhos diretos de uma seção */
.stagger > * {
  animation: slideUp 0.5s ease-out both;
}
.stagger > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger > *:nth-child(2)  { animation-delay: 0.10s; }
.stagger > *:nth-child(3)  { animation-delay: 0.15s; }
.stagger > *:nth-child(4)  { animation-delay: 0.20s; }
.stagger > *:nth-child(5)  { animation-delay: 0.25s; }
.stagger > *:nth-child(6)  { animation-delay: 0.30s; }
.stagger > *:nth-child(7)  { animation-delay: 0.35s; }
.stagger > *:nth-child(8)  { animation-delay: 0.40s; }
.stagger > *:nth-child(9)  { animation-delay: 0.45s; }
.stagger > *:nth-child(10) { animation-delay: 0.50s; }
.stagger > *:nth-child(11) { animation-delay: 0.55s; }
.stagger > *:nth-child(12) { animation-delay: 0.60s; }

/* KPI numbers com animação CountUp */
[data-countup] {
  animation: countUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ===== SCROLLBAR CUSTOMIZADA ===== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--brand-500);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--brand-600);
}

/* ===== FOCUS RING (GLOBAL) ===== */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-500) !important;
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.15) !important;
}

/* ===== SKELETON LOADER ===== */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(200, 200, 220, 0.3) 25%,
    rgba(220, 220, 240, 0.6) 50%,
    rgba(200, 200, 220, 0.3) 75%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius);
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    rgba(30, 40, 60, 0.5) 25%,
    rgba(50, 60, 90, 0.7) 50%,
    rgba(30, 40, 60, 0.5) 75%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.skeleton-text { height: 0.875rem; border-radius: 4px; }
.skeleton-title { height: 1.5rem; border-radius: 6px; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; }
.skeleton-bar { height: 12px; border-radius: 99px; }
