/* ==========================================================================
   Code Quality Platform - Application Stylesheet
   Modern, clean design with CSS custom properties. No Node.js build required.
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-hover: #f1f5f9;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: #eef2ff;
  --color-success: #22c55e;
  --color-success-bg: #f0fdf4;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  --color-info: #3b82f6;
  --color-info-bg: #eff6ff;

  --sidebar-width: 260px;
  --header-height: 56px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", monospace;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }
img { max-width: 100%; display: block; }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
pre { background: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: var(--radius-md); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--color-border); }
th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-secondary); }
tbody tr:hover { background: var(--color-surface-hover); }

/* ---------- Layout ---------- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  font-weight: 700; font-size: 1.1rem;
}
.sidebar-brand svg { flex-shrink: 0; }
.sidebar-nav { padding: 0.75rem; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.9rem; font-weight: 500;
  transition: all 0.15s;
}
.sidebar-nav a:hover { background: var(--color-surface-hover); color: var(--color-text); }
.sidebar-nav a.active { background: var(--color-primary-light); color: var(--color-primary); }
.sidebar-section { margin-top: 1.25rem; }
.sidebar-section-title {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 0.25rem 0.75rem; margin-bottom: 0.25rem;
}
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 0.75rem;
}
.sidebar-footer img { width: 32px; height: 32px; border-radius: 50%; }
.sidebar-footer .user-name { font-size: 0.85rem; font-weight: 500; }
.sidebar-footer .user-email { font-size: 0.75rem; color: var(--color-text-muted); }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}
.page-header {
  padding: 1.5rem 2rem 0;
  display: flex; justify-content: space-between; align-items: center;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-body { padding: 1.5rem 2rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-body--flush { padding: 0; }

/* ---------- Stats Grid ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 0.8rem; color: var(--color-text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 2rem; font-weight: 700; margin: 0.25rem 0; line-height: 1.2; }
.stat-detail { font-size: 0.85rem; color: var(--color-text-muted); }

/* ---------- Coverage Bar ---------- */
.coverage-bar { display: flex; align-items: center; gap: 0.75rem; }
.coverage-bar-track { flex: 1; height: 8px; background: var(--color-border-light); border-radius: 4px; overflow: hidden; }
.coverage-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.coverage-bar-fill--high { background: var(--color-success); }
.coverage-bar-fill--medium { background: var(--color-warning); }
.coverage-bar-fill--low { background: var(--color-danger); }
.coverage-bar-value { font-size: 0.9rem; font-weight: 600; min-width: 3.5rem; text-align: right; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.badge--success { background: var(--color-success-bg); color: #16a34a; }
.badge--warning { background: var(--color-warning-bg); color: #d97706; }
.badge--danger { background: var(--color-danger-bg); color: #dc2626; }
.badge--info { background: var(--color-info-bg); color: #2563eb; }
.badge--neutral { background: var(--color-border-light); color: var(--color-text-secondary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500; border: none;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); color: #fff; }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-surface-hover); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-github {
  background: #24292f; color: #fff; padding: 0.75rem 1.5rem;
  font-size: 1rem; border-radius: var(--radius-md); width: 100%;
  justify-content: center;
}
.btn-github:hover { background: #32383f; color: #fff; }

/* ---------- Alerts ---------- */
.alert {
  padding: 0.75rem 1rem; border-radius: var(--radius-md);
  margin-bottom: 1rem; font-size: 0.9rem;
}
.alert--notice { background: var(--color-success-bg); color: #16a34a; border: 1px solid #bbf7d0; }
.alert--alert { background: var(--color-danger-bg); color: #dc2626; border: 1px solid #fecaca; }

/* ---------- Auth Page ---------- */
.auth-container {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 50%, #faf5ff 100%);
}
.auth-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: 2.5rem; width: 100%; max-width: 400px; text-align: center;
}
.auth-logo { margin-bottom: 1.5rem; display: flex; justify-content: center; }
.auth-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.auth-subtitle { color: var(--color-text-secondary); font-size: 0.9rem; margin-bottom: 2rem; line-height: 1.5; }

/* ---------- Commit SHA ---------- */
.sha {
  font-family: var(--font-mono); font-size: 0.85rem;
  background: var(--color-border-light); padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center; padding: 3rem 2rem;
  color: var(--color-text-muted);
}
.empty-state h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--color-text-secondary); }
.empty-state p { font-size: 0.9rem; max-width: 400px; margin: 0 auto; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .page-header, .page-body { padding-left: 1rem; padding-right: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.35rem; }
.form-input {
  width: 100%; padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: 0.9rem; font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-input--mono { font-family: var(--font-mono); }

/* ---------- Repo List ---------- */
.repo-list { list-style: none; }
.repo-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s;
}
.repo-item:last-child { border-bottom: none; }
.repo-item:hover { background: var(--color-surface-hover); }
.repo-item a { color: var(--color-text); font-weight: 500; }
.repo-meta { display: flex; align-items: center; gap: 1rem; }
