/* ==========================================================================
   goscore.dev Design System & Aesthetic Styling
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-dark: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 35, 54, 0.85);
  --bg-sidebar: rgba(13, 17, 26, 0.95);
  --bg-input: #141b2d;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.15);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Text Colors */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #38bdf8;
  --accent-teal: #14b8a6;

  /* Grade Colors */
  --grade-aplus: #fbbf24;
  --grade-a: #10b981;
  --grade-b: #06b6d4;
  --grade-c: #f59e0b;
  --grade-d: #f97316;
  --grade-f: #ef4444;

  /* Shadows & Glassmorphism */
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);
  --backdrop-blur: blur(16px);
}

/* Reset & Global Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(20, 184, 166, 0.06) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
}

.navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7 0%, #0d9488 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-accent {
  color: var(--accent-cyan);
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Search Bar */
.search-container {
  flex: 1;
  max-width: 540px;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.65rem 5.5rem 0.65rem 2.6rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.search-btn {
  position: absolute;
  right: 6px;
  padding: 0.4rem 0.85rem;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-btn:hover {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-link {
  color: var(--text-muted);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

.header-link:hover {
  color: var(--text-main);
}

/* Main Container & Dual-Pane Grid */
.main-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
}

/* Sidebar */
.sidebar {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  position: sticky;
  top: 85px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.sidebar-badge {
  font-size: 0.72rem;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-cyan);
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-weight: 600;
}

.sidebar-filter {
  margin-bottom: 1rem;
}

.sidebar-filter-input {
  width: 100%;
  padding: 0.5rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.82rem;
}

.sidebar-filter-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.module-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
  padding-right: 4px;
}

/* Sidebar Scrollbar */
.module-list::-webkit-scrollbar {
  width: 5px;
}

.module-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.module-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.module-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-color);
}

.module-item.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.3);
  font-weight: 600;
}

.module-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.module-item-grade {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  text-transform: uppercase;
}

/* Main Content Area */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* State Containers (Loading / Error) */
.state-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 4rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: var(--backdrop-blur);
}

.state-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 1rem;
}

.state-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.5rem;
  max-width: 480px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(56, 189, 248, 0.15);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-icon {
  color: var(--grade-f);
  background: rgba(239, 68, 68, 0.1);
  padding: 1rem;
  border-radius: 50%;
}

.btn {
  margin-top: 1.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #0b0f19;
}

.btn-primary:hover {
  background: #7dd3fc;
  box-shadow: var(--shadow-glow);
}

.hidden {
  display: none !important;
}

/* Cards & Reports */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--shadow-lg);
}

.overview-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.overview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;

}

.module-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.module-path-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.module-title {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-all;
}

.version-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-weight: 600;
}

.meta-subrow {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border-highlight);
}

/* Grade Badge */
.grade-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.85rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--border-color);
}

.grade-badge {
  font-size: 2.2rem;
  font-weight: 800;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Grade Dynamic Classes */
.grade-aplus { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.grade-a { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.grade-b { background: linear-gradient(135deg, #06b6d4, #0891b2); color: #fff; }
.grade-c { background: linear-gradient(135deg, #f59e0b, #b45309); color: #fff; }
.grade-d { background: linear-gradient(135deg, #f97316, #c2410c); color: #fff; }
.grade-f { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; }

.score-meta {
  display: flex;
  flex-direction: column;
}

.score-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.score-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Gauge Bar */
.gauge-bar-wrapper {
  margin-top: 0.5rem;
}

.gauge-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: hidden;
}

.gauge-bar-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-teal));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Section Header */
.section-header {
  margin-top: 0.5rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Checks Grid */
.checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.check-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.check-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
}

.check-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.check-name-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.check-title {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.check-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
}

.status-pass {
  background: rgba(16, 185, 129, 0.15);
  color: var(--grade-a);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-fail {
  background: rgba(239, 68, 68, 0.15);
  color: var(--grade-f);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-info {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.check-metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px dashed var(--border-color);
  padding-top: 0.75rem;
}

.metric-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Detail Box (e.g., Unformatted files or vulnerabilities output) */
.detail-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.detail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.detail-list-item {
  color: #fca5a5;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border-color);
  background: rgba(11, 15, 25, 0.9);
  padding: 1.25rem 1.5rem;
  margin-top: auto;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Responsive Media Queries */
@media (max-width: 900px) {
  .main-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: static;
  }

  .overview-header {
    flex-direction: column;
    align-items: stretch;
  }

  .grade-container {
    justify-content: space-between;
  }
}
