/* ============================================================
   SISTEMA DE DEVOLUÇÕES - DESIGN SYSTEM PRINCIPAL
   main.css — Variáveis, reset, tipografia, light/dark mode
   ============================================================ */

/* ── Google Fonts: Inter ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ══════════════════════════════════════════════════════════
   VARIÁVEIS — TEMA CLARO (padrão)
══════════════════════════════════════════════════════════ */
:root {
  /* Cores primárias */
  --color-primary:        #2563EB;   /* Azul principal */
  --color-primary-dark:   #1D4ED8;   /* Azul escuro (hover) */
  --color-primary-light:  #DBEAFE;   /* Azul claro (bg badges) */
  --color-primary-glass:  rgba(37, 99, 235, 0.12);

  /* Cores de superfície e fundo */
  --color-bg:             #F1F5F9;   /* Fundo da página */
  --color-surface:        #FFFFFF;   /* Cards, sidebar */
  --color-surface-alt:    #F8FAFC;   /* Fundo alternativo */
  --color-border:         #E2E8F0;   /* Bordas sutis */
  --color-border-strong:  #CBD5E1;

  /* Textos */
  --color-text:           #0F172A;   /* Texto principal */
  --color-text-muted:     #64748B;   /* Texto secundário */
  --color-text-subtle:    #94A3B8;   /* Texto muito suave */

  /* Status */
  --color-success:        #16A34A;
  --color-success-bg:     #DCFCE7;
  --color-warning:        #D97706;
  --color-warning-bg:     #FEF3C7;
  --color-danger:         #DC2626;
  --color-danger-bg:      #FEE2E2;
  --color-info:           #0284C7;
  --color-info-bg:        #E0F2FE;
  --color-neutral-bg:     #F1F5F9;

  /* Sidebar */
  --sidebar-width:        260px;
  --sidebar-bg:           #0F172A;
  --sidebar-text:         #CBD5E1;
  --sidebar-text-active:  #FFFFFF;
  --sidebar-item-active:  rgba(37, 99, 235, 0.25);
  --sidebar-border:       rgba(255,255,255,0.06);
  --sidebar-icon-color:   #60A5FA;

  /* Sombras */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 10px 25px rgba(0,0,0,0.10), 0 4px 10px rgba(0,0,0,0.06);
  --shadow-xl:  0 20px 40px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 0 3px rgba(37, 99, 235, 0.20);

  /* Bordas */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Transições */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Tipografia */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ══════════════════════════════════════════════════════════
   VARIÁVEIS — TEMA ESCURO
══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --color-bg:             #0A0F1A;
  --color-surface:        #111827;
  --color-surface-alt:    #1E293B;
  --color-border:         #1E293B;
  --color-border-strong:  #334155;

  --color-text:           #F1F5F9;
  --color-text-muted:     #94A3B8;
  --color-text-subtle:    #64748B;

  --color-primary-light:  rgba(37, 99, 235, 0.20);
  --color-primary-glass:  rgba(37, 99, 235, 0.15);

  --sidebar-bg:           #060D1A;
  --sidebar-border:       rgba(255,255,255,0.05);

  --color-success-bg:     rgba(22, 163, 74, 0.15);
  --color-warning-bg:     rgba(217, 119, 6, 0.15);
  --color-danger-bg:      rgba(220, 38, 38, 0.15);
  --color-info-bg:        rgba(2, 132, 199, 0.15);
  --color-neutral-bg:     rgba(100, 116, 139, 0.15);

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.30);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.35);
  --shadow-lg:  0 10px 25px rgba(0,0,0,0.40);
  --shadow-xl:  0 20px 40px rgba(0,0,0,0.50);
}

/* ══════════════════════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color var(--transition-base), color var(--transition-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-primary-dark); }

img, video { max-width: 100%; display: block; }

ul, ol { list-style: none; }

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

/* ══════════════════════════════════════════════════════════
   TIPOGRAFIA
══════════════════════════════════════════════════════════ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
  letter-spacing: -0.02em;
}
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-muted    { color: var(--color-text-muted); }
.text-subtle   { color: var(--color-text-subtle); }
.text-primary  { color: var(--color-primary); }
.text-success  { color: var(--color-success); }
.text-danger   { color: var(--color-danger); }
.text-warning  { color: var(--color-warning); }

.font-light   { font-weight: 300; }
.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-xs  { font-size: 0.75rem; }
.text-sm  { font-size: 0.875rem; }
.text-base{ font-size: 1rem; }
.text-lg  { font-size: 1.125rem; }
.text-xl  { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

/* ══════════════════════════════════════════════════════════
   LAYOUT DASHBOARD
══════════════════════════════════════════════════════════ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar lateral */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition-base), width var(--transition-base);
  overflow: hidden;
  border-right: 1px solid var(--sidebar-border);
}

/* Conteúdo principal */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-base);
}

/* Topbar */
.topbar {
  height: 64px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

/* Área de página */
.page-content {
  flex: 1;
  padding: 1.75rem;
  max-width: 1400px;
  width: 100%;
}

/* Page header */
.page-header {
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-size: 1.625rem;
  margin-bottom: 0.25rem;
}
.page-header p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ══════════════════════════════════════════════════════════
   UTILITÁRIOS
══════════════════════════════════════════════════════════ */
.d-flex     { display: flex; }
.flex-col   { flex-direction: column; }
.flex-wrap  { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end   { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none !important; }
.invisible { visibility: hidden; }

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

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relative { position: relative; }
.absolute { position: absolute; }

/* Overlay para sidebar mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ══════════════════════════════════════════════════════════
   SCROLLBAR CUSTOMIZADA
══════════════════════════════════════════════════════════ */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--color-border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-subtle); }

/* ══════════════════════════════════════════════════════════
   ANIMAÇÕES GLOBAIS
══════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.animate-fade-in    { animation: fadeIn var(--transition-base) both; }
.animate-scale-in   { animation: scaleIn var(--transition-base) both; }
.animate-spin       { animation: spin 1s linear infinite; }
.animate-pulse      { animation: pulse 2s ease-in-out infinite; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-border) 25%,
    var(--color-surface-alt) 50%,
    var(--color-border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
