:root {
  --primary: #2563eb;
  --bg: #f3f4f6;
  --text: #1f2937;
  --border: #e5e7eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; background: var(--bg); color: var(--text); }

/* Login page */
.login-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 2rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.login-container h1 { margin-bottom: 1.5rem; text-align: center; }
.login-container input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
}
.login-container button {
  width: 100%;
  padding: 0.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}
.login-container button:hover {
  background: #1d4ed8;
}
.error { color: #dc2626; margin-top: 1rem; text-align: center; }

/* Dashboard */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: white;
  border-bottom: 1px solid var(--border);
}
header h1 {
  font-size: 1.5rem;
}
header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
header button, .nav-link {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--text);
}
header button:hover, .nav-link:hover {
  background: var(--bg);
}
.nav-link.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

main { padding: 2rem; max-width: 1200px; margin: 0 auto; }
section { margin-bottom: 2rem; }
h2 { margin-bottom: 1rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.stat-value { display: block; font-size: 2rem; font-weight: bold; color: var(--primary); }
.stat-label { color: #6b7280; font-size: 0.875rem; }

table { width: 100%; background: white; border-collapse: collapse; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }

/* Loading states */
.loading {
  opacity: 0.5;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
}

/* Settings form */
.form-section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}
.form-section h3 {
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
}
.form-help {
  color: #6b7280;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}
.form-group input[type="file"] {
  margin-bottom: 0.5rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
}
.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}
.form-actions button {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}
.form-actions button:hover {
  background: #1d4ed8;
}
.form-actions button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
#save-status {
  color: #059669;
  font-size: 0.875rem;
}
#save-status.error {
  color: #dc2626;
}

/* Image upload */
#current-image {
  margin-bottom: 1rem;
}
#cover-preview {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
#upload-image-btn {
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  margin-left: 0.5rem;
}
#upload-image-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
#image-upload-status {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}
#image-upload-status.success {
  color: #059669;
}
#image-upload-status.error {
  color: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    padding: 1rem;
  }
  header h1 {
    font-size: 1.25rem;
  }
  main {
    padding: 1rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  table {
    font-size: 0.875rem;
  }
  th, td {
    padding: 0.75rem 0.5rem;
  }
}
