/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

.btn-info {
  background: linear-gradient(135deg, #17ead9 0%, #6078ea 100%);
  color: white; /* Added color for btn-info as it's missing in the provided snippet */
}

.btn-info:hover {
  background: linear-gradient(135deg, #6078ea 0%, #17ead9 100%);
}

/* Botões de documentos PDF */
.btn-pdf {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-pdf:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-oficio {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.btn-oficio:hover {
  background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

/* Loading spinner para geração de PDF */
.pdf-loading {
  opacity: 0.6;
  cursor: wait;
  position: relative;
}

.pdf-loading::after {
  content: '⏳';
  position: absolute;
  right: 10px;
  animation: spin 1s linear infinite;
}

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

/* ============================================
   SISTEMA DE ALERTAS
   ============================================ */

/* Header content flex */
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

/* Botão de notificações no header */
.btn-notification {
  position: relative;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-notification:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.8);
}

/* Badge de contagem */
.badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4444;
  color: white;
  border-radius: 50%;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: bold;
  min-width: 24px;
  text-align: center;
  animation: pulse 2s infinite;
  box-shadow: 0 2px 10px rgba(255, 68, 68, 0.5);
}

.badge.hidden {
  display: none;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.9; }
}

/* Alerta visual urgente */
.urgent-alert {
  position: fixed;
  top: 90px;
  right: 20px;
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
  color: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 15px 40px rgba(255, 0, 0, 0.4);
  z-index: 9999;
  max-width: 380px;
  animation: slideIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideIn {
  from {
    transform: translateX(450px) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.urgent-alert h3 {
  margin: 0 0 12px 0;
  font-size: 20px;
  font-weight: bold;
}

.urgent-alert p {
  margin: 8px 0;
  font-size: 15px;
  line-height: 1.5;
}

.urgent-alert ul {
  margin: 12px 0;
  padding-left: 20px;
}

.urgent-alert li {
  margin: 5px 0;
  font-size: 14px;
}

.urgent-alert button {
  margin-top: 15px;
  background: white;
  color: #cc0000;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.2s;
}

.urgent-alert button:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Toggle switch para configurações */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
  vertical-align: middle;
  margin-right: 15px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 5px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #667eea;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Seções do modal de config */
.alert-config-section {
  margin: 25px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.alert-config-section h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: #333;
  display: inline-block;
}

.alert-config-section p {
  margin: 10px 0 0 0;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

.alert-config-section select {
  width: 100%;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 8px;
  background: white;
  cursor: pointer;
}

.alert-config-section select:focus {
  outline: none;
  border-color: #667eea;
}

/* Indicador de alerta nos cards de stats */
.stat-card.critical {
  border: 3px solid #ff4444;
  animation: borderPulse 2s infinite;
  box-shadow: 0 8px 25px rgba(255, 68, 68, 0.3);
}

@keyframes borderPulse {
  0%, 100% { 
    border-color: #ff4444;
    box-shadow: 0 8px 25px rgba(255, 68, 68, 0.3);
  }
  50% { 
    border-color: #ffaaaa;
    box-shadow: 0 8px 35px rgba(255, 68, 68, 0.5);
  }
}


/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.header p {
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Controles */
.controls {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.controls-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.controls-row:last-child {
    margin-bottom: 0;
}

.search-box, .filter-select {
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-box:focus, .filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.filter-select {
    min-width: 150px;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Tabela */
.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

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

.table th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Status de pedido */
.status-sim {
    background: #dc3545;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-nao {
    background: #28a745;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Alertas de estoque */
.estoque-baixo {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

.estoque-zero {
    background-color: #f8d7da !important;
    border-left: 4px solid #dc3545;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 1.5rem;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.modal-header h2 {
    color: #495057;
    font-weight: 500;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s;
}

.close:hover {
    color: #000;
}

/* Formulário */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box, .filter-select {
        min-width: auto;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .table {
        min-width: 800px;
    }
    
    .modal-content {
        margin: 1% auto;
        width: 95%;
        max-height: 95vh;
        padding: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

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

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

/* Garantir que os botões do modal sempre sejam visíveis */
.modal-content .form-actions {
    position: sticky;
    bottom: 0;
    background: white;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    margin-bottom: -1.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
}

@media (max-width: 768px) {
    .modal-content .form-actions {
        margin-left: -1rem;
        margin-right: -1rem;
        margin-bottom: -1rem;
        padding: 1rem;
    }
}

/* Utilitários */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }


/* ============================================
   DASHBOARD DE GRÁFICOS
   ============================================ */

.dashboard-section {
  background: white;
  border-radius: 15px;
  padding: 30px;
  margin: 25px 0;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.dashboard-title {
  font-size: 24px;
  color: #333;
  margin: 0 0 25px 0;
  font-weight: 600;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px,  1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.chart-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chart-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.chart-card h3 {
  font-size: 16px;
  color: #555;
  margin: 0 0 15px 0;
  font-weight: 600;
  text-align: center;
}

.chart-card canvas {
  max-height: 250px;
}

.widget-card {
  background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
}

#topCriticalWidget {
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
  width: 100%;
}

#topCriticalWidget .critical-item {
  display: flex;
  align-items: center;
  gap: 16px; /* Espaço entre número e conteúdo */
  padding: 14px 16px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
  border-left: 4px solid #ff6b6b;
  border-radius: 8px;
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

#topCriticalWidget .critical-item:hover {
  transform: translateX(5px);
  box-shadow: 0 3px 12px rgba(255, 107, 107, 0.25);
  background: linear-gradient(135deg, #ffe5e5 0%, #ffd5d5 100%);
}

#topCriticalWidget .critical-rank {
  font-size: 24px;
  font-weight: 700;
  color: #ff6b6b;
  min-width: 40px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

#topCriticalWidget .critical-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#topCriticalWidget .critical-name {
  font-weight: 600;
  color: #2d3748;
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#topCriticalWidget .critical-qty {
  font-size: 12px;
  color: #e53e3e;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.insights-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 20px;
  justify-content: center;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.insight-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  transition: transform 0.3s ease;
}

.insight-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.insight-icon {
  font-size: 32px;
}

.insight-text {
  display: flex;
  flex-direction: column;
}

.insight-text strong {
  font-size: 24px;
  font-weight: bold;
  line-height: 1.2;
}

.insight-text small {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}

@media (max-width: 768px) {
  .dashboard-section {
    padding: 20px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .insights-bar {
    grid-template-columns: 1fr;
  }
  .chart-card canvas {
    max-height: 200px;
  }
}

/* ============================================
   TEMA OFICIAL - PREFEITURA MUNICIPAL DE GUARACI-SP
   ============================================ */

:root {
  --guaraci-blue: #002B7F;
  --guaraci-blue-dark: #001F5C;
  --guaraci-green: #00875A;
  --guaraci-green-dark: #006644;
  --guaraci-yellow: #FFC72C;
  --guaraci-red: #D90429;
}

body {
  background-color: #f4f6f9;
}

/* Header Municipal */
.header {
  background: linear-gradient(135deg, var(--guaraci-blue) 0%, var(--guaraci-blue-dark) 100%) !important;
  border-bottom: 4px solid var(--guaraci-green);
  padding: 1.5rem 2rem !important;
}

.guaraci-header-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.guaraci-logo-header {
  height: 75px;
  width: auto;
  background: white;
  padding: 6px 14px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.guaraci-header-text h1 {
  color: white;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  white-space: nowrap;
}

.guaraci-header-text p {
  color: #e2e8f0;
  font-size: 1.05rem;
  margin-top: 4px;
}

/* Navigation Bar Municipal */
.nav-bar {
  background: var(--guaraci-blue) !important;
  border-bottom: 3px solid var(--guaraci-green);
}

.nav-item:hover, .nav-item.active {
  background: var(--guaraci-green) !important;
  color: white !important;
}

/* Botões */
.btn-primary {
  background: linear-gradient(135deg, var(--guaraci-blue) 0%, var(--guaraci-blue-dark) 100%) !important;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--guaraci-blue-dark) 0%, var(--guaraci-blue) 100%) !important;
}

.btn-success {
  background: linear-gradient(135deg, var(--guaraci-green) 0%, var(--guaraci-green-dark) 100%) !important;
}

.btn-success:hover {
  background: linear-gradient(135deg, var(--guaraci-green-dark) 0%, var(--guaraci-green) 100%) !important;
}

.insight-item {
  background: linear-gradient(135deg, var(--guaraci-blue) 0%, var(--guaraci-green) 100%) !important;
}

