/* insumos.css - Estilos do Módulo de Acompanhamento de Insumos */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 2rem;
}

.insumos-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Cabeçalho */
.insumos-header {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content h1 {
  font-size: 2rem;
  color: #1a202c;
  margin-bottom: 0.5rem;
}

.header-subtitle {
  color: #718096;
  font-size: 1rem;
}

.header-info {
  text-align: right;
}

.info-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  color: #4a5568;
  font-size: 0.9rem;
  font-weight: 500;
}

.info-badge.success {
  background: #c6f6d5;
  border-color: #48bb78;
  color: #22543d;
}

/* Seção de Importação */
.import-section {
  margin-bottom: 2rem;
}

.import-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.import-header {
  margin-bottom: 2rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 1rem;
}

.import-header h2 {
  font-size: 1.5rem;
  color: #1a202c;
  margin-bottom: 0.5rem;
}

.import-header p {
  color: #718096;
  font-size: 0.95rem;
}

/* Caixas de Importação */
.import-box {
  background: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.import-box:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.import-box.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.import-box-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.import-icon {
  font-size: 2rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.import-box-title h3 {
  font-size: 1.25rem;
  color: #2d3748;
  margin-bottom: 0.25rem;
}

.import-box-title p {
  font-size: 0.9rem;
  color: #718096;
}

.import-box-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Input de Arquivo */
.file-input {
  display: none;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: white;
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  color: #4a5568;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-label:hover {
  border-color: #667eea;
  color: #667eea;
  background: #f7fafc;
}

.file-label svg {
  flex-shrink: 0;
}

.file-info {
  font-size: 0.9rem;
  color: #718096;
  padding: 0.5rem;
  background: white;
  border-radius: 6px;
  min-height: 2rem;
  display: flex;
  align-items: center;
}

.file-info.active {
  color: #22543d;
  background: #c6f6d5;
  border: 1px solid #48bb78;
}

/* Botões */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

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

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: white;
  color: #4a5568;
  border: 2px solid #e2e8f0;
}

.btn-secondary:hover:not(:disabled) {
  background: #f7fafc;
  border-color: #cbd5e0;
}

.btn-danger {
  background: #fc8181;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #f56565;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 101, 101, 0.4);
}

/* Barra de Progresso */
.import-progress {
  margin-top: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
}

.progress-bar {
  width: 100%;
  height: 24px;
  background: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
}

.progress-text {
  text-align: center;
  color: #4a5568;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Status da Importação */
.import-status {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f7fafc;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-icon {
  font-size: 2rem;
}

.status-message {
  font-size: 1rem;
  color: #2d3748;
  font-weight: 500;
}

.import-status.success {
  background: #c6f6d5;
}

.import-status.error {
  background: #fed7d7;
}

/* Seção de Dados */
.data-section {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.data-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
}

.data-header h2 {
  font-size: 1.5rem;
  color: #1a202c;
}

.data-actions {
  display: flex;
  gap: 1rem;
}

/* Filtros */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #f7fafc;
  border-radius: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a5568;
}

.filter-select,
.search-input {
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  background: white;
  transition: all 0.3s ease;
}

.filter-select:focus,
.search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-group {
  grid-column: span 2;
}

/* Tabela */
.table-container {
  overflow-x: auto;
  margin-bottom: 2rem;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
}

.insumos-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.insumos-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.insumos-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.insumos-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.insumos-table th.sortable:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sort-icon {
  margin-left: 0.5rem;
  opacity: 0.5;
  font-size: 0.8rem;
}

.insumos-table th.sorted .sort-icon {
  opacity: 1;
}

.insumos-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
  transition: background 0.2s ease;
}

.insumos-table tbody tr:hover {
  background: #f7fafc;
}

.insumos-table td {
  padding: 1rem;
  font-size: 0.9rem;
  color: #2d3748;
}

.tipo-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.tipo-badge.pai {
  background: #bee3f8;
  color: #2c5282;
}

.tipo-badge.subitem {
  background: #feebc8;
  color: #7c2d12;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-badge.ativo {
  background: #c6f6d5;
  color: #22543d;
}

.status-badge.inativo {
  background: #fed7d7;
  color: #742a2a;
}

/* Paginação */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 12px;
}

.btn-page {
  padding: 0.75rem 1.5rem;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  color: #4a5568;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-page:hover:not(:disabled) {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

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

#pageInfo {
  font-weight: 600;
  color: #2d3748;
}

/* Estatísticas */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  border-radius: 12px;
  border: 2px solid #e2e8f0;
}

.stat-icon {
  font-size: 2.5rem;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: #718096;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #2d3748;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.modal-header h3 {
  font-size: 1.25rem;
  color: #1a202c;
}

.modal-body {
  padding: 1.5rem;
}

.modal-body p {
  color: #4a5568;
  line-height: 1.6;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 2px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Responsividade */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  .insumos-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

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

  .data-header {
    flex-direction: column;
    gap: 1rem;
  }

  .data-actions {
    flex-direction: column;
    width: 100%;
  }

  .data-actions .btn {
    width: 100%;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .search-group {
    grid-column: span 1;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}

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

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

.import-box,
.stat-card {
  animation: fadeIn 0.4s ease;
}
