/* Site Auditor Web UI — styles */
:root {
  --bg: #0f1419;
  --bg-card: #1a1f2e;
  --bg-card-hover: #232938;
  --text: #e4e7ec;
  --text-muted: #8b94a7;
  --border: #2a3142;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 8px;
}

[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f2f5;
  --text: #1a1f2e;
  --text-muted: #64748b;
  --border: #e2e8f0;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f2f5;
    --text: #1a1f2e;
    --text-muted: #64748b;
    --border: #e2e8f0;
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo-center { display: block; text-align: center; margin-bottom: 20px; }
.header-nav {
  display: flex;
  gap: 16px;
  flex: 1;
}
.header-nav a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.header-nav a:hover { color: var(--text); text-decoration: none; }
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-name { color: var(--text-muted); font-size: 14px; }

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.footer a { color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--bg-card-hover); text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline { background: transparent; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.badge-error { background: var(--red); }
.badge-warning { background: var(--yellow); color: #1a1f2e; }
.badge-notice { background: var(--blue); }
.badge-admin { background: var(--primary); }

/* Score colors */
.score-a { color: var(--green); }
.score-b { color: var(--green); }
.score-c { color: var(--yellow); }
.score-d { color: var(--red); }
.score-f { color: var(--red); }
.score-none { color: var(--text-muted); }

/* Auth pages */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.auth-card h1 { margin-bottom: 24px; font-size: 24px; }
.auth-link { margin-top: 20px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-wide { max-width: 600px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field span { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.form-field input, .form-field select, .select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.form-field input:focus, .select:focus { outline: none; border-color: var(--primary); }
.form-field input[type="url"],
.form-field input[type="email"],
.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="number"] { width: 100%; }
.form-row { display: flex; gap: 16px; }
.form-row .form-field { flex: 1; }
.form-checkbox { display: flex; align-items: center; gap: 8px; }
.form-inline { display: inline-flex; gap: 8px; align-items: center; }
.req { color: var(--red); }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid var(--red); color: var(--red); }
.alert-warning { background: rgba(234,179,8,0.15); border: 1px solid var(--yellow); color: var(--yellow); }

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; }
.muted { color: var(--text-muted); font-size: 14px; }
.text-sm { font-size: 13px; }
.mt { margin-top: 24px; }
.mb { margin-bottom: 24px; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-value { display: block; font-size: 28px; font-weight: 700; }
.stat-value-sm { font-size: 18px; font-weight: 600; }
.stat-label { display: block; color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* Projects grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.project-card:hover { background: var(--bg-card-hover); border-color: var(--primary); }
.project-card-header h3 { font-size: 16px; margin-bottom: 4px; }
.project-name { color: var(--text-muted); font-size: 13px; }
.project-card-body { display: flex; gap: 20px; margin-top: 16px; }
.project-stat { display: flex; flex-direction: column; gap: 2px; }

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .info-grid { grid-template-columns: 1fr; }
}
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.info-card h3 { font-size: 16px; margin-bottom: 16px; }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table thead { background: var(--bg-card); }
.table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table tr:hover td { background: var(--bg-card); }
.table-sm th, .table-sm td { padding: 6px 10px; font-size: 13px; }

/* KV table */
.kv-table { width: 100%; font-size: 14px; }
.kv-table td { padding: 6px 0; }
.kv-table td:first-child { color: var(--text-muted); width: 40%; }

/* Truncate */
.truncate {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; font-size: 16px; }

/* Error page */
.error-page {
  text-align: center;
  padding: 80px 20px;
}
.error-code { font-size: 72px; font-weight: 700; color: var(--text-muted); }
.error-msg { font-size: 18px; color: var(--text-muted); margin: 16px 0 32px; }

/* Progress bar */
.progress-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-bar.hidden { display: none; }
.progress-fill {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  width: 40%;
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  animation: progress-slide 1.5s infinite;
}
.progress-text { font-size: 14px; color: var(--text-muted); }
@keyframes progress-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* Code */
code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', Consolas, monospace;
}

/* Responsive */
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px; gap: 12px; }
  .header-nav { order: 3; width: 100%; }
  .form-row { flex-direction: column; }
  .truncate { max-width: 180px; }
}