/* =============================================================================
   SISTEMA CANECAS - DESIGN MODERNO 2025
   Stack: Bootstrap 5.3 + CSS Custom Properties + Animações
   ========================================================================== */

/* =============================================================================
   0) VARIÁVEIS DE DESIGN MODERNO
   ========================================================================== */

/* DARK THEME - Paleta moderna com gradientes suaves */
html.theme-dark {
  /* Cores principais */
  --primary: #6366f1;        /* Indigo vibrante */
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.1);
  
  --secondary: #8b5cf6;      /* Purple */
  --accent: #06b6d4;         /* Cyan */
  --success: #10b981;        /* Green */
  --warning: #f59e0b;        /* Amber */
  --danger: #ef4444;         /* Red */
  
  /* Backgrounds com profundidade */
  --bg-primary: #0f172a;     /* Slate 900 */
  --bg-secondary: #1e293b;   /* Slate 800 */
  --bg-tertiary: #334155;    /* Slate 700 */
  
  --card-bg: #1e293b;
  --card-hover: #334155;
  
  /* Bordas e divisores */
  --border-color: rgba(148, 163, 184, 0.1);
  --border-hover: rgba(99, 102, 241, 0.3);
  
  /* Textos */
  --text-primary: #f1f5f9;   /* Slate 100 */
  --text-secondary: #94a3b8; /* Slate 400 */
  --text-muted: #64748b;     /* Slate 500 */
  
  /* Sidebar e Topbar - Cores elegantes diferenciadas */
  --sidebar-bg: linear-gradient(180deg, #1a1f2e 0%, #0f1419 100%);
  --sidebar-border: rgba(99, 102, 241, 0.15);
  --sidebar-accent: #1a1f2e;
  
  --topbar-bg: rgba(26, 31, 46, 0.95);
  --topbar-backdrop: blur(20px);
  --topbar-border: rgba(99, 102, 241, 0.2);
  
  /* Sombras modernas */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  
  /* Glassmorphism */
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(148, 163, 184, 0.1);
}

/* LIGHT THEME - Paleta clean e profissional */
html.theme-light {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.08);
  
  --secondary: #8b5cf6;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --bg-primary: #f8fafc;     /* Slate 50 */
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;    /* Slate 100 */
  
  --card-bg: #ffffff;
  --card-hover: #f8fafc;
  
  --border-color: #e2e8f0;   /* Slate 200 */
  --border-hover: rgba(99, 102, 241, 0.3);
  
  --text-primary: #0f172a;   /* Slate 900 */
  --text-secondary: #475569; /* Slate 600 */
  --text-muted: #94a3b8;     /* Slate 400 */
  
  /* Sidebar e Topbar - Degradê roxo/azul lindo igual da imagem */
  --sidebar-bg: linear-gradient(180deg, #6366f1 0%, #7c3aed 50%, #8b5cf6 100%);
  --sidebar-border: rgba(99, 102, 241, 0.3);
  --sidebar-accent: rgba(99, 102, 241, 0.15);
  
  --topbar-bg: linear-gradient(90deg, #6366f1 0%, #7c3aed 100%);
  --topbar-backdrop: blur(20px);
  --topbar-border: rgba(99, 102, 241, 0.3);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(226, 232, 240, 0.8);
}

/* =============================================================================
   1) BASE & RESET MODERNO
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
  margin: 0;
  padding: 0;
}

/* Scrollbar customizada */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* =============================================================================
   2) LAYOUT PRINCIPAL COM SIDEBAR
   ========================================================================== */

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* Sidebar moderna com glassmorphism */
.side {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
  color: #ffffff !important;
}

.side * {
  color: #ffffff !important;
}

