/* ========================================
   DASHBOARD MODULE - CSS CENTRALIZADO
   Design Moderno, Responsivo e Profissional
======================================== */

/* ========== VARIÁVEIS CSS ========== */
:root {
  --dashboard-primary: #3b82f6;
  --dashboard-primary-dark: #1d4ed8;
  --dashboard-secondary: #8b5cf6;
  --dashboard-success: #10b981;
  --dashboard-warning: #f59e0b;
  --dashboard-danger: #ef4444;
  --dashboard-gray-50: #f9fafb;
  --dashboard-gray-100: #f3f4f6;
  --dashboard-gray-200: #e5e7eb;
  --dashboard-gray-300: #d1d5db;
  --dashboard-gray-400: #9ca3af;
  --dashboard-gray-500: #6b7280;
  --dashboard-gray-600: #4b5563;
  --dashboard-gray-700: #374151;
  --dashboard-gray-800: #1f2937;
  --dashboard-gray-900: #111827;
  --dashboard-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --dashboard-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --dashboard-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --dashboard-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --dashboard-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --dashboard-shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --dashboard-radius-sm: 0.375rem;
  --dashboard-radius: 0.5rem;
  --dashboard-radius-md: 0.75rem;
  --dashboard-radius-lg: 1rem;
  --dashboard-radius-xl: 1.5rem;
  --dashboard-radius-2xl: 2rem;
}

/* ========== CONTAINER PRINCIPAL ========== */
.dashboard-container {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .dashboard-container {
    padding: 2rem;
  }
}

/* ========== HEADER MODERNO COM GRADIENTE ========== */
.dashboard-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 50%, #4338ca 100%);
  border-radius: var(--dashboard-radius-2xl);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--dashboard-shadow-2xl);
}

.dashboard-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--dashboard-radius-2xl);
}

.dashboard-header-content {
  position: relative;
  z-index: 10;
}

.dashboard-header-flex {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 640px) {
  .dashboard-header-flex {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.dashboard-header-title {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .dashboard-header-title {
    font-size: 2.5rem;
  }
}

.dashboard-header-subtitle {
  color: #bfdbfe;
  font-size: 1.125rem;
  margin: 0;
}

.dashboard-header-decorations {
  position: absolute;
  width: 6rem;
  height: 6rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  filter: blur(40px);
}

.dashboard-header-decoration-1 {
  top: -1rem;
  right: -1rem;
}

.dashboard-header-decoration-2 {
  bottom: -1.5rem;
  left: -1.5rem;
  width: 8rem;
  height: 8rem;
  background: rgba(167, 139, 250, 0.2);
  filter: blur(60px);
}

/* ========== GRID DE ESTATÍSTICAS ========== */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ========== CARTÕES DE ESTATÍSTICAS ========== */
.dashboard-stat-card {
  background: white;
  border-radius: var(--dashboard-radius-2xl);
  padding: 1.5rem;
  box-shadow: var(--dashboard-shadow-md);
  border: 1px solid var(--dashboard-gray-100);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
  position: relative;
  overflow: hidden;
}

.dashboard-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dashboard-stat-card:hover {
  box-shadow: var(--dashboard-shadow-xl);
  transform: translateY(-4px);
  border-color: var(--dashboard-primary);
}

.dashboard-stat-card:hover::before {
  opacity: 1;
}

.dashboard-stat-header {
  display: flex;
  align-items: center;  
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dashboard-stat-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--dashboard-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%);
  box-shadow: var(--dashboard-shadow-lg);
}

.dashboard-stat-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.dashboard-stat-icon.success {
  background: linear-gradient(135deg, var(--dashboard-success) 0%, #059669 100%);
}

.dashboard-stat-icon.warning {
  background: linear-gradient(135deg, var(--dashboard-warning) 0%, #d97706 100%);
}

.dashboard-stat-icon.danger {
  background: linear-gradient(135deg, var(--dashboard-danger) 0%, #dc2626 100%);
}

.dashboard-stat-content {
  flex: 1;
}

.dashboard-stat-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dashboard-gray-600);
  margin-bottom: 0.5rem;
}

.dashboard-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dashboard-gray-900);
  margin-bottom: 0.5rem;
  line-height: 1;
}

