/* ========================================
   MODERN LIGHT THEME - CONSULTA SIMPLES NACIONAL
   Inspired by Wix & Hostinger design patterns
   ======================================== */

/* Root Variables */
:root {
  /* Primary Colors */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  --primary-subtle: #f5f3ff;
  
  /* Secondary/Accent */
  --secondary: #8b5cf6;
  --accent: #06b6d4;
  --accent-light: #cffafe;
  
  /* Success/Error States */
  --success: #10b981;
  --success-light: #d1fae5;
  --success-dark: #059669;
  --error: #ef4444;
  --error-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  
  /* Neutrals */
  --white: #ffffff;
  --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;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --gradient-hero: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #e0e7ff 100%);
  --gradient-card: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  
  /* Shadows */
  --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 -1px rgba(0, 0, 0, 0.1);
  --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);
  --shadow-primary: 0 10px 40px -10px rgba(99, 102, 241, 0.4);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition: all 0.2s ease;
  --transition-slow: all 0.3s ease;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Main Layout */
.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========================================
   TOP NAVIGATION MENU
   ======================================== */

/* Navigation Bar */
.nav-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

/* Nav Brand (Logo/Title) */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.nav-brand i {
  font-size: 1.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-brand:hover {
  opacity: 0.8;
}

/* Nav Menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Nav Item */
.nav-item {
  position: relative;
}

/* Nav Link */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.nav-link i {
  font-size: 0.875rem;
  color: var(--gray-500);
  transition: var(--transition);
}

.nav-link:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}

.nav-link:hover i {
  color: var(--primary);
}

/* Active Nav Link */
.nav-link.active {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-light) 100%);
  color: var(--primary);
  font-weight: 600;
  position: relative;
}

.nav-link.active i {
  color: var(--primary);
}

/* Active indicator (bottom border) */
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

/* Mobile Menu Toggle Button */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-600);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

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

/* Responsive Navigation */
@media (max-width: 768px) {
  .nav-container {
    height: auto;
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }
  
  .nav-brand {
    font-size: 1rem;
  }
  
  .nav-brand i {
    font-size: 1.25rem;
  }
  
  .nav-toggle {
    display: block;
  }
  
  .nav-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0.25rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
  }
  
  .nav-menu.active {
    display: flex;
  }
  
  .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
  }
  
  .nav-link.active::after {
    display: none;
  }
}

/* Hero Section */
.hero-section {
  background: var(--gradient-hero);
  padding: 3rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--white);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.hero-badge i {
  font-size: 0.75rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero-title span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--gray-600);
  max-width: 600px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .hero-section {
    padding: 4rem 2rem 5rem;
  }
  
  .hero-title {
    font-size: 3.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.25rem;
  }
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem 1.5rem 4rem;
}

@media (min-width: 768px) {
  .main-content {
    padding: 3rem 2rem 5rem;
  }
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--gray-100);
  transition: var(--transition-slow);
}

.card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

.card-elevated {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-100);
}

/* Section Titles */
.section-header {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title i {
  color: var(--primary);
  font-size: 1.125rem;
}

.section-description {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

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

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--gray-800);
  transition: var(--transition);
  font-family: inherit;
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-input:hover {
  border-color: var(--gray-300);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--gray-800);
  transition: var(--transition);
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
}

.form-textarea:hover {
  border-color: var(--gray-300);
}

.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-helper {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray-500);
}

.form-helper i {
  color: var(--primary);
  font-size: 0.75rem;
}

/* Input Group */
.input-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.input-group .form-input {
  flex: 1;
  min-width: 200px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--white);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 44px -10px rgba(99, 102, 241, 0.5);
}

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

.btn-secondary {
  background: var(--white);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary-subtle);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  color: var(--white);
  box-shadow: 0 10px 40px -10px rgba(16, 185, 129, 0.4);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 44px -10px rgba(16, 185, 129, 0.5);
}

.btn-danger {
  background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
  color: var(--white);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-800);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius);
}

/* Button Group */
.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .btn-group {
    flex-direction: column;
  }
  
  .btn-group .btn {
    width: 100%;
  }
}