/* Área principal */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar com glassmorphism e cor diferenciada */
.page-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2.5rem;
  background: var(--topbar-bg);
  backdrop-filter: var(--topbar-backdrop);
  border-bottom: 2px solid var(--topbar-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.page-top h1 {
  font-size: 1.875rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 50%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.pill {
  padding: 0.625rem 1.25rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.15) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 9999px;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pill::before {
  content: '�';
  font-size: 0.875rem;
}

/* Conteúdo principal */
.page-content {
  padding: 2rem;
  flex: 1;
}



/* =============================================================================
   3) BRAND & SIDEBAR HEADER ELEGANTE
   ========================================================================== */

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.75rem;
  padding: 0;
}

.brand-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.brand-user {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  font-weight: 500;
}

/* =============================================================================
   4) MENU DE NAVEGAÇÃO MODERNO COM SEÇÕES
   ========================================================================== */

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Seções do menu sem fundo */
.nav-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.nav-section-highlight {
  background: transparent;
  border: none;
}

/* Seção do logout */
.nav-section-bottom {
  margin-top: auto;
  padding-top: 0.5rem;
  background: transparent;
}

/* Títulos das seções - mais discretos */
.nav-title {
  color: #ffffff !important;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 1rem 0 0.25rem 0.75rem;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Grupo de links */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Botões do menu - clean e minimalista */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  color: #ffffff;
  font-weight: 500;
  font-size: 0.875rem;
  background: transparent;
  border: none;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Estado ativo */
.nav-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-weight: 600;
}

.nav-btn.active .icon {
  transform: scale(1.08);
}

/* Botão em destaque (Dashboard) */
.nav-btn-featured {
  background: transparent;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-btn-featured .icon {
  font-size: 1.25rem;
}

.nav-btn-featured:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-btn-featured.active {
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

/* Botão de logout */
.nav-btn-logout {
  color: rgba(239, 68, 68, 0.9);
  font-weight: 600;
  justify-content: center;
  padding: 0.75rem;
  background: transparent;
}

.nav-btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: rgb(239, 68, 68);
}

/* Ícone do menu - emoji maior e mais claro */
.nav-btn .icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
  line-height: 1;
  opacity: 0.95;
}

.nav-btn:hover .icon {
  transform: scale(1.15);
  opacity: 1;
}

.nav-btn .label {
  flex: 1;
  line-height: 1.3;
  color: #ffffff !important;
}

/* Links sem decoração */
.side-nav a:link,
.side-nav a:visited {
  color: #ffffff !important;
  text-decoration: none;
}

/* =============================================================================
   5) FORMULÁRIOS MODERNOS
   ========================================================================== */

label {
  display: block;
  margin: 1rem 0 0.5rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

input, select, textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--card-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-md);
  transform: translateY(-1px);
}

input:hover, select:hover, textarea:hover {
  border-color: var(--border-hover);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* Botões modernos com gradientes */
button,
.btn {
  margin-top: 1.5rem;
  width: 100%;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
}

button::before,
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

button:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

button:hover::before,
.btn:hover::before {
  opacity: 1;
}

button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button span,
.btn span {
  position: relative;
  z-index: 1;
}

/* Botões secundários */
.btn-secondary {
  background: var(--card-bg);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--card-hover);
  border-color: var(--primary);
}

/* Botão de perigo com gradiente vermelho */
.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: var(--shadow-md);
}

.btn-danger::before {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* =============================================================================
   6) CARDS, TABELAS E GRIDS MODERNOS
   ========================================================================== */

/* Cards com glassmorphism e sombras profundas */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--border-hover);
}

.card:hover::before {
  opacity: 1;
}

/* Tabelas modernas e responsivas */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table thead {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table thead th {
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: none;
}

.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  background: var(--card-hover);
  transform: scale(1.01);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Grid systems - Desktop usa colunas fixas, mobile empilha */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Card com métricas modernas */
.card-metric {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card-metric::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--metric-color-1, #6366f1), var(--metric-color-2, #8b5cf6));
}

.card-metric:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-metric .metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-metric .metric-info {
  flex: 1;
}

.card-metric .metric-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease;
}

.card-metric:hover .metric-icon {
  transform: scale(1.1) rotate(5deg);
}

.card-metric .metric-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-metric .metric-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.card-metric .metric-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 6px;
  font-weight: 500;
}

