/* =============================================================================
   KHONTA - Sistema de Gestão Financeira - VERSÃO CLEAN
   Layout Minimalista e Moderno
   ============================================================================= */

:root {
  /* Paleta de cores minimalista */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #64748b;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  
  /* Tons neutros */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 64px;
  --sidebar-bg: #ffffff;
  --header-height: 64px;
  --border-radius: 8px;
  --border-radius-sm: 6px;
  --transition: all 0.2s ease;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Typography */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Reset e 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.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  /* Corrigir encoding de caracteres */
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
}

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

/* =============================================================================
   SIDEBAR MINIMALISTA
   ============================================================================= */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--gray-200);
  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: 1rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--header-height);
  position: relative;
}

.sidebar-header .logo {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-header .logo-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  opacity: 1;
  transition: var(--transition);
  white-space: nowrap;
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* Botão toggle clean */
.sidebar-toggle {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-size: 14px;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  margin-left: auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

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

.nav-item {
  margin: 0 0.75rem 2px 0.75rem;
}

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

.nav-link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

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

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

.sidebar.collapsed .nav-link .text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

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

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

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

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

.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);
  cursor: pointer;
}

.user-info:hover {
  background: var(--gray-100);
}

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

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

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

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

.sidebar.collapsed .user-details {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .user-info {
  justify-content: center;
}

/* =============================================================================
   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: 1.5rem;
}

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

.page-subtitle {
  color: var(--gray-500);
  font-size: 14px;
  margin-top: 0.25rem;
}

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

/* =============================================================================
   CARDS MINIMALISTAS
   ============================================================================= */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow);
}

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

.card-body {
  padding: 1.5rem;
}

/* Stats Cards minimalistas */
.stats-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}

.stats-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow);
}

/* Indicadores de cor sutis */
.stats-card.success::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--success);
}

.stats-card.danger::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--danger);
}

.stats-card.warning::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--warning);
}

.stats-card.info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--info);
}

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

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

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

.stats-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--gray-400);
  background: var(--gray-100);
}

/* =============================================================================
   FILTROS E FORMULÁRIOS
   ============================================================================= */
.filters-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

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

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

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

/* =============================================================================
   BOTÕES MINIMALISTAS
   ============================================================================= */
.btn {
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 14px;
  padding: 0.75rem 1rem;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

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

.btn-success:hover {
  background: #047857;
  border-color: #047857;
}

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

.btn-warning:hover {
  background: #b45309;
  border-color: #b45309;
}

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

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

/* =============================================================================
   TABELAS LIMPAS
   ============================================================================= */
.table-responsive {
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

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

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

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

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

/* =============================================================================
   BADGES E INDICADORES
   ============================================================================= */
.badge {
  font-weight: 500;
  font-size: 11px;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
}

.badge.bg-success {
  background: var(--success) !important;
  color: white;
}

.badge.bg-danger {
  background: var(--danger) !important;
  color: white;
}

.badge.bg-warning {
  background: var(--warning) !important;
  color: white;
}

.badge.bg-light {
  background: var(--gray-100) !important;
  color: var(--gray-700);
}

/* Progress bars */
.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--gray-200);
  overflow: hidden;
}

.progress-bar {
  border-radius: 3px;
  transition: var(--transition);
}

/* =============================================================================
   ALERTAS LIMPOS
   ============================================================================= */
.alert {
  border: 1px solid;
  border-radius: var(--border-radius);
  padding: 1rem;
  margin: 1rem 2rem;
  font-weight: 500;
  font-size: 14px;
}

.alert-success {
  background: rgba(5, 150, 105, 0.1);
  color: var(--success);
  border-color: var(--success);
}

.alert-danger {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  border-color: var(--danger);
}

.alert-warning {
  background: rgba(217, 119, 6, 0.1);
  color: var(--warning);
  border-color: var(--warning);
}

.alert-info {
  background: rgba(8, 145, 178, 0.1);
  color: var(--info);
  border-color: 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: 20px;
  }
}

/* =============================================================================
   UTILITÁRIOS
   ============================================================================= */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--gray-500) !important; }
.text-primary { color: var(--primary) !important; }

.bg-success { background-color: var(--success) !important; }
.bg-danger { background-color: var(--danger) !important; }
.bg-warning { background-color: var(--warning) !important; }
.bg-light { background-color: var(--gray-100) !important; }
.bg-primary { background-color: var(--primary) !important; }

.bg-opacity-10 { opacity: 0.1 !important; }

.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }

.rounded { border-radius: var(--border-radius) !important; }
.rounded-pill { border-radius: 50px !important; }
.rounded-circle { border-radius: 50% !important; }

/* Animações suaves */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Garantir que o botão de toggle fique sempre visível mesmo com a sidebar colapsada */
.sidebar.collapsed .sidebar-toggle {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: absolute;
  right: 8px;
  top: 16px;
  z-index: 1100;
}

/* =============================================================================
   TUTORIAIS
   ============================================================================= */

.tutorial-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

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

.tutorial-thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #000;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    color: white;
    opacity: 0.8;
    pointer-events: none;
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}

.tutorial-title {
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* =============================================================================
   ATENDIMENTO ONLINE — ajustes de layout
   ============================================================================= */

/* Garante que o content-wrapper não corte conteúdo horizontal */
.content-wrapper {
  overflow-x: hidden;
}

/* Hero do atendimento online: respeita o padding do content-wrapper */
.at-hero {
  margin-left: -2rem;
  margin-right: -2rem;
  border-radius: 0 !important;
  padding-left: calc(2rem + 12px) !important;
  padding-right: calc(2rem + 12px) !important;
}

/* Em mobile o content-wrapper tem padding 1rem */
@media (max-width: 768px) {
  .at-hero {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: calc(1rem + 12px) !important;
    padding-right: calc(1rem + 12px) !important;
  }
}