/* Examples Panel */
.examples-panel {
  background: linear-gradient(135deg, var(--primary-subtle) 0%, var(--accent-light) 100%);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.examples-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
}

.example-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.example-btn:hover {
  border-color: var(--primary);
  background: var(--primary-subtle);
  transform: translateX(4px);
}

.example-btn i {
  color: var(--primary);
  width: 18px;
}

.example-btn .tag {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-left: auto;
}

/* Result Cards */
.results-section {
  margin-top: 2rem;
}

.result-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--gray-100);
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.result-card-success::before {
  background: var(--success);
}

.result-card-error::before {
  background: var(--error);
}

.result-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.result-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
}

.result-title i {
  color: var(--primary);
}

.company-name {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
  padding-left: 1.75rem;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-optante {
  background: var(--success-light);
  color: var(--success-dark);
}

.badge-mei {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-nao-optante {
  background: var(--gray-100);
  color: var(--gray-600);
}

.badge-error {
  background: var(--error-light);
  color: var(--error);
}

/* Badge Group - para múltiplos badges lado a lado */
.badge-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Badges específicos para Simples Nacional */
.badge-simples-optante {
  background: var(--success-light);
  color: var(--success-dark);
}

.badge-simples-nao-optante {
  background: #fef2f2;
  color: #dc2626;
}

/* Badges específicos para MEI */
.badge-mei-enquadrado {
  background: var(--success-light);
  color: var(--success-dark);
}

.badge-mei-nao-enquadrado {
  background: #fef2f2;
  color: #dc2626;
}

/* Info Boxes */
.info-grid {
  display: grid;
  gap: 0.75rem;
}

.info-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 1rem;
  transition: var(--transition);
}

.info-box:hover {
  background: var(--primary-subtle);
  border-color: var(--primary-light);
}

.info-box-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.info-box-title i {
  color: var(--primary);
  font-size: 0.7rem;
}

.info-box-content {
  font-size: 0.9375rem;
  color: var(--gray-800);
  font-weight: 500;
}

.info-box-highlight {
  background: linear-gradient(135deg, var(--primary-subtle) 0%, var(--accent-light) 100%);
  border-color: var(--primary-light);
}

/* Result Footer */
.result-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timestamp {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--gray-400);
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: var(--radius-full);
}

/* Statistics Panel */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* Grid com 5 colunas para página Empresas */
.stats-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* Grid com 6 colunas para todos os filtros */
.stats-grid-6 {
  grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1024px) {
  .stats-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .stats-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats-grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stats-grid,
  .stats-grid-6 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1rem 0.75rem;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
}

