* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; background: #f5f5f5; }

/* Login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-container h1 {
  margin: 0 0 8px 0;
  color: #667eea;
  font-size: 32px;
}

.login-container h2 {
  margin: 0 0 32px 0;
  color: #666;
  font-size: 18px;
  font-weight: 500;
}

/* Admin layout */
.admin-nav {
  background: #333;
  color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-nav h2 {
  margin: 0;
  font-size: 20px;
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.3s;
}

.nav-links a:hover {
  opacity: 0.8;
}

.btn-logout {
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
}

.btn-logout:hover {
  background: #5568d3;
}

.admin-main {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}

.admin-main h1 {
  color: #333;
  margin-top: 0;
}

.admin-main h2 {
  color: #333;
  margin-top: 32px;
  margin-bottom: 16px;
  font-size: 22px;
}

.admin-footer {
  text-align: center;
  color: #999;
  padding: 24px;
  margin-top: 48px;
  border-top: 1px solid #ddd;
  font-size: 14px;
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

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

.stat-card h3 {
  margin: 0 0 16px 0;
  color: #667eea;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-number {
  margin: 0;
  font-size: 42px;
  font-weight: bold;
  color: #333;
}

/* Updates summary */
.updates-summary {
  background: white;
  padding: 24px;
  border-radius: 8px;
  margin-bottom: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.updates-summary h2 {
  margin-top: 0;
}

.updates-summary p {
  margin-bottom: 16px;
  color: #666;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 32px;
}

.data-table thead {
  background: #f9f9f9;
  border-bottom: 2px solid #ddd;
}

.data-table th {
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid #eee;
  color: #555;
}

.data-table tr:hover {
  background: #f9f9f9;
}

.data-table code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
}

/* Forms */
.login-form,
.form-wide {
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 600px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
}

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

.form-group textarea {
  resize: vertical;
}

.form-group small {
  display: block;
  margin-top: 4px;
  color: #999;
  font-size: 13px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.form-checkbox input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  margin-bottom: 0;
}

.form-checkbox label {
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

/* Buttons */
.btn,
.btn-small {
  display: inline-block;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s;
}

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

.btn-primary:hover {
  background: #5568d3;
}

.btn-secondary {
  background: #ddd;
  color: #333;
}

.btn-secondary:hover {
  background: #ccc;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
  margin-right: 8px;
}

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

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

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
}

.badge-read {
  background: #e9ecef;
  color: #6c757d;
}

/* Nav unread badge */
.nav-messages { position: relative; }
.badge-nav {
  background: #dc3545;
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}

/* Messages table */
.row-unread td { background: #fffbf0; font-weight: 500; }
.msg-preview { max-width: 300px; white-space: pre-wrap; word-break: break-word; font-size: 13px; color: #555; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-weight: 500;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Updates header */
.updates-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.updates-header h1 {
  margin: 0;
}

.empty-message {
  text-align: center;
  color: #999;
  padding: 40px 20px;
  font-style: italic;
}

/* Responsive */
@media (max-width: 640px) {
  .admin-nav {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .nav-links {
    width: 100%;
  }

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

  .updates-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .updates-header .btn {
    width: 100%;
    text-align: center;
  }

  .data-table {
    font-size: 13px;
  }

  .data-table th,
  .data-table td {
    padding: 12px 8px;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    text-align: center;
  }
}
