/* ==============================================================================
   DESIGN TOKENS & DESIGN SYSTEM — ERP MULTI-TENANT SAAS
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* --- PALETA DE CORES PRINCIPAL (TECH SAAS) --- */
  --brand-primary: #2563EB;
  --brand-primary-hover: #1D4ED8;
  --brand-primary-active: #1E40AF;
  --brand-primary-light: #EFF6FF;
  --brand-primary-rgb: 37, 99, 235;

  --brand-secondary: #4F46E5;
  --brand-accent: #06B6D4;
  --brand-gradient: linear-gradient(135deg, #2563EB 0%, #4F46E5 100%);
  --brand-gradient-dark: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #2563EB 100%);
  --brand-gradient-card: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(79, 70, 229, 0.03) 100%);

  /* --- SUPERFÍCIES (LIGHT MODE PADRÃO) --- */
  --surface-app: #F8FAFC;
  --surface-card: #FFFFFF;
  --surface-card-hover: #F8FAFC;
  --surface-muted: #F1F5F9;
  --surface-sidebar: #0F172A;
  --surface-sidebar-hover: #1E293B;
  --surface-sidebar-active: #2563EB;
  --surface-header: rgba(255, 255, 255, 0.95);
  --surface-modal: #FFFFFF;
  --surface-input: #F8FAFC;
  --surface-elevated: #FFFFFF;

  /* --- BORDAS & DIVISORES --- */
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-focus: #3B82F6;
  --border-input: #E2E8F0;

  /* --- TIPOGRAFIA & CORES DE TEXTO --- */
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-white: #FFFFFF;
  --text-link: #2563EB;
  --label-color: #334155;

  /* --- CORES SEMÂNTICAS & BADGES (LIGHT) --- */
  --color-success: #10B981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-success-text: #065F46;
  --color-success-border: rgba(16, 185, 129, 0.25);

  --color-warning: #F59E0B;
  --color-warning-bg: rgba(245, 158, 11, 0.15);
  --color-warning-text: #92400E;
  --color-warning-border: rgba(245, 158, 11, 0.3);

  --color-danger: #EF4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-danger-text: #991B1B;
  --color-danger-border: rgba(239, 68, 68, 0.25);

  --color-info: #06B6D4;
  --color-info-bg: rgba(6, 182, 212, 0.12);
  --color-info-text: #155E75;
  --color-info-border: rgba(6, 182, 212, 0.25);

  /* --- TABELAS --- */
  --table-bg: #FFFFFF;
  --table-th-bg: #F8FAFC;
  --table-th-color: #475569;
  --table-td-color: #1E293B;
  --table-border: #E2E8F0;
  --table-hover-bg: #F1F5F9;
  --table-row-danger-bg: #FFF1F2;
  --table-row-danger-color: #991B1B;
  --table-row-warning-bg: #FFFBEB;
  --table-row-warning-color: #92400E;
  --table-row-success-bg: #F0FDF4;
  --table-row-success-color: #166534;

  /* --- MODAIS & FORMULÁRIOS --- */
  --modal-bg: #FFFFFF;
  --modal-header-bg: #FFFFFF;
  --modal-title-color: #0F172A;
  --modal-border: #E2E8F0;
  --modal-footer-bg: #F8FAFC;
  --input-bg: #F8FAFC;
  --input-color: #0F172A;
  --input-border: #CBD5E1;
  --input-placeholder: #94A3B8;
  --input-focus-border: #3B82F6;
  --input-focus-ring: rgba(59, 130, 246, 0.2);

  /* --- KPIS & DASHBOARD --- */
  --kpi-card-bg: #FFFFFF;
  --kpi-title-color: #64748B;
  --kpi-value-color: #0F172A;
  --kpi-icon-bg: rgba(37, 99, 235, 0.1);
  --kpi-border: #E2E8F0;

  /* --- ESCALA DE BORDAS ARREDONDADAS --- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* --- ELEVAÇÃO & SOMBRAS MODERNAS (LAYERED DIFFUSE) --- */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.25);

  /* --- TRANSIÇÕES FLUIDAS --- */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==============================================================================
   TOKENS DARK MODE (SLATE / NAVY FINTECH)
   ============================================================================== */