/* Cores das barras superiores dos 5 cards (Consulta Empresas) */
.stats-grid-5 .stat-card:nth-child(1)::after { background: var(--gradient-primary); }
.stats-grid-5 .stat-card:nth-child(2)::after { background: var(--success); }
.stats-grid-5 .stat-card:nth-child(3)::after { background: #dc2626; }
.stats-grid-5 .stat-card:nth-child(4)::after { background: #f59e0b; }
.stats-grid-5 .stat-card:nth-child(5)::after { background: var(--gray-500); }

/* Cores das barras superiores dos 6 cards */
.stats-grid-6 .stat-card:nth-child(1)::after { background: var(--gradient-primary); }
.stats-grid-6 .stat-card:nth-child(2)::after { background: var(--success); }
.stats-grid-6 .stat-card:nth-child(3)::after { background: #f97316; }
.stats-grid-6 .stat-card:nth-child(4)::after { background: var(--primary); }
.stats-grid-6 .stat-card:nth-child(5)::after { background: #ef4444; }
.stats-grid-6 .stat-card:nth-child(6)::after { background: var(--gray-500); }

/* Stat Card Clickable (Filtros) */
.stat-card-clickable {
  cursor: pointer;
  transition: var(--transition);
}

.stat-card-clickable:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.stat-card-clickable:active {
  transform: translateY(-1px);
}

/* Stat Card Active (Filtro selecionado) */
.stat-card-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-lg);
}

.stat-card-active::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
  .stat-number {
    font-size: 1.5rem;
  }
}

.stat-number.total { color: var(--gray-800); }
.stat-number.optantes { color: var(--success); }
.stat-number.nao-optantes-simples { color: #f97316; }
.stat-number.mei-enquadrado { color: var(--primary); }
.stat-number.mei-desenquadrado { color: #ef4444; }
.stat-number.nao-optantes { color: var(--primary); }
.stat-number.erros { color: var(--error); }

/* Cores para cards da página Consulta Empresas */
.stat-number.empresas-ativas { color: var(--success); }
.stat-number.empresas-baixadas { color: #dc2626; }
.stat-number.demais-situacoes { color: #f59e0b; }

.stat-label {
  font-size: 0.7rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  line-height: 1.3;
}

@media (max-width: 768px) {
  .stat-label {
    font-size: 0.65rem;
  }
}

/* Loading State */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
}

.loader {
  width: 56px;
  height: 56px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 1.5rem;
  font-size: 1rem;
  color: var(--gray-600);
  font-weight: 500;
}

.loading-subtext {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-400);
}

/* ========================================
   ADVANCED LOADING - Batch Processing
   ======================================== */

/* Advanced Loading Container */
.advanced-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}

/* Circular Progress Loader */
.circular-loader {
  position: relative;
  width: 120px;
  height: 120px;
}

.circular-loader svg {
  transform: rotate(-90deg);
  width: 120px;
  height: 120px;
}

.circular-loader .loader-track {
  fill: none;
  stroke: var(--gray-200);
  stroke-width: 8;
}

.circular-loader .loader-progress {
  fill: none;
  stroke: url(#loaderGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset 0.5s ease;
}

/* Percentage Display in Center */
.loader-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.loader-percentage-number {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.loader-percentage-symbol {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
}

/* Loading Info */
.loading-info {
  text-align: center;
  margin-top: 1.5rem;
}

.loading-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.375rem;
}

.loading-subtitle {
  font-size: 0.9rem;
  color: var(--gray-500);
}

/* Progress Bar Container */
.progress-bar-container {
  width: 100%;
  max-width: 400px;
  margin-top: 1.5rem;
}

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray-500);
}

.progress-bar-label-highlight {
  color: var(--primary);
  font-weight: 600;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
  position: relative;
  overflow: hidden;
}

/* Shimmer effect on progress bar */
.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Batch Info */
.batch-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--primary-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--primary-light);
}

.batch-info-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.batch-info-row i {
  color: var(--primary);
  font-size: 0.75rem;
}

.batch-info-highlight {
  font-weight: 600;
  color: var(--primary);
}

/* Wait Timer */
.wait-timer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--warning-light);
  border-radius: var(--radius-md);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.wait-timer i {
  color: var(--warning);
  font-size: 1.125rem;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.wait-timer-text {
  font-size: 0.85rem;
  color: var(--gray-700);
}

.wait-timer-countdown {
  font-weight: 700;
  color: var(--warning);
  font-size: 1rem;
  min-width: 30px;
  text-align: center;
}

/* Responsive Loading */
@media (max-width: 640px) {
  .advanced-loading-container {
    padding: 2rem 1rem;
  }
  
  .circular-loader {
    width: 100px;
    height: 100px;
  }
  
  .circular-loader svg {
    width: 100px;
    height: 100px;
  }
  
  .circular-loader .loader-track,
  .circular-loader .loader-progress {
    stroke-width: 6;
  }
  
  .circular-loader .loader-progress {
    stroke-dasharray: 282.743;
    stroke-dashoffset: 282.743;
  }
  
  .loader-percentage-number {
    font-size: 1.5rem;
  }
  
  .loading-title {
    font-size: 1rem;
  }
  
  .progress-bar {
    height: 10px;
  }
}

/* Alert Toast */
.alert {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease;
  box-shadow: var(--shadow-xl);
}

.alert-error {
  background: var(--error);
  color: var(--white);
}

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

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Footer */
.footer {
  background: var(--white);
  border-top: 1px solid var(--gray-100);
  padding: 2rem 1.5rem;
  text-align: center;
}

.footer-text {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.footer-text i {
  color: var(--primary);
}

.footer-subtext {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.5rem;
}

/* CNPJ Counter */
.cnpj-counter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.cnpj-counter i {
  color: var(--primary);
}

/* Actions Row */
.actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

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

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

/* Selection */
::selection {
  background: var(--primary-light);
  color: var(--primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .card-elevated {
    padding: 1.5rem;
  }
  
  .input-group {
    flex-direction: column;
  }
  
  .input-group .form-input {
    min-width: 100%;
  }
  
  .actions-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .actions-row .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Focus Visible for Accessibility */
.btn:focus-visible,
.form-input:focus-visible,
.form-textarea:focus-visible,
.example-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .hero-section,
  .examples-panel,
  .btn-group,
  .alert {
    display: none;
  }
  
  .result-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--gray-300);
  }
}

/* ========================================
   ACCORDION STYLES - Collapsible Cards
   ======================================== */

/* Accordion Controls */
.accordion-controls {
  display: flex;
  gap: 0.5rem;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-sm.btn-ghost {
  background: var(--gray-100);
  color: var(--gray-600);
}

.btn-sm.btn-ghost:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

/* Accordion Card */
.accordion-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  transition: var(--transition-slow);
}

.accordion-card:hover {
  box-shadow: var(--shadow-md);
}

/* Accordion Header (clickable) */
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  gap: 1rem;
  position: relative;
}

