/* ==========================================================================
   AI Codebase Doctor - Modern Cyber-Medical Dark Theme Design System
   ========================================================================== */

:root {
  --bg-dark: #070a12;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-input: #0b1120;
  --border: rgba(51, 65, 85, 0.6);
  --border-glow: rgba(16, 185, 129, 0.4);
  
  --primary: #10b981;
  --primary-glow: rgba(16, 185, 129, 0.25);
  --primary-hover: #34d399;
  
  --cyan: #06b6d4;
  --purple: #a855f7;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --blue: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 15% 15%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 85% 25%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 80%, rgba(168, 85, 247, 0.06) 0px, transparent 60%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #090d16;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Container */
.container {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(7, 10, 18, 0.85);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid var(--border-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: #475569;
}

/* Main Content Area */
main {
  flex: 1;
  padding: 40px 0 60px 0;
}

/* Hero Section */
.hero-section {
  text-align: center;
  max-width: 860px;
  margin: 0 auto 40px auto;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  margin-bottom: 20px;
}

.hero-title {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title .gradient-highlight {
  background: linear-gradient(135deg, #34d399 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.glass-card:hover {
  border-color: rgba(71, 85, 105, 0.8);
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 17, 32, 0.6);
}

.tab-btn {
  flex: 1;
  padding: 16px 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}
.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}
.tab-btn.active {
  color: var(--primary-hover);
  border-bottom-color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}

.tab-pane {
  display: none;
  padding: 32px;
}
.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Form Elements */
.input-group {
  display: flex;
  gap: 12px;
}

.text-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--text-main);
  font-size: 15px;
  font-family: var(--font-sans);
  transition: all 0.2s;
  outline: none;
}
.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #022c22;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  text-decoration: none;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(1px);
}

/* Upload Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px 24px;
  text-align: center;
  background: rgba(11, 17, 32, 0.4);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}
.dropzone-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--primary);
}

/* Demo Cards Grid */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.demo-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s;
}
.demo-card:hover {
  border-color: #475569;
  background: rgba(30, 41, 59, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.5);
}

.demo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.demo-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.demo-lang {
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

.demo-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.demo-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  padding-top: 14px;
}

.demo-score-hint {
  font-size: 12px;
  color: #fb7185;
  font-family: var(--font-mono);
}

/* Scan Progress Visualizer */
.scan-progress-box {
  padding: 40px;
  text-align: center;
}

.scan-radar {
  width: 90px;
  height: 90px;
  margin: 0 auto 24px auto;
  border-radius: 50%;
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  position: relative;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
  animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 20px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.progress-track {
  width: 100%;
  max-width: 600px;
  height: 8px;
  background: #1e293b;
  border-radius: 999px;
  margin: 24px auto 14px auto;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  border-radius: 999px;
  transition: width 0.4s ease;
  width: 5%;
}

.scan-step-text {
  font-size: 15px;
  color: #34d399;
  font-weight: 500;
  font-family: var(--font-mono);
}

/* Scorecard Header */
.scorecard-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 30px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 32px;
  align-items: center;
}

.grade-badge-circle {
  width: 110px;
  height: 110px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 2px solid #334155;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
.grade-badge-circle.grade-A { border-color: #10b981; box-shadow: 0 0 25px rgba(16, 185, 129, 0.3); }
.grade-badge-circle.grade-B { border-color: #06b6d4; box-shadow: 0 0 25px rgba(6, 182, 212, 0.3); }
.grade-badge-circle.grade-C { border-color: #f59e0b; box-shadow: 0 0 25px rgba(245, 158, 11, 0.3); }
.grade-badge-circle.grade-D, .grade-badge-circle.grade-F { border-color: #f43f5e; box-shadow: 0 0 25px rgba(244, 63, 94, 0.3); }

.grade-letter {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}
.score-number {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.repo-overview h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 12px;
}

.critical-alert-bar {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #fda4af;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* 6-Pillar Grid */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.pillar-card:hover, .pillar-card.active {
  border-color: var(--primary);
  background: rgba(30, 41, 59, 0.8);
  transform: translateY(-2px);
}

.pillar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pillar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pillar-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}
.pillar-badge.critical { background: rgba(244, 63, 94, 0.2); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.4); }
.pillar-badge.warning { background: rgba(245, 158, 11, 0.2); color: #fde68a; border: 1px solid rgba(245, 158, 11, 0.4); }
.pillar-badge.good { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }

.pillar-desc {
  font-size: 12px;
  color: var(--text-dim);
}

/* Issues Explorer */
.explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-pill:hover, .filter-pill.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--primary);
  color: #34d399;
}

.issues-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.issue-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s;
}
.issue-card:hover {
  border-color: #475569;
}

.issue-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}

.issue-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.severity-pill {
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}
.severity-critical { background: #f43f5e; color: #fff; }
.severity-high { background: #f97316; color: #fff; }
.severity-medium { background: #eab308; color: #000; }
.severity-low { background: #3b82f6; color: #fff; }

.issue-title {
  font-size: 16px;
  font-weight: 700;
}

.issue-file {
  font-size: 12px;
  font-family: var(--font-mono);
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
}

.issue-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.issue-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(11, 17, 32, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

.code-snippet-box {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #e2e8f0;
  overflow-x: auto;
  margin-bottom: 14px;
}

/* Modal Viewer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.2s;
}

.modal-content {
  background: #090d16;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.5);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.diff-pre {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
}

.diff-line-del {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  display: block;
}
.diff-line-add {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  display: block;
}
.diff-line-header {
  color: #38bdf8;
  font-weight: 700;
  display: block;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid var(--primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 1000;
  animation: slideUp 0.3s;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
  .scorecard-banner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .grade-badge-circle {
    margin: 0 auto;
  }
  .input-group {
    flex-direction: column;
  }
  .demo-grid {
    grid-template-columns: 1fr;
  }
}