.dashboard-stat-change {
  font-size: 0.875rem;
  font-weight: 500;
}

.dashboard-stat-change.positive {
  color: var(--dashboard-success);
}

.dashboard-stat-change.negative {
  color: var(--dashboard-danger);
}

.dashboard-stat-change.neutral {
  color: var(--dashboard-gray-500);
}

/* ========== LAYOUT DE CARDS ========== */
.dashboard-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 1024px) {
  .dashboard-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========== CARTÕES PRINCIPAIS ========== */
.dashboard-card {
  background: white;
  border-radius: var(--dashboard-radius-2xl);
  box-shadow: var(--dashboard-shadow-md);
  border: 1px solid var(--dashboard-gray-100);
  overflow: hidden;
  transition: all 0.3s ease;
}

.dashboard-card:hover {
  box-shadow: var(--dashboard-shadow-lg);
  transform: translateY(-2px);
}

.dashboard-card-header {
  padding: 1.5rem 1.5rem 0;
  border-bottom: 1px solid var(--dashboard-gray-100);
  margin-bottom: 1.5rem;
}

.dashboard-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dashboard-gray-900);
  margin: 0;
  padding-bottom: 1rem;
}

.dashboard-card-content {
  padding: 0 1.5rem 1.5rem;
}

/* ========== BOTÕES MODERNOS ========== */
.dashboard-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--dashboard-radius-lg);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  width: 100%;
  margin-bottom: 0.75rem;
}

.dashboard-button:last-child {
  margin-bottom: 0;
}

.dashboard-button-primary {
  background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%);
  color: white;
  box-shadow: var(--dashboard-shadow-lg);
}

.dashboard-button-primary:hover {
  box-shadow: var(--dashboard-shadow-xl);
  transform: translateY(-2px) scale(1.02);
}

.dashboard-button-secondary {
  background: white;
  color: var(--dashboard-primary);
  border: 2px solid var(--dashboard-primary);
}

.dashboard-button-secondary:hover {
  background: var(--dashboard-primary);
  color: white;
  transform: translateY(-2px);
}

.dashboard-button svg {
  width: 1rem;
  height: 1rem;
}

/* ========== QUICK ACTIONS ========== */
.dashboard-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ========== ESTADOS DE LOADING E VAZIO ========== */
.dashboard-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.dashboard-loading-spinner {
  position: relative;
  width: 3rem;
  height: 3rem;
}

.dashboard-loading-spinner-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid #dbeafe;
  border-radius: 50%;
}

.dashboard-loading-spinner-fg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid var(--dashboard-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: dashboard-spin 1s linear infinite;
}

@keyframes dashboard-spin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard-loading-text {
  margin-top: 1rem;
  color: var(--dashboard-gray-600);
  font-weight: 500;
}

.dashboard-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.dashboard-empty-icon {
  width: 4rem;
  height: 4rem;
  color: var(--dashboard-gray-400);
  margin-bottom: 1rem;
}

.dashboard-empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dashboard-gray-600);
  margin: 0;
}

.dashboard-empty-description {
  font-size: 1rem;
  color: var(--dashboard-gray-500);
  margin-top: 0.5rem;
}

/* ========== RECENT ACTIVITY ========== */
.dashboard-activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--dashboard-gray-50);
  border-radius: var(--dashboard-radius-lg);
  transition: all 0.2s ease;
}

.dashboard-activity-item:hover {
  background: var(--dashboard-gray-100);
  transform: translateX(4px);
}

.dashboard-activity-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--dashboard-radius);
  background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.dashboard-activity-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.dashboard-activity-content {
  flex: 1;
  min-width: 0;
}