.accordion-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.accordion-optante .accordion-header::before {
  background: var(--success);
}

.accordion-mei .accordion-header::before {
  background: var(--primary);
}

.accordion-nao-optante .accordion-header::before {
  background: var(--gray-400);
}

.accordion-error .accordion-header::before {
  background: var(--error);
}

.accordion-header:hover {
  background: var(--gray-50);
}

.accordion-header-left {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex: 1;
  min-width: 0;
}

.accordion-icon {
  color: var(--primary);
  font-size: 1.125rem;
  flex-shrink: 0;
}

.accordion-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.accordion-cnpj {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
}

.accordion-company {
  font-size: 0.85rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.accordion-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.accordion-arrow {
  color: var(--gray-400);
  font-size: 0.875rem;
  transition: transform 0.3s ease;
}

/* Accordion Content (expandable) */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 1.25rem;
  background: var(--gray-50);
  border-top: 0 solid var(--gray-100);
}

/* Expanded State */
.accordion-card.expanded .accordion-header {
  background: var(--gray-50);
}

.accordion-card.expanded .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-card.expanded .accordion-content {
  max-height: 1000px;
  padding: 1.25rem;
  border-top-width: 1px;
}

/* Accordion Content Styles */
.accordion-content .info-grid {
  display: grid;
  gap: 0.625rem;
}

.accordion-content .info-box {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.875rem;
}

.accordion-content .info-box:hover {
  background: var(--white);
  border-color: var(--primary-light);
}

.accordion-content .result-footer {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
}

/* Color coding for accordion card border on hover */
.accordion-optante:hover {
  border-color: var(--success-light);
}

.accordion-mei:hover {
  border-color: var(--primary-light);
}

.accordion-nao-optante:hover {
  border-color: var(--gray-200);
}

.accordion-error:hover {
  border-color: var(--error-light);
}

/* Responsive Accordion */
@media (max-width: 640px) {
  .accordion-header {
    padding: 0.875rem 1rem;
    flex-wrap: wrap;
  }
  
  .accordion-header-left {
    flex: 1 1 100%;
    margin-bottom: 0.5rem;
  }
  
  .accordion-header-right {
    flex: 1 1 100%;
    justify-content: space-between;
  }
  
  .accordion-company {
    max-width: 200px;
  }
  
  .accordion-cnpj {
    font-size: 0.9375rem;
  }
  
  .accordion-controls {
    flex-direction: column;
    width: 100%;
  }
  
  .accordion-controls .btn-sm {
    width: 100%;
    justify-content: center;
  }
  
  .accordion-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .accordion-card.expanded .accordion-content {
    padding: 1rem;
  }
}

/* ========================================
   DETAILED INFO SECTIONS - BrasilAPI Data
   ======================================== */

/* Info Section Container */
.info-section {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
}

.info-section:last-child {
  margin-bottom: 0;
}

