/* Admin Panel - Estilos Compartilhados */

/* Reset e base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  padding: 20px;
}

/* Layout básico */
.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Header e navegação */
header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e0e0e0;
}

header h1 {
  font-size: 24px;
  margin-bottom: 10px;
  color: #2c3e50;
}

nav {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

nav a {
  text-decoration: none;
  color: #3498db;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

nav a:hover {
  background-color: #e3f2fd;
}

nav a.active {
  background-color: #3498db;
  color: white;
}

/* Formulários */
form {
  margin: 20px 0;
}

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #555;
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Botões */
button,
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background-color: #3498db;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: #2980b9;
}

.btn-danger {
  background-color: #e74c3c;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: #c0392b;
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #7f8c8d;
}

/* Tabelas */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

thead {
  background-color: #f8f9fa;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

th {
  font-weight: 600;
  color: #555;
}

tr:hover {
  background-color: #f8f9fa;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Mensagens de feedback */
.message {
  padding: 12px 16px;
  border-radius: 4px;
  margin: 15px 0;
  display: none;
}

.message.show {
  display: block;
}

.message-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Status indicators */
.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.status-online {
  background-color: #27ae60;
}

.status-indeterminate {
  background-color: #f39c12;
}

.status-offline {
  background-color: #e74c3c;
}

/* Cards (para dashboard) */
.card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.card h3 {
  font-size: 18px;
  margin-bottom: 15px;
  color: #2c3e50;
}

/* Grid de cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

/* Filtros */
.filters {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin: 20px 0;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 4px;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

/* Paginação */
.pagination {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.pagination button {
  padding: 8px 16px;
}

/* Footer */
footer {
  margin-top: 30px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
  text-align: center;
  color: #777;
  font-size: 12px;
}

/* Responsivo */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 15px;
  }

  nav {
    flex-direction: column;
  }

  .filters {
    flex-direction: column;
  }

  table {
    font-size: 12px;
  }

  th,
  td {
    padding: 8px;
  }
}

/* Utility classes */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }

.hidden {
  display: none !important;
}

/* Interface de parâmetros */
#params-list {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 10px;
  background-color: #f8f9fa;
  min-height: 50px;
}

#params-list:empty::before {
  content: 'Nenhum parâmetro configurado. Clique em "+ Adicionar Parâmetro" para começar.';
  color: #999;
  font-size: 13px;
}

.param-item {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.param-item:last-child {
  margin-bottom: 0;
}

.param-controls {
  display: flex;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param-field label {
  font-size: 11px;
  color: #666;
  margin: 0;
  font-weight: 500;
}

.param-field input[type="text"],
.param-field select {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: auto;
}

.param-field input[type="checkbox"] {
  width: auto;
  margin-top: 18px;
}

.param-name {
  min-width: 180px;
}

.param-type {
  min-width: 100px;
}

.param-required {
  min-width: 60px;
  text-align: center;
}

.param-remove {
  align-self: center;
  margin-top: 18px;
}

.param-remove button {
  padding: 6px 12px;
  font-size: 12px;
  background-color: #e74c3c;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.param-remove button:hover {
  background-color: #c0392b;
}

/* Status badges */
.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status.completed {
  background-color: #d4edda;
  color: #155724;
}

.status.error {
  background-color: #f8d7da;
  color: #721c24;
}

.status.pending {
  background-color: #fff3cd;
  color: #856404;
}

.status.expired {
  background-color: #d6d8db;
  color: #383d41;
}

/* Checkboxes customizados */
.query-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.query-checkbox:hover {
  background-color: #f8f9fa;
}

.query-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.query-checkbox label {
  margin: 0;
  cursor: pointer;
  font-weight: normal;
  color: #333;
}

/* Period filter buttons */
.period-filter.active {
  background-color: #3498db !important;
  color: white !important;
}
