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

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

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

header {
  background: white;
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.header-left {
  display: flex;
  gap: 15px;
  align-items: center;
}

.logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
  flex-shrink: 0;
}

.header-left h1 {
  font-size: 28px;
  color: #667eea;
  margin: 0;
}

.header-left p {
  color: #888;
  font-size: 14px;
}

.header-right {
  display: flex;
  gap: 15px;
  align-items: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.status-online {
  background: #d4edda;
  color: #155724;
}

.status-offline {
  background: #f8d7da;
  color: #721c24;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-green {
  background: #28a745;
  animation: pulse 2s infinite;
}

.dot-red {
  background: #dc3545;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.refresh-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s;
}

.refresh-btn:hover {
  background: #764ba2;
}

.refresh-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

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

.card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s, box-shadow 0.3s;
}

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

.card h3 {
  font-size: 14px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  font-weight: 600;
}

.card-value {
  font-size: 32px;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 13px;
  color: #999;
}

.card.db-card {
  background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
  border-left: 4px solid #667eea;
}

.card.traffic-card {
  background: linear-gradient(135deg, #f09433 15%, #ea6c00 100%);
  color: white;
}

.card.traffic-card h3 {
  color: rgba(255, 255, 255, 0.8);
}

.card.traffic-card .card-value {
  color: white;
}

.card.traffic-card .card-subtitle {
  color: rgba(255, 255, 255, 0.7);
}

.section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin-bottom: 20px;
  padding-left: 10px;
  border-left: 4px solid white;
}

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

.chart-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.chart-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin-bottom: 20px;
}

.routes-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.routes-table thead {
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
}

.routes-table th {
  padding: 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: #667eea;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.routes-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e9ecef;
  font-size: 14px;
}

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

.method-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.method-get {
  background: #d1ecf1;
  color: #0c5460;
}

.method-post {
  background: #d4edda;
  color: #155724;
}

.method-put {
  background: #fff3cd;
  color: #856404;
}

.method-patch {
  background: #e2e3e5;
  color: #383d41;
}

.method-delete {
  background: #f8d7da;
  color: #721c24;
}

.db-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.db-info-item {
  padding: 16px;
  background: white;
  border-radius: 8px;
  border-left: 3px solid #667eea;
}

.db-info-item label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.db-info-item value {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  word-break: break-all;
}

.loading {
  text-align: center;
  padding: 40px;
  color: white;
}

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.error {
  background: #f8d7da;
  color: #721c24;
  padding: 16px;
  border-radius: 8px;
  margin: 20px 0;
}

.recent-requests {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  max-height: 500px;
  overflow-y: auto;
}

.request-item {
  padding: 12px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.request-item:last-child {
  border-bottom: none;
}

.request-left {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 1;
}

.request-status {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.status-2xx {
  background: #d4edda;
  color: #155724;
}

.status-4xx {
  background: #fff3cd;
  color: #856404;
}

.status-5xx {
  background: #f8d7da;
  color: #721c24;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .section-title {
    font-size: 18px;
  }

  header h1 {
    font-size: 24px;
  }
}