body.dark-theme,
.dark-theme {
  /* --- PALETA PRINCIPAL DARK --- */
  --brand-primary: #3B82F6;
  --brand-primary-hover: #60A5FA;
  --brand-primary-active: #2563EB;
  --brand-primary-light: rgba(59, 130, 246, 0.15);

  /* --- SUPERFÍCIES DARK (LAYERED SURFACES) --- */
  --surface-app: #0B0F19;           /* Nível 0: Fundo geral */
  --surface-card: #131B2E;          /* Nível 1: Cards e seções */
  --surface-card-hover: #18223B;    /* Nível 1 hover */
  --surface-muted: #0E1524;         /* Nível 0.5: Fundos embutidos */
  --surface-sidebar: #131B2E;       /* Sidebar escuro em tom #131B2E */
  --surface-sidebar-hover: #18223B;
  --surface-sidebar-active: #3B82F6;
  --surface-header: #131B2E;        /* Header superior em tom #131B2E */
  --surface-modal: #131B2E;         /* Modais */
  --surface-input: #0A0F1D;         /* Inputs e Selects */
  --surface-elevated: #18223B;      /* Dropdowns e popovers */

  /* --- BORDAS DARK --- */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-focus: #3B82F6;
  --border-input: rgba(255, 255, 255, 0.12);

  /* --- TIPOGRAFIA & TEXTOS DARK --- */
  --text-primary: #F8FAFC;          /* 98% Brilho */
  --text-secondary: #94A3B8;        /* Slate 400 */
  --text-muted: #64748B;            /* Slate 500 */
  --text-white: #FFFFFF;
  --text-link: #60A5FA;
  --label-color: #CBD5E1;           /* Slate 300 (Alto contraste para labels) */

  /* --- CORES SEMÂNTICAS & BADGES DARK --- */
  --color-success: #10B981;
  --color-success-bg: rgba(16, 185, 129, 0.18);
  --color-success-text: #6EE7B7;
  --color-success-border: rgba(16, 185, 129, 0.35);

  --color-warning: #F59E0B;
  --color-warning-bg: rgba(245, 158, 11, 0.2);
  --color-warning-text: #FCD34D;
  --color-warning-border: rgba(245, 158, 11, 0.35);

  --color-danger: #EF4444;
  --color-danger-bg: rgba(239, 68, 68, 0.18);
  --color-danger-text: #FCA5A5;
  --color-danger-border: rgba(239, 68, 68, 0.35);

  --color-info: #06B6D4;
  --color-info-bg: rgba(6, 182, 212, 0.18);
  --color-info-text: #67E8F9;
  --color-info-border: rgba(6, 182, 212, 0.35);

  /* --- TABELAS DARK --- */
  --table-bg: #131B2E;
  --table-th-bg: #0B0F19;
  --table-th-color: #94A3B8;
  --table-td-color: #E2E8F0;
  --table-border: rgba(255, 255, 255, 0.06);
  --table-hover-bg: rgba(255, 255, 255, 0.03);
  --table-row-danger-bg: rgba(239, 68, 68, 0.15);
  --table-row-danger-color: #FCA5A5;
  --table-row-warning-bg: rgba(245, 158, 11, 0.15);
  --table-row-warning-color: #FCD34D;
  --table-row-success-bg: rgba(16, 185, 129, 0.12);
  --table-row-success-color: #6EE7B7;

  /* --- MODAIS & FORMULÁRIOS DARK --- */
  --modal-bg: #131B2E;
  --modal-header-bg: #131B2E;
  --modal-title-color: #F8FAFC;
  --modal-border: rgba(255, 255, 255, 0.08);
  --modal-footer-bg: #0E1524;
  --input-bg: #0A0F1D;
  --input-color: #F8FAFC;
  --input-border: rgba(255, 255, 255, 0.12);
  --input-placeholder: #64748B;
  --input-focus-border: #3B82F6;
  --input-focus-ring: rgba(59, 130, 246, 0.3);

  /* --- KPIS & DASHBOARD DARK --- */
  --kpi-card-bg: #131B2E;
  --kpi-title-color: #94A3B8;
  --kpi-value-color: #F8FAFC;
  --kpi-icon-bg: rgba(59, 130, 246, 0.15);
  --kpi-border: rgba(255, 255, 255, 0.08);

  /* --- SOMBRAS DARK --- */
  --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);
  --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.3);
}

