/* ============================================
   CICLO INTEGRADO - Global Styles
   ============================================ */

/* Variáveis CSS */
:root {
  /* Cores da Marca */
  --brand-orange: #ff5a2e;
  --brand-orange-medium: #fe8222;
  --brand-orange-light: #fd931d;
  
  /* Cores do Sistema */
  --primary: #ff5a2e;
  --primary-light: #ff7a4d;
  --primary-dark: #e84d23;
  --background-light: #f6f7f8;
  --background-dark: #101922;
  --card-light: #ffffff;
  --card-dark: #1e293b;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-light: #e2e8f0;
  --border-dark: #334155;

  /* Espaçamentos */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;

  /* Transições */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;
}

/* Notificações (dropdown superior) */
@keyframes notification-pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.notification-panel {
  animation: notification-pop var(--transition-base);
}

.notification-item {
  transition: background-color var(--transition-base), transform var(--transition-fast);
}

.notification-item:hover {
  background-color: rgba(19, 127, 236, 0.06);
  transform: translateX(2px);
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* Progress bars com hover animation */
@keyframes progress-fill {
  from { width: var(--progress-start, 0%); }
  to { width: var(--progress-end, 100%); }
}

.progress-track {
  position: relative;
  background: inherit;
}

.progress-bar {
  will-change: width;
  transition: width 0.3s ease-out;
}

.summary-card:hover .progress-bar {
  animation: progress-fill 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Animações suaves para modais (Novo Usuário) */
.modal-panel {
  transform-origin: center;
}

@keyframes modalFadeInUp {
  0% { opacity: 0; transform: translateY(10px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalFadeOutDown {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(10px) scale(0.98); }
}

/* Logo Ciclo Integrado - animação sutil (float) */
@keyframes cicloLogoFloat {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, calc(-1 * var(--ciclo-logo-distance, 6px)), 0) scale(var(--ciclo-logo-scale, 1.015));
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.ciclo-logo-animate {
  transform-origin: center;
  will-change: transform;
  animation: cicloLogoFloat var(--ciclo-logo-duration, 6.5s) ease-in-out infinite;
}

.ciclo-logo-animate:hover {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .ciclo-logo-animate {
    animation: none !important;
    transform: none !important;
  }
}

.modal-enter {
  animation: modalFadeInUp 180ms ease-out forwards;
}

.modal-exit {
  animation: modalFadeOutDown 160ms ease-in forwards;
}

/* Reset Global */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-primary);
  background-color: var(--background-light);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Dark Mode */
html.dark,
html.dark body {
  background-color: var(--background-dark);
  color: #e2e8f0;
}

/* Essencial para layout */
.flex {
  display: flex;
}

.h-screen {
  height: 100vh;
}

.w-full {
  width: 100%;
}

.flex-1 {
  flex: 1;
}

.overflow-y-auto {
  overflow-y: auto;
}

/* Progress bars hover animation */
.progress-track {
  position: relative;
  background: inherit;
}

.progress-bar,
.chart-bar {
  will-change: width;
  transition: width 0.3s ease-out;
}

/* Animação de hover para barras em cards */
.summary-card:hover .progress-bar {
  animation: progress-fill 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Animação de hover para chart bars (receita, etc) */
.h-3:has(> .chart-bar):hover .chart-bar {
  animation: progress-fill 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Animação de hover para progress circles */
.progress-circle,
.progress-circle-amber,
.progress-circle-red {
  transition: --progress 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-circle:hover,
.progress-circle-amber:hover,
.progress-circle-red:hover {
  --progress: 100;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.bg-background-light {
  background-color: var(--background-light);
}

.dark .bg-background-dark {
  background-color: var(--background-dark);
}

.text-text-primary {
  color: var(--text-primary);
}

.dark .text-gray-100 {
  color: #f3f4f6;
}

/* Sidebar */
aside {
  width: 280px;
  background: white;
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  flex-shrink: 0;
}

.dark aside {
  background: var(--card-dark);
  border-right-color: var(--border-dark);
}

/* Main Content */
main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: white;
  border-bottom: 1px solid var(--border-light);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.dark header {
  background: var(--card-dark);
  border-bottom-color: var(--border-dark);
}

/* Navigation */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background-color: #f0f0f0;
}

.dark .nav-item:hover {
  background-color: #334155;
}

.nav-item.active {
  background-color: rgba(19, 127, 236, 0.1);
  color: var(--primary);
}

/* Cards */
.card {
  background-color: var(--card-light);
  border: 1px solid var(--border-light);
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: all 0.2s;
}

.dark .card {
  background-color: var(--card-dark);
  border-color: var(--border-dark);
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Forms */
input,
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-light);
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.dark input,
.dark select,
.dark textarea {
  background: var(--card-dark);
  border-color: var(--border-dark);
  color: #e2e8f0;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 127, 236, 0.1);
}

/* Buttons */
button {
  cursor: pointer;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  padding: 0.625rem 1.25rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: #0d5ec0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(19, 127, 236, 0.3);
}

/* ============================================
   COMPONENTES REUTILIZÁVEIS
   ============================================ */

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: #0d5ec0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(19, 127, 236, 0.3);
}

.btn-secondary {
  background-color: var(--card-light);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background-color: var(--background-light);
  border-color: var(--primary);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Cards */
.card {
  background-color: var(--card-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

html.dark .card {
  background-color: var(--card-dark);
  border-color: var(--border-dark);
}

html.dark .card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Inputs e Forms */
.form-input,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 127, 236, 0.1);
}

html.dark .form-input,
html.dark .form-select {
  background-color: var(--card-dark);
  border-color: var(--border-dark);
  color: #e2e8f0;
}

/* Badges e Tags */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background-color: #dcfce7;
  color: #166534;
}

.badge-warning {
  background-color: #fef3c7;
  color: #b45309;
}

.badge-danger {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background-color: #dbeafe;
  color: #0c4a6e;
}

/* Tabelas */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background-color: var(--background-light);
  border-bottom: 1px solid var(--border-light);
}

html.dark .table thead {
  background-color: var(--card-dark);
  border-bottom-color: var(--border-dark);
}

.table th {
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.table td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-light);
}

html.dark .table td {
  border-bottom-color: var(--border-dark);
}

.table tbody tr:hover {
  background-color: var(--background-light);
}

html.dark .table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* ============================================
   UTILITÁRIOS
   ============================================ */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 0 var(--spacing-md);
  }

  .table {
    font-size: 0.75rem;
  }

  .table th,
  .table td {
    padding: var(--spacing-sm);
  }
}

/* ============================================
   ANIMAÇÕES
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-fade-in {
  animation: fadeIn 300ms ease-in-out;
}

.animate-slide-in {
  animation: slideIn 300ms ease-in-out;
}

/* ============================================
   COMPONENTES COM CORES DE MARCA
   ============================================ */

/* Botões Primários */
button[type="submit"],
.btn-primary {
  background-color: var(--brand-orange);
  color: white;
  transition: all var(--transition-base);
  font-weight: 600;
}

button[type="submit"]:hover,
.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 90, 46, 0.3);
}

button[type="submit"]:active,
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(255, 90, 46, 0.2);
}

/* Links de Ação */
a,
.link {
  color: var(--brand-orange);
  transition: color var(--transition-base);
  text-decoration: none;
}

a:hover,
.link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Destaque e Gradientes */
.gradient-brand {
  background: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-orange-medium) 100%);
  color: white;
}

.border-brand {
  border-color: var(--brand-orange);
}

/* Focus com Cor de Marca */
:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 2px;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================
   ACESSIBILIDADE
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Visible para Acessibilidade */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible {
  outline-offset: -2px;
}
