/**
 * admin.css
 * Admin insights page styles.
 * Matches account page aesthetic (Homestead, dark theme).
 */

@font-face {
  font-family: 'Homestead';
  font-display: auto;
  src: url('/1/public/fonts/Homestead-Regular.ttf');
}

html {
  height: 100%;
  font-family: 'Homestead', Arial, Helvetica, sans-serif;
  color: white;
  text-shadow: 0 0 2px black, 0 0 5px black;
}

body {
  background: #415353;
  padding: 0;
  margin: 0;
  font-size: 14px;
  overflow-x: hidden;
  min-height: 100%;
}

#admin-wrapper {
  width: 90%;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 0 40px;
}

h1 {
  font-size: 200%;
  margin-bottom: 20px;
}

h1 a {
  color: inherit;
  text-decoration: none;
}

/* ---- State blocks ---- */

.admin-state {
  margin: 30px 0;
}

.admin-message {
  font-size: 1.1em;
}

.admin-error-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.admin-error-hint {
  margin-top: 16px;
  font-size: 0.95em;
  color: #869886;
}

#admin-error-detail {
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 12px;
  max-height: 200px;
  overflow-y: auto;
}

/* ---- Stats grid ---- */

.admin-section {
  margin: 30px 0;
}

.admin-section h2 {
  font-size: 140%;
  margin-bottom: 16px;
}

.admin-section-desc {
  color: #869886;
  margin-bottom: 16px;
  font-size: 0.95em;
}

.admin-stats-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.admin-stat-card {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.admin-stat-value {
  font-size: 1.5em;
  font-weight: 600;
}

.admin-stat-label {
  font-size: 0.85em;
  color: #869886;
  margin-top: 4px;
}

/* ---- Game breakdown table ---- */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 12px 16px;
  text-align: left;
}

.admin-table th {
  background: rgba(0, 0, 0, 0.35);
  font-weight: 600;
}

.admin-table tr:not(:last-child) td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-table td:nth-child(n+3) {
  text-align: right;
}

/* ---- Flags grid ---- */

.admin-flags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.admin-flag-card {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid #f89f34;
}

.admin-flag-card[data-type="low_completion_rate_7d"] {
  border-left-color: #e57373;
}

.admin-flag-card[data-type="high_completion_rate"] {
  border-left-color: #7cb342;
}

.admin-flag-type {
  font-size: 0.8em;
  text-transform: capitalize;
  color: #f89f34;
  margin-bottom: 4px;
}

.admin-flag-user {
  font-weight: 600;
  margin-bottom: 4px;
}

.admin-flag-message {
  font-size: 0.9em;
  color: #869886;
  margin-bottom: 12px;
}

.admin-export-btn {
  font-family: 'Homestead', Arial, Helvetica, sans-serif;
  font-size: 12px;
  padding: 8px 14px;
  background: #f89f34;
  color: #2a3a3a;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.admin-export-btn:hover:not(:disabled) {
  background: #ffb347;
}

.admin-export-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ---- Footer ---- */

.admin-footer {
  margin: 30px auto 20px;
  color: #869886;
  text-align: center;
  width: 90%;
  max-width: 800px;
}

.admin-footer a {
  color: #869886;
}

.admin-footer a:hover {
  color: #f89f34;
}
