/* =============================================
   TAXA DE SERVIÇO - Estilos Principais
   ============================================= */

:root {
  --primary: #EA232F;
  --primary-dark: #C41C27;
  --primary-light: #F5525B;
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: linear-gradient(180deg, #1A1A1A 0%, #2D2D2D 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 10px;
}

.sidebar-logo h2 {
  color: white;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.sidebar-logo span {
  color: rgba(255,255,255,0.5);
  font-size: 11px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: 6px 16px;
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 13.5px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: white;
  border-left-color: rgba(234,35,47,0.5);
}

.sidebar-item.active {
  background: rgba(234,35,47,0.12);
  color: white;
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Layout */
.main-content {
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-content {
  padding: 28px;
  flex: 1;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.stat-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: rgba(234,35,47,0.06); }

.btn-secondary {
  background: #F3F4F6;
  color: var(--text);
}
.btn-secondary:hover { background: #E5E7EB; }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #059669; }

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

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

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge-red { background: rgba(234,35,47,0.1); color: var(--primary); }
.badge-green { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-yellow { background: rgba(245,158,11,0.1); color: #92400E; }
.badge-blue { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-gray { background: rgba(107,114,128,0.1); color: var(--text-secondary); }
.badge-orange { background: rgba(249,115,22,0.1); color: #C2410C; }

/* Tabelas */
.table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #F9FAFB;
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th.th-primary {
  background: var(--primary);
  color: white;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F9FAFB; }

tbody td {
  padding: 10px 14px;
  color: var(--text);
  vertical-align: middle;
}

/* Forms */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
  outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(234,35,47,0.08); }
.form-control:disabled { background: #F3F4F6; cursor: not-allowed; }

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: rgba(234,35,47,0.03);
}

.upload-area i {
  font-size: 36px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: block;
}

/* Wizard Steps */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
  min-width: 70px;
}

.wizard-step::after {
  content: '';
  position: absolute;
  top: 17px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.wizard-step:last-child::after { display: none; }

.wizard-step.completed::after { background: var(--primary); }

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: white;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
  transition: all 0.2s;
}

.wizard-step.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.wizard-step.completed .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.step-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}

.wizard-step.active .step-label { color: var(--primary); }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.alert-error { background: rgba(239,68,68,0.08); border-left: 3px solid var(--danger); color: #991B1B; }
.alert-success { background: rgba(16,185,129,0.08); border-left: 3px solid var(--success); color: #065F46; }
.alert-warning { background: rgba(245,158,11,0.08); border-left: 3px solid var(--warning); color: #92400E; }
.alert-info { background: rgba(59,130,246,0.08); border-left: 3px solid var(--info); color: #1E40AF; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: white;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* Loading */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: white;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: slideIn 0.25s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

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

/* Utility */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s;
}

/* Tabela de cálculo */
.calc-table tbody td.value { font-variant-numeric: tabular-nums; }
.calc-table tfoot td {
  background: #F9FAFB;
  font-weight: 700;
  border-top: 2px solid var(--border);
}

/* Status badges */
.status-rascunho { background: rgba(107,114,128,0.1); color: #374151; }
.status-calculada { background: rgba(59,130,246,0.1); color: #1E40AF; }
.status-fechada { background: rgba(16,185,129,0.1); color: #065F46; }
.status-reaberta { background: rgba(245,158,11,0.1); color: #92400E; }
.status-inconsistencias { background: rgba(239,68,68,0.1); color: #991B1B; }
.status-dados_importados { background: rgba(168,85,247,0.1); color: #6D28D9; }

/* Responsivo */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
}

/* Print */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
}