/* Cores para os cards métricos - com gradientes mais bonitos */
.metric-green {
  --metric-color-1: #10b981;
  --metric-color-2: #059669;
}
.metric-green .metric-icon { 
  background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
  color: #fff; 
}
.metric-green .metric-value { 
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-blue {
  --metric-color-1: #3b82f6;
  --metric-color-2: #2563eb;
}
.metric-blue .metric-icon { 
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); 
  color: #fff; 
}
.metric-blue .metric-value { 
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-purple {
  --metric-color-1: #8b5cf6;
  --metric-color-2: #7c3aed;
}
.metric-purple .metric-icon { 
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); 
  color: #fff; 
}
.metric-purple .metric-value { 
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-red {
  --metric-color-1: #ef4444;
  --metric-color-2: #dc2626;
}
.metric-red .metric-icon { 
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); 
  color: #fff; 
}
.metric-red .metric-value { 
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-orange {
  --metric-color-1: #f59e0b;
  --metric-color-2: #d97706;
}
.metric-orange .metric-icon { 
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); 
  color: #fff; 
}
.metric-orange .metric-value { 
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-indigo {
  --metric-color-1: #6366f1;
  --metric-color-2: #4f46e5;
}
.metric-indigo .metric-icon { 
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); 
  color: #fff; 
}
.metric-indigo .metric-value { 
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-gray {
  --metric-color-1: #64748b;
  --metric-color-2: #475569;
}
.metric-gray .metric-icon { 
  background: linear-gradient(135deg, #64748b 0%, #475569 100%); 
  color: #fff; 
}
.metric-gray .metric-value { 
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Stats e números grandes */
.big {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

/* Quick actions grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.quick a {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.quick a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.quick a:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.quick a:hover::before {
  opacity: 0.1;
}

.quick a span {
  position: relative;
  z-index: 1;
}

/* Divisores e seções */
.divider {
  margin: 2rem 0 1rem;
  padding: 1rem 0 0.5rem;
  border-top: 2px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 1.125rem;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .row-2 {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   7) MENSAGENS, ALERTAS E STATUS
   ========================================================================== */

/* Alertas modernos com ícones */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border-left: 4px solid var(--danger);
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  font-weight: 600;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
  animation: slideInDown 0.3s ease;
}

.ok {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border-left: 4px solid var(--success);
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  font-weight: 600;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
  animation: slideInDown 0.3s ease;
}

.warning {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border-left: 4px solid var(--warning);
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  font-weight: 600;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
  animation: slideInDown 0.3s ease;
}

/* Status badges modernos */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Status Pago */
html.theme-dark .status.pago {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

html.theme-light .status.pago {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #059669;
}

.status.pago::before {
  background: #10b981;
}

/* Status Aberto */
html.theme-dark .status.aberto {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

html.theme-light .status.aberto {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #dc2626;
}

.status.aberto::before {
  background: #ef4444;
}

/* Status hover effect */
.status:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* =============================================================================
   8) ANIMAÇÕES E TRANSIÇÕES
   ========================================================================== */

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Classe para animações de entrada */
.fade-in {
  animation: fadeIn 0.5s ease;
}

.slide-in-up {
  animation: slideInUp 0.5s ease;
}

.slide-in-down {
  animation: slideInDown 0.5s ease;
}

/* =============================================================================
   9) UTILIDADES MODERNAS
   ========================================================================== */

/* Textos */
.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

.small {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Badges e pills */
.badge-primary {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-secondary {
  background: var(--secondary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--card-bg) 25%, var(--card-hover) 50%, var(--card-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* =============================================================================
   10) MODO COMPACTO (SIDEBAR COLAPSADA)
   ========================================================================== */

html.compact .layout {
  grid-template-columns: 80px 1fr;
}

html.compact .side {
  padding: 1rem 0.5rem;
}

html.compact .brand {
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
}

html.compact .brand-info {
  display: none;
}

html.compact .nav-section {
  padding: 0.5rem;
}

html.compact .nav-title {
  display: none;
}

html.compact .nav-group {
  gap: 0.25rem;
}

html.compact .nav-btn {
  justify-content: center;
  padding: 0.75rem 0.5rem;
  flex-direction: column;
  gap: 0.25rem;
  color: #ffffff !important;
}

html.compact .nav-btn .label {
  font-size: 0.65rem;
  text-align: center;
  color: #ffffff !important;
}

html.compact .nav-btn .icon {
  width: 36px;
  height: 36px;
}

html.compact .nav-btn-featured {
  padding: 0.875rem 0.5rem;
}

html.compact .nav-btn:hover,
html.compact .nav-btn.active {
  transform: translateY(-2px);
  padding-left: 0.5rem;
}

/* =============================================================================
   11) RESPONSIVIDADE MODERNA
   ========================================================================== */

/* Tablet: entre 769px e 1023px */
@media (min-width: 769px) and (max-width: 1023px) {
  .layout {
    grid-template-columns: 240px 1fr;
  }
  
  .page-content {
    padding: 1.5rem;
  }
  
  /* Tablet mantém grids com menos colunas */
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: apenas em telas pequenas (max 768px) */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr !important;
  }
  
  .side {
    position: relative;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 2px solid var(--sidebar-border);
    padding: 0.75rem;
  }
  
  .brand {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    flex-direction: row;
  }
  
  .badge {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }
  
  .brand-name {
    font-size: 0.875rem;
  }
  
  .brand-user {
    font-size: 0.75rem;
  }
  
  /* Menu compacto em 2 colunas */
  .side-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .nav-section {
    padding: 0;
    margin-bottom: 0.5rem;
  }
  
  .nav-title {
    font-size: 0.7rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    grid-column: 1 / -1;
    color: #ffffff !important;
  }
  
  .nav-group {
    display: contents;
  }
  
  .nav-btn {
    padding: 0.75rem;
    font-size: 0.8rem;
    flex-direction: column;
    text-align: center;
    gap: 0.25rem;
    justify-content: center;
    min-height: 70px;
    color: #ffffff !important;
  }
  
  .nav-btn .icon {
    width: 28px;
    height: 28px;
  }
  
  .nav-btn .label {
    font-size: 0.75rem;
    line-height: 1.2;
    color: #ffffff !important;
  }
  
  .nav-btn-featured {
    grid-column: 1 / -1;
    flex-direction: row;
    padding: 1rem;
    min-height: auto;
  }
  
  .nav-section-bottom {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .nav-section-bottom .nav-btn {
    flex-direction: row;
    justify-content: flex-start;
    min-height: auto;
    padding: 0.75rem 1rem;
  }
  
  .page-top {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .page-top h1 {
    font-size: 1.25rem;
    width: 100%;
  }
  
  .pill {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
  }
  
  .page-content {
    padding: 1rem;
  }
  
  /* Cards e grids empilhados APENAS em mobile */
  .grid, .grid-2, .grid-3, .grid-4, .quick-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }
  
  .row-2 {
    grid-template-columns: 1fr;
  }
  
  .card {
    padding: 1rem;
    margin-bottom: 0.75rem;
  }
  
  /* Tabelas responsivas */
  .table-wrapper, .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
  }
  
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
  }
  
  /* Botões e inputs maiores para touch */
  button, .btn, a.btn, .btn-primary, .btn-secondary {
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    font-size: 16px;
  }
  
  input, select, textarea {
    min-height: 48px;
    padding: 0.75rem;
    font-size: 16px;
  }
  
  /* Formulários empilhados */
  .form-grid, .filtros-caixa form, .filtros-vendas {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }
  
  .filtros-vendas {
    padding: 1rem;
  }
  
  .filtro-btn {
    padding: 0.75rem 1rem;
    font-size: 15px;
  }
  
  /* Dropdowns mobile */
  .item-dropdown, #cliente-resultados {
    max-height: 50vh !important;
    position: fixed !important;
    left: 1rem !important;
    right: 1rem !important;
    width: auto !important;
  }
  
  /* Carrinho mobile */
  .venda-cart {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .cart-section {
    position: static !important;
    max-height: none !important;
  }
  
  .add-item-section, .cart-section {
    padding: 1rem;
  }
  
  /* Headers de páginas */
  .vendas-header, .caixa-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .vendas-header h2, .caixa-header h2 {
    font-size: 1.5rem;
  }
  
  .btn-nova-venda, .btn-ajuste-small {
    width: 100%;
    justify-content: center;
    padding: 1rem 1.5rem;
    font-size: 16px;
  }
  
  /* Stats cards */
  .stats-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .stat-card.total .stat-value {
    font-size: 28px;
  }
  
  /* Movimentos */
  .movimento-item {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
    padding: 1rem;
  }
  
  .movimento-valor {
    text-align: left;
    font-size: 20px;
  }
  
  .movimento-header {
    padding: 1rem;
  }
  
  .ordenar-links {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  /* Vendas cards */
  .venda-card {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
    padding: 1rem;
  }
  
  .venda-id {
    width: fit-content;
  }
  
  .venda-valor {
    font-size: 20px;
    text-align: left;
  }
  
  .venda-status {
    justify-content: flex-start;
  }
  
  /* Ajuste form */
  .ajuste-form {
    padding: 1rem;
  }
  
  .form-row {
    grid-template-columns: 1fr !important;
  }
}
  
  .brand {
    margin-bottom: 1rem;
    padding: 1rem;
  }
  
  .page-top {
    padding: 1rem 1rem 1rem 4.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .page-top h1 {
    font-size: 1.25rem;
    width: 100%;
  }
  
  .pill {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
  }
  
  .page-content {
    padding: 1rem;
  }
  
  /* Menu em lista vertical no mobile */
  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .nav-section {
    padding: 0.75rem;
  }
  
  .nav-title {
    font-size: 0.7rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
  }
  
  .nav-group {
    gap: 0.375rem;
  }
  
  .nav-btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  .nav-btn .icon {
    width: 24px;
    height: 24px;
  }
  
  .nav-btn .label {
    font-size: 0.875rem;
  }
  
  /* Cards e grids */
  .grid, .grid-2, .grid-3, .grid-4, .quick-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .row-2 {
    grid-template-columns: 1fr;
  }
  
  .card {
    padding: 1rem;
  }
  
  /* Tabelas responsivas */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
  }
  
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
  }
  
  /* Botões e inputs maiores para touch */
  button, .btn, a.btn {
    min-height: 44px;
    padding: 0.75rem 1.25rem;
    font-size: 15px;
  }
  
  input, select, textarea {
    min-height: 44px;
    padding: 0.75rem;
    font-size: 16px; /* Previne zoom no iOS */
  }
  
  /* Formulários empilhados */
  .form-grid, .filtros-caixa form, .filtros-vendas {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }
  
  /* Dropdowns e selects mobile-friendly */
  .item-dropdown, .cliente-resultados {
    max-height: 60vh !important;
  }
  
  .item-search-container {
    position: static;
  }
  
  /* Carrinho mobile */
  .venda-cart {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .cart-section {
    position: static !important;
    max-height: none !important;
  }
  
  .add-item-section, .cart-section {
    padding: 1rem;
  }
  
  /* Ajuste formulário */
  .ajuste-form {
    padding: 1.25rem;
  }
  
  .form-row {
    grid-template-columns: 1fr !important;
  }
  
  /* Headers de páginas */
  .vendas-header, .caixa-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .vendas-header h2, .caixa-header h2 {
    font-size: 1.5rem;
  }
  
  .btn-nova-venda, .btn-ajuste-small {
    width: 100%;
    justify-content: center;
    padding: 0.875rem 1.5rem;
  }
  
  /* Stats cards */
  .stats-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .stat-card.total .stat-value {
    font-size: 28px;
  }
  
  /* Movimentos */
  .movimento-item {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
    padding: 1rem;
  }
  
  .movimento-valor {
    text-align: left;
    font-size: 20px;
  }
  
  /* Vendas cards */
  .venda-card {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
    padding: 1rem;
  }
  
  .venda-id {
    width: fit-content;
  }
  
  .venda-valor {
    font-size: 18px;
    text-align: left;
  }
  
  .venda-status {
    justify-content: flex-start;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .badge {
    width: 48px;
    height: 48px;
  }
  
  .brand-info b {
    font-size: 0.875rem;
  }
  
  .page-top h1 {
    font-size: 1.25rem;
  }
  
  .big {
    font-size: 2rem;
  }
  
  input, select, textarea, button, .btn {
    font-size: 16px; /* Previne zoom no iOS */
  }
}

/* =============================================================================
   12) ÍCONES SVG E BOOTSTRAP ICONS
   ========================================================================== */

.nav-btn .icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Bootstrap Icons integration */
.nav-btn .icon i {
  font-size: 1.25rem;
}

/* =============================================================================
   13) MELHORIAS DE ACESSIBILIDADE
   ========================================================================== */

/* Focus visible para navegação por teclado */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Reduce motion para quem prefere */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .card,
  .nav-btn,
  input,
  select,
  button {
    border-width: 2px;
  }
}

/* =============================================================================
   14) PRINT STYLES
   ========================================================================== */

@media print {
  .side,
  .page-top,
  .icon-btn,
  button,
  .btn {
    display: none !important;
  }
  
  .layout {
    grid-template-columns: 1fr;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  * {
    background: white !important;
    color: black !important;
  }
}
