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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 30px;
}

h1 {
  color: #2d3748;
  margin-bottom: 25px;
  font-size: 32px;
  text-align: center;
}

.stats {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  padding: 20px;
  background: #f7fafc;
  border-radius: 8px;
  flex-wrap: wrap;
}

.stat {
  padding: 10px 20px;
  background: white;
  border-radius: 6px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat.success {
  background: #c6f6d5;
  color: #22543d;
}

.stat.failure {
  background: #fed7d7;
  color: #742a2a;
}

.stat.unknown {
  background: #feebc8;
  color: #7c2d12;
}

.controls {
  margin-bottom: 20px;
  display: flex;
  gap: 15px;
  align-items: center;
}

button {
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

button:hover {
  background: #5a67d8;
}

button.config-btn {
  background: #48bb78;
}

button.config-btn:hover {
  background: #38a169;
}

button.save-btn {
  background: #48bb78;
}

button.save-btn:hover {
  background: #38a169;
}

button.cancel-btn {
  background: #718096;
}

button.cancel-btn:hover {
  background: #4a5568;
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.error {
  background: #fed7d7;
  color: #742a2a;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  border-left: 4px solid #fc8181;
}

.config-editor {
  background: #f7fafc;
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 25px;
  border: 2px solid #e2e8f0;
}

.config-editor h2 {
  color: #2d3748;
  margin-bottom: 20px;
  font-size: 24px;
}

.config-error {
  background: #fed7d7;
  color: #742a2a;
  padding: 12px 15px;
  border-radius: 6px;
  margin-bottom: 15px;
  border-left: 4px solid #fc8181;
  font-weight: 500;
}

.config-success {
  background: #c6f6d5;
  color: #22543d;
  padding: 12px 15px;
  border-radius: 6px;
  margin-bottom: 15px;
  border-left: 4px solid #48bb78;
  font-weight: 500;
}

.config-help {
  background: #bee3f8;
  color: #2c5282;
  padding: 12px 15px;
  border-radius: 6px;
  margin-bottom: 15px;
  border-left: 4px solid #4299e1;
}

.config-help p {
  margin: 0;
  font-size: 14px;
}

.config-textarea {
  width: 100%;
  min-height: 400px;
  font-family: 'Courier New', Consolas, Monaco, monospace;
  font-size: 13px;
  padding: 15px;
  border: 2px solid #cbd5e0;
  border-radius: 6px;
  resize: vertical;
  margin-bottom: 15px;
  background: white;
  color: #2d3748;
  line-height: 1.6;
}

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

.config-buttons {
  display: flex;
  gap: 10px;
}

.services-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.services-table th {
  background: #2d3748;
  color: white;
  padding: 15px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.services-table th:first-child {
  border-top-left-radius: 6px;
}

.services-table th:last-child {
  border-top-right-radius: 6px;
}

.services-table td {
  padding: 15px;
  border-bottom: 1px solid #e2e8f0;
}

.service-row:hover {
  background: #f7fafc;
}

.service-row.state-success {
  border-left: 4px solid #48bb78;
}

.service-row.state-failure {
  border-left: 4px solid #f56565;
}

.service-row.state-unknown {
  border-left: 4px solid #ed8936;
}

.status-indicator {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-indicator.status-success {
  background: #c6f6d5;
  color: #22543d;
}

.status-indicator.status-failure {
  background: #fed7d7;
  color: #742a2a;
}

.status-indicator.status-unknown {
  background: #feebc8;
  color: #7c2d12;
}

.name-cell {
  font-weight: 600;
  color: #2d3748;
}

.description-cell {
  color: #4a5568;
}

.uptime-cell {
  color: #2d3748;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.uptime-cell .no-uptime {
  color: #a0aec0;
  font-style: italic;
}

.time-cell {
  color: #718096;
  font-size: 14px;
  font-family: 'Courier New', monospace;
}

.enabled-cell .enabled {
  color: #22543d;
  font-weight: 600;
}

.enabled-cell .disabled {
  color: #742a2a;
  font-weight: 600;
}

.no-services {
  text-align: center;
  padding: 40px;
  color: #718096;
  font-size: 18px;
}

@media (max-width: 768px) {
  .container {
    padding: 20px;
  }

  .stats {
    flex-direction: column;
    gap: 10px;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .controls button {
    width: 100%;
  }

  .config-editor {
    padding: 15px;
  }

  .config-editor h2 {
    font-size: 20px;
  }

  .config-textarea {
    min-height: 300px;
    font-size: 12px;
  }

  .config-buttons {
    flex-direction: column;
  }

  .config-buttons button {
    width: 100%;
  }
}

/* Config tabs */
.config-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
}

.tab-btn {
  background: transparent;
  color: #4a5568;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: #f7fafc;
  color: #2d3748;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: transparent;
}

/* Visual editor */
.visual-editor {
  margin-top: 20px;
}

.config-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
}

.config-section h3 {
  color: #2d3748;
  margin: 0 0 20px 0;
  font-size: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
}

.config-section h5 {
  color: #4a5568;
  margin: 15px 0 10px 0;
  font-size: 14px;
  font-weight: 600;
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-weight: 500;
  color: #4a5568;
  font-size: 14px;
  display: block;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
  padding: 10px;
  border: 2px solid #cbd5e0;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* Services list */
.services-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.service-editor {
  background: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
}

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

.service-header h4 {
  margin: 0;
  color: #2d3748;
  font-size: 18px;
}

.add-service-btn {
  background: #48bb78;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  margin-bottom: 15px;
}

.add-service-btn:hover {
  background: #38a169;
}

.delete-service-btn {
  background: #f56565;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
  font-size: 14px;
}

.delete-service-btn:hover {
  background: #e53e3e;
}

/* Check configuration */
.check-config {
  background: white;
  border-radius: 6px;
  padding: 15px;
  margin-top: 15px;
  border: 1px solid #e2e8f0;
}

/* Advanced options */
.advanced-options {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e2e8f0;
}

.toggle-advanced-btn {
  background: #edf2f7;
  color: #4a5568;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
  font-size: 14px;
  margin-bottom: 10px;
}

.toggle-advanced-btn:hover {
  background: #e2e8f0;
}

/* Raw editor */
.raw-editor {
  margin-top: 20px;
}

  .services-table {
    font-size: 14px;
  }

  .services-table th,
  .services-table td {
    padding: 10px;
  }

  h1 {
    font-size: 24px;
  }
}

/* Bearer Token Prompt */
.bearer-prompt {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.bearer-prompt h3 {
  color: #856404;
  margin-bottom: 10px;
  font-size: 18px;
}

.bearer-prompt p {
  color: #856404;
  margin-bottom: 15px;
}

.bearer-input-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.bearer-input {
  flex: 1;
  padding: 10px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
}

.bearer-input:focus {
  outline: none;
  border-color: #667eea;
}

.bearer-btn {
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.bearer-btn:hover {
  background: #5a67d8;
}

.bearer-btn.cancel {
  background: #e53e3e;
}

.bearer-btn.cancel:hover {
  background: #c53030;
}