/* Info Section Highlight (Identificação do Contribuinte) */
.info-section-highlight {
  background: linear-gradient(135deg, var(--primary-subtle) 0%, #f0f9ff 100%);
  border: 2px solid var(--primary-light);
}

.info-section-highlight .info-section-title {
  background: linear-gradient(135deg, var(--primary-light) 0%, #dbeafe 100%);
  border-bottom: 2px solid var(--primary);
  color: var(--primary);
}

.info-section-highlight .info-section-title i {
  color: var(--primary);
}

.info-section-highlight .info-box {
  background: var(--white);
  border: 1px solid var(--primary-light);
}

.info-section-highlight .info-box:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

/* CNPJ Raw (sem formatação) */
.cnpj-raw {
  color: var(--gray-500);
  font-size: 0.85em;
  font-weight: 400;
  margin-left: 0.25rem;
}

/* Info Section Title */
.info-section-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.info-section-title i {
  color: var(--primary);
  font-size: 0.9rem;
}

/* Info Section Content */
.info-section-content {
  padding: 1rem;
}

/* 2-Column Grid for Info */
.info-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .info-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Info Box Variants */
.info-box-success {
  background: var(--success-light);
  border-color: var(--success);
}

.info-box-success .info-box-content {
  color: var(--success-dark);
  font-weight: 600;
}

.info-box-warning {
  background: var(--warning-light);
  border-color: var(--warning);
}

.info-box-warning .info-box-content {
  color: #b45309;
  font-weight: 600;
}

/* Info Box Error (NÃO Optante / NÃO Enquadrado) */
.info-box-error {
  background: var(--error-light);
  border-color: var(--error);
}

.info-box-error .info-box-content {
  color: var(--error);
  font-weight: 600;
}

/* CNAE Code Style */
.cnae-code {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  font-family: 'Monaco', 'Consolas', monospace;
  margin-right: 0.5rem;
}

/* Activities List */
.activities-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.activities-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--gray-700);
  transition: var(--transition);
}

.activities-list li:hover {
  background: var(--primary-subtle);
  border-color: var(--primary-light);
}

.activities-list li .cnae-code {
  flex-shrink: 0;
}

/* QSA Grid (Quadro Societário) */
.qsa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.875rem;
}

/* QSA Card (Partner/Socio Card) */
.qsa-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition-slow);
}

.qsa-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

/* QSA Header */
.qsa-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, var(--primary-subtle) 0%, var(--accent-light) 100%);
  border-bottom: 1px solid var(--primary-light);
}

.qsa-header i {
  color: var(--primary);
  font-size: 1.125rem;
}

/* QSA Name */
.qsa-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-900);
  word-break: break-word;
}

/* QSA Details */
.qsa-details {
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* QSA Item (individual info line) */
.qsa-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--gray-600);
}

.qsa-item i {
  color: var(--gray-400);
  font-size: 0.75rem;
  width: 16px;
  flex-shrink: 0;
}

.qsa-item strong {
  color: var(--gray-800);
  font-weight: 500;
}

/* QSA Representative Badge */
.qsa-rep {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: var(--success-light);
  color: var(--success-dark);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-top: 0.375rem;
}

.qsa-rep i {
  font-size: 0.625rem;
}

/* Empty/No Data State in Sections */
.info-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem;
  color: var(--gray-400);
  font-size: 0.875rem;
  font-style: italic;
}

.info-empty i {
  font-size: 1rem;
}

/* Adjust accordion content for larger expanded content */
.accordion-card.expanded .accordion-content {
  max-height: 5000px;
}

/* Responsive adjustments for detailed sections */
@media (max-width: 768px) {
  .qsa-grid {
    grid-template-columns: 1fr;
  }
  
  .info-section-title {
    font-size: 0.8125rem;
    padding: 0.75rem 0.875rem;
  }
  
  .info-section-content {
    padding: 0.875rem;
  }
}

@media (max-width: 480px) {
  .info-box {
    padding: 0.75rem;
  }
  
  .info-box-title {
    font-size: 0.6875rem;
  }
  
  .info-box-content {
    font-size: 0.8125rem;
  }
  
  .qsa-header {
    padding: 0.75rem;
  }
  
  .qsa-name {
    font-size: 0.85rem;
  }
  
  .qsa-details {
    padding: 0.75rem;
  }
  
  .qsa-item {
    font-size: 0.75rem;
  }
}