.dashboard-activity-title {
  font-weight: 600;
  color: var(--dashboard-gray-900);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-activity-description {
  font-size: 0.875rem;
  color: var(--dashboard-gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-activity-time {
  font-size: 0.75rem;
  color: var(--dashboard-gray-400);
  font-weight: 500;
  white-space: nowrap;
}

/* ========== CHARTS E GRÁFICOS ========== */
.dashboard-chart-container {
  position: relative;
  height: 300px;
  padding: 1rem 0;
}

.dashboard-chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: linear-gradient(135deg, var(--dashboard-gray-50) 0%, var(--dashboard-gray-100) 100%);
  border-radius: var(--dashboard-radius-lg);
  border: 2px dashed var(--dashboard-gray-300);
  color: var(--dashboard-gray-500);
  font-weight: 500;
}

/* ========== RESPONSIVIDADE MOBILE ========== */
@media (max-width: 639px) {
  .dashboard-container {
    padding: 1rem;
  }
  
  .dashboard-header {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .dashboard-header-title {
    font-size: 1.75rem;
  }
  
  .dashboard-header-subtitle {
    font-size: 1rem;
  }
  
  .dashboard-stat-card {
    padding: 1rem;
  }
  
  .dashboard-stat-value {
    font-size: 1.75rem;
  }
  
  .dashboard-card-header {
    padding: 1rem 1rem 0;
    margin-bottom: 1rem;
  }
  
  .dashboard-card-content {
    padding: 0 1rem 1rem;
  }
  
  .dashboard-activity-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .dashboard-activity-icon {
    align-self: center;
  }
}

/* ========== ANIMAÇÕES E TRANSIÇÕES ========== */
@media (prefers-reduced-motion: no-preference) {
  .dashboard-stat-card {
    animation: dashboard-fade-in 0.3s ease-out;
  }
  
  .dashboard-stat-card:nth-child(even) {
    animation-delay: 0.1s;
  }
  
  .dashboard-stat-card:nth-child(3n) {
    animation-delay: 0.2s;
  }
  
  .dashboard-stat-card:nth-child(4n) {
    animation-delay: 0.3s;
  }
}

@keyframes dashboard-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== ACESSIBILIDADE ========== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

/* ========== MODO ESCURO (FUTURO) ========== */
@media (prefers-color-scheme: dark) {
  :root {
    --dashboard-gray-50: #1f2937;
    --dashboard-gray-100: #374151;
    --dashboard-gray-200: #4b5563;
    --dashboard-gray-300: #6b7280;
    --dashboard-gray-400: #9ca3af;
    --dashboard-gray-500: #d1d5db;
    --dashboard-gray-600: #e5e7eb;
    --dashboard-gray-700: #f3f4f6;
    --dashboard-gray-800: #f9fafb;
    --dashboard-gray-900: #ffffff;
  }
}

/* ========== PRINT STYLES ========== */
@media print {
  .dashboard-header-decorations,
  .dashboard-button,
  .dashboard-quick-actions {
    display: none !important;
  }
  
  .dashboard-stat-card,
  .dashboard-card {
    box-shadow: none !important;
    border: 1px solid #000 !important;
  }
  
  .dashboard-header {
    background: #f5f5f5 !important;
    color: #000 !important;
  }
}

/* ========== UTILS ========== */
.dashboard-w-full {
  width: 100%;
}

.dashboard-text-center {
  text-align: center;
}

.dashboard-flex {
  display: flex;
}

.dashboard-flex-col {
  flex-direction: column;
}

.dashboard-items-center {
  align-items: center;
}

.dashboard-justify-center {
  justify-content: center;
}

.dashboard-space-y-3 > * + * {
  margin-top: 0.75rem;
}

.dashboard-mb-4 {
  margin-bottom: 1rem;
}

.dashboard-mt-4 {
  margin-top: 1rem;
}