/* AllScience — Submission Checklist */

.checklist-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Top Bar ───────────────────────────────────────────────────────── */
.checklist-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 52px;
  background: var(--color-bg-secondary, #111827);
  border-bottom: 1px solid var(--color-border, #1e293b);
  flex-shrink: 0;
}

.checklist-topbar .topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.checklist-topbar .topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--color-text, #e2e8f0);
  text-decoration: none;
  font-size: 0.9375rem;
}

.checklist-topbar .project-title {
  font-size: 0.875rem;
  color: var(--color-text-muted, #8896ab);
}

.checklist-topbar .topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 1rem;
}

.checklist-topbar .topbar-nav a {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  color: var(--color-text-muted, #8896ab);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.checklist-topbar .topbar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: var(--color-text, #e2e8f0);
}

.checklist-topbar .topbar-nav a.active {
  background: rgba(59,130,246,0.15);
  color: var(--color-primary, #3b82f6);
}

.checklist-topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Main Layout ───────────────────────────────────────────────────── */
.checklist-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
  overflow: hidden;
}

/* ── Left Nav Panel ────────────────────────────────────────────────── */
.checklist-nav-panel {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-secondary, #111827);
  border-right: 1px solid var(--color-border, #2a3a52);
  overflow-y: auto;
}

.checklist-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--color-border, #2a3a52);
}

.checklist-nav-header h4 {
  font-size: 0.875rem;
  font-weight: 600;
}

.category-summary {
  font-size: 0.75rem;
  color: var(--color-text-muted, #8896ab);
}

.checklist-nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.checklist-nav-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--color-text-dim, #5a6a80);
  font-size: 0.8125rem;
}

.checklist-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.checklist-nav-item:hover {
  background: var(--color-bg-hover, #1f2d42);
}

.checklist-nav-item.active {
  background: rgba(59,130,246,0.08);
  border-left-color: var(--color-primary, #3b82f6);
}

.checklist-nav-item .nav-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.checklist-nav-item .nav-icon.pass {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success, #10b981);
}

.checklist-nav-item .nav-icon.fail {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger, #ef4444);
}

.checklist-nav-item .nav-icon.warn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning, #f59e0b);
}

.checklist-nav-item .nav-icon.pending {
  background: rgba(138, 150, 171, 0.1);
  color: var(--color-text-dim, #5a6a80);
}

.checklist-nav-item .nav-label {
  font-size: 0.8125rem;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checklist-nav-item .nav-score {
  font-size: 0.6875rem;
  color: var(--color-text-muted, #8896ab);
  font-weight: 600;
}

.checklist-nav-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border, #2a3a52);
}

.checklist-nav-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: 0.75rem;
}

/* ── Main Content ──────────────────────────────────────────────────── */
.checklist-main {
  overflow-y: auto;
  padding: 1.5rem 2rem 3rem;
}

/* ── Score Header ──────────────────────────────────────────────────── */
.checklist-score-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 2rem;
  background: var(--color-bg-card, #1a2233);
  border: 1px solid var(--color-border, #2a3a52);
  border-radius: var(--radius-lg, 16px);
  margin-bottom: 1.5rem;
}

.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.score-svg {
  width: 100%;
  height: 100%;
}

.score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text, #e2e8f0);
}

.score-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 60%);
  font-size: 0.6875rem;
  color: var(--color-text-muted, #8896ab);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-summary {
  flex: 1;
}

.score-summary h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.score-summary p {
  font-size: 0.875rem;
  color: var(--color-text-muted, #8896ab);
  line-height: 1.5;
}

.score-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.form-select {
  padding: 0.5rem 0.75rem;
  background: var(--color-bg, #0a0e17);
  color: var(--color-text, #e2e8f0);
  border: 1px solid var(--color-border, #2a3a52);
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--color-primary, #3b82f6);
  box-shadow: 0 0 0 3px var(--color-primary-glow, rgba(59, 130, 246, 0.15));
}

/* ── Empty State ───────────────────────────────────────────────────── */
.checklist-empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.checklist-empty-state h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.checklist-empty-state p {
  color: var(--color-text-muted, #8896ab);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.criteria-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.criteria-tag {
  padding: 0.375rem 0.75rem;
  background: var(--color-bg-card, #1a2233);
  border: 1px solid var(--color-border, #2a3a52);
  border-radius: 100px;
  font-size: 0.75rem;
  color: var(--color-text-muted, #8896ab);
}

/* ── Loading Skeleton ──────────────────────────────────────────────── */
.checklist-loading {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.checklist-loading .skeleton-bar {
  height: 60px;
  border-radius: var(--radius-md, 10px);
}

/* ── Category Card ─────────────────────────────────────────────────── */
.category-card {
  background: var(--color-bg-card, #1a2233);
  border: 1px solid var(--color-border, #2a3a52);
  border-radius: var(--radius-md, 10px);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: border-color 0.2s;
}

.category-card:hover {
  border-color: var(--color-text-dim, #5a6a80);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
}

.category-header .cat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.category-header .cat-icon.pass { background: rgba(16, 185, 129, 0.12); color: var(--color-success); }
.category-header .cat-icon.fail { background: rgba(239, 68, 68, 0.12); color: var(--color-danger); }
.category-header .cat-icon.warn { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); }

.category-header .cat-info {
  flex: 1;
}

.category-header .cat-name {
  font-size: 0.9375rem;
  font-weight: 600;
}

.category-header .cat-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted, #8896ab);
}

.category-header .cat-score {
  font-size: 0.875rem;
  font-weight: 700;
  margin-right: 0.5rem;
}

.category-header .cat-score.pass { color: var(--color-success); }
.category-header .cat-score.fail { color: var(--color-danger); }
.category-header .cat-score.warn { color: var(--color-warning); }

.category-header .cat-toggle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-dim, #5a6a80);
  transition: transform 0.2s;
}

.category-card.expanded .cat-toggle {
  transform: rotate(180deg);
}

/* Progress bar in category header */
.category-progress {
  height: 4px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}

.category-progress-fill {
  height: 100%;
  transition: width 0.6s ease, background 0.3s;
  border-radius: 0 2px 2px 0;
}

.category-progress-fill.pass { background: var(--color-success, #10b981); }
.category-progress-fill.fail { background: var(--color-danger, #ef4444); }
.category-progress-fill.warn { background: var(--color-warning, #f59e0b); }

/* ── Check Items ───────────────────────────────────────────────────── */
.category-items {
  display: none;
  border-top: 1px solid var(--color-border, #2a3a52);
}

.category-card.expanded .category-items {
  display: block;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.15s;
}

.check-item:last-child {
  border-bottom: none;
}

.check-item:hover {
  background: var(--color-bg-hover, #1f2d42);
}

.check-status {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.check-status.pass {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success, #10b981);
}

.check-status.fail {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger, #ef4444);
}

.check-status.warn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning, #f59e0b);
}

.check-body {
  flex: 1;
  min-width: 0;
}

.check-title {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.125rem;
}

.check-detail {
  font-size: 0.75rem;
  color: var(--color-text-muted, #8896ab);
  line-height: 1.4;
}

.check-fix-link {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-primary, #3b82f6);
  text-decoration: none;
  white-space: nowrap;
  margin-top: 2px;
  flex-shrink: 0;
}

.check-fix-link:hover {
  text-decoration: underline;
}

/* ── Light Theme ───────────────────────────────────────────────────── */
[data-theme="light"] .checklist-topbar {
  background: #ffffff;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .checklist-nav-panel {
  background: #f8fafc;
  border-right-color: #e2e8f0;
}

[data-theme="light"] .checklist-nav-header {
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .checklist-nav-actions {
  border-top-color: #e2e8f0;
}

[data-theme="light"] .checklist-nav-item:hover {
  background: #f1f5f9;
}

[data-theme="light"] .checklist-nav-item.active {
  background: rgba(37, 99, 235, 0.06);
}

[data-theme="light"] .checklist-score-header {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .score-ring circle:first-child {
  stroke: rgba(0,0,0,0.06);
}

[data-theme="light"] .category-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .category-card:hover {
  border-color: #cbd5e1;
}

[data-theme="light"] .category-items {
  border-top-color: #e2e8f0;
}

[data-theme="light"] .check-item {
  border-bottom-color: #f1f5f9;
}

[data-theme="light"] .check-item:hover {
  background: #f8fafc;
}

[data-theme="light"] .category-progress {
  background: rgba(0,0,0,0.04);
}

[data-theme="light"] .form-select {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .criteria-tag {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .checklist-layout {
    grid-template-columns: 1fr;
  }

  .checklist-nav-panel {
    display: none;
  }

  .checklist-main {
    padding: 1rem;
  }

  .checklist-score-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
    padding: 1.25rem;
  }

  .score-actions {
    width: 100%;
  }

  .score-actions .form-select {
    width: 100%;
    min-width: unset;
  }
}

@media (max-width: 600px) {
  .checklist-topbar .topbar-nav {
    display: none;
  }

  .checklist-topbar .topbar-right .btn:not(#logout-btn) {
    display: none;
  }

  .category-header {
    padding: 0.75rem 1rem;
  }

  .check-item {
    padding: 0.625rem 1rem;
  }
}