/* ==============================================================================
   COMPONENTES GLOBAIS DE AUTENTICAÇÃO (LOGIN / REGISTRO / CHECKOUT)
   ============================================================================== */

.auth-body {
  font-family: var(--font-sans);
  background-color: var(--surface-app);
  margin: 0;
  padding: 0;
  color: var(--text-primary);
  min-height: 100vh;
}

.auth-container {
  display: flex;
  min-height: 100vh;
  background-color: #FFFFFF;
}

/* Lado Esquerdo: Branding & Apresentação Institucional */
.auth-brand-side {
  flex: 1.1;
  background: var(--brand-gradient-dark);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 60px 80px;
  position: relative;
  overflow: hidden;
}

.auth-brand-side::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
  top: -120px;
  right: -120px;
  border-radius: 50%;
  pointer-events: none;
}

.auth-brand-side::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
  bottom: -100px;
  left: -100px;
  border-radius: 50%;
  pointer-events: none;
}

.brand-top {
  position: relative;
  z-index: 2;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: #93C5FD;
}

.brand-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 24px;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.brand-description {
  font-size: 1.05rem;
  color: #94A3B8;
  line-height: 1.6;
  max-width: 520px;
  margin-bottom: 32px;
}

.feature-highlights {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 2;
  margin-top: 20px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
}

.feature-icon {
  width: 44px;
  height: 44px;
  background: rgba(37, 99, 235, 0.3);
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #60A5FA;
  flex-shrink: 0;
}

.feature-item strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #FFFFFF;
}

.feature-item span {
  font-size: 12.5px;
  color: #94A3B8;
}

.brand-footer-text {
  font-size: 13px;
  color: #64748B;
  position: relative;
  z-index: 2;
}

/* Lado Direito: Formulário Clean */
.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background-color: var(--surface-app);
}

.form-wrapper {
  width: 100%;
  max-width: 440px;
  background: #FFFFFF;
  padding: 40px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-subtle);
  animation: fadeIn 0.4s ease-out;
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  max-height: 52px;
  width: auto;
  margin-bottom: 20px;
  display: inline-block;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.form-label-modern {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  display: block;
}

.input-icon-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon-group .input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
  transition: var(--transition-fast);
}

.input-icon-group:focus-within .input-icon {
  color: var(--brand-primary);
}

.form-control-modern {
  width: 100%;
  height: 48px;
  padding: 10px 16px 10px 42px;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: #FFFFFF;
  transition: var(--transition-fast);
}

.form-control-modern:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn-toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-toggle-password:hover {
  color: var(--text-primary);
}

.form-check-modern {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 24px;
}

.form-check-modern input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.form-check-modern label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.btn-primary-modern {
  width: 100%;
  height: 48px;
  background: var(--brand-gradient);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 600;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: var(--transition-normal);
  text-decoration: none;
}

.btn-primary-modern:hover {
  background: linear-gradient(135deg, #1D4ED8 0%, #4338CA 100%);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
  color: #FFFFFF;
}

.btn-primary-modern:active {
  transform: translateY(0);
}

.auth-link {
  color: var(--brand-primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-fast);
}

.auth-link:hover {
  text-decoration: underline;
  color: var(--brand-primary-hover);
}

.auth-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Alertas Modernos */
.alert-modern {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-modern-danger {
  background-color: var(--color-danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger-text);
}

.alert-modern-success {
  background-color: var(--color-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--color-success-text);
}

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

/* Responsividade Mobile */
@media (max-width: 991.98px) {
  .auth-brand-side {
    display: none !important;
  }
  .auth-form-side {
    padding: 24px 16px;
  }
  .form-wrapper {
    padding: 30px 20px;
    box-shadow: none;
    border: none;
    background: transparent;
  }
}
