/* =============================================================================
   KHONTA - Sistema de Gestão Financeira
   Layout Moderno com Menu Vertical
   ============================================================================= */

:root {
  /* Paleta de cores moderna */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --light: #f8fafc;
  --dark: #0f172a;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Sidebar */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 70px;
  --sidebar-bg: #ffffff;
  --sidebar-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  
  /* Layout */
  --header-height: 70px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Reset e configurações base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout principal */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* =============================================================================
   SIDEBAR VERTICAL
   ============================================================================= */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  box-shadow: var(--sidebar-shadow);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--header-height);
}

.sidebar-header .logo {
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-header .logo-text {
  font-size: 1.125rem;
  font-weight: 600;
  opacity: 1;
  transition: var(--transition);
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  transform: translateX(-10px);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 1.125rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  margin-left: auto;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Menu de navegação */
.sidebar-nav {
  padding: 1rem 0;
  list-style: none;
  margin: 0;
  overflow-y: auto;
  height: calc(100vh - var(--header-height) - 80px);
}

.nav-item {
  margin: 0 1rem 0.25rem 1rem;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.875rem 1rem;
  color: var(--gray-600);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  font-weight: 500;
  position: relative;
  gap: 0.75rem;
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--primary);
  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.nav-link .icon {
  font-size: 1.125rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-link .text {
  opacity: 1;
  transition: var(--transition);
}

.sidebar.collapsed .nav-link .text {
  opacity: 0;
  transform: translateX(-10px);
}

.sidebar.collapsed .nav-item {
  margin: 0 0.5rem 0.25rem 0.5rem;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.875rem;
}

/* Tooltip para sidebar colapsada */
.sidebar.collapsed .nav-link {
  position: relative;
}

.sidebar.collapsed .nav-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gray-900);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  margin-left: 0.5rem;
  z-index: 1000;
}

.sidebar.collapsed .nav-link:hover::after {
  opacity: 1;
}

/* Rodapé da sidebar */
.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  border-top: 1px solid var(--gray-200);
  background: var(--sidebar-bg);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
  opacity: 1;
  transition: var(--transition);
}

.user-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.sidebar.collapsed .user-details {
  opacity: 0;
  transform: translateX(-10px);
}

/* =============================================================================
   CONTEÚDO PRINCIPAL
   ============================================================================= */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: var(--transition);
  min-height: 100vh;
  background: var(--gray-50);
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

.content-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.page-subtitle {
  color: var(--gray-600);
  font-size: 1rem;
  margin-top: 0.5rem;
}

.content-wrapper {
  padding: 0 2rem 2rem 2rem;
}

/* =============================================================================
   CARDS MODERNOS
   ============================================================================= */
.card {
  background: white;
  border: none;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-800);
}

.card-body {
  padding: 1.5rem;
}

/* Stats Cards */
.stats-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: var(--transition);
  border-left: 4px solid var(--primary);
}

.stats-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.stats-card.success {
  border-left-color: var(--success);
}

.stats-card.danger {
  border-left-color: var(--danger);
}

.stats-card.warning {
  border-left-color: var(--warning);
}

.stats-card.info {
  border-left-color: var(--info);
}

.stats-card-body {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-info h6 {
  color: var(--gray-600);
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.stats-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.stats-icon.success { background: var(--success); }
.stats-icon.danger { background: var(--danger); }
.stats-icon.warning { background: var(--warning); }
.stats-icon.info { background: var(--info); }

/* =============================================================================
   FILTROS E FORMULÁRIOS
   ============================================================================= */
.filters-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.form-label {
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-control, .form-select {
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem;
  font-size: 0.875rem;
  transition: var(--transition);
  background: white;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  outline: none;
}

/* =============================================================================
   BOTÕES MODERNOS
   ============================================================================= */
.btn {
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1.5rem;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary);
  color: white;
}

/* =============================================================================
   TABELAS MODERNAS
   ============================================================================= */
.table-responsive {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table {
  margin: 0;
  background: white;
}

.table thead th {
  background: var(--gray-100);
  border: none;
  padding: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody td {
  padding: 1rem;
  border-top: 1px solid var(--gray-200);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: var(--gray-50);
}

/* =============================================================================
   PROGRESS E STATUS
   ============================================================================= */
.progress {
  height: 8px;
  border-radius: 4px;
  background: var(--gray-200);
}

.progress-bar {
  border-radius: 4px;
}

.badge {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
}

/* =============================================================================
   ALERTAS MODERNOS
   ============================================================================= */
.alert {
  border: none;
  border-radius: var(--border-radius);
  padding: 1rem 1.5rem;
  margin: 1rem 2rem;
  font-weight: 500;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
  border-left: 4px solid var(--success);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
  border-left: 4px solid var(--danger);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border-left: 4px solid var(--warning);
}

.alert-info {
  background: rgba(6, 182, 212, 0.1);
  color: #155e75;
  border-left: 4px solid var(--info);
}

/* =============================================================================
   RESPONSIVIDADE
   ============================================================================= */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .content-wrapper {
    padding: 0 1rem 1rem 1rem;
  }
  
  .content-header {
    padding: 1rem;
  }
  
  .filters-card {
    margin: 0 1rem 1rem 1rem;
  }
}

@media (max-width: 576px) {
  .stats-card-body {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .stats-value {
    font-size: 1.5rem;
  }
}

/* =============================================================================
   ANIMAÇÕES E MICRO-INTERAÇÕES
   ============================================================================= */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card, .stats-card {
  animation: slideIn 0.3s ease-out;
}

/* Loading states */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}