/*
 * Progress & Claims Tracker — Styles
 * Designed to complement the Ghost Source theme.
 */

/* ── Tracker Controls ──────────────────────────────────────────────── */

#tracker-app {
  margin-top: 2rem;
}

#tracker-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: center;
}

#tracker-search {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--color-border, #e1e1e1);
  border-radius: 6px;
  font-size: 1.05rem;
  font-family: inherit;
  background: var(--background-color, #fff);
  color: inherit;
  transition: border-color 0.2s;
}

#tracker-search:focus {
  outline: none;
  border-color: var(--ghost-accent-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#tracker-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1.5rem 0;
}

.filter-btn {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--color-border, #e1e1e1);
  border-radius: 20px;
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--ghost-accent-color, #3b82f6);
}

.filter-btn.active {
  background: var(--ghost-accent-color, #3b82f6);
  color: #fff;
  border-color: var(--ghost-accent-color, #3b82f6);
}

/* ── Stats Grid ────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.2rem 1rem;
  border: 1px solid var(--color-border, #e1e1e1);
  border-radius: 8px;
  text-align: center;
  background: #ffffff;
  color: #1f2937;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ghost-accent-color, #3b82f6);
}

.stat-label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #4b5563;
}

/* ── Section Toggles ───────────────────────────────────────────────── */

.tracker-section {
  margin-bottom: 2rem;
}

.section-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1rem 0;
  border: none;
  border-bottom: 2px solid var(--color-border, #e1e1e1);
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-family: inherit;
  gap: 1rem;
}

.section-toggle h2 {
  margin: 0;
  font-size: 1.5rem;
  flex: 1;
}

.section-meta {
  font-size: 0.9rem;
  opacity: 0.6;
  white-space: nowrap;
}

.toggle-icon {
  font-size: 0.8rem;
  opacity: 0.5;
  transition: transform 0.25s ease;
}

.section-toggle[aria-expanded="false"] .toggle-icon {
  transform: rotate(-90deg);
}

.section-content {
  padding-top: 1rem;
}

.section-content[hidden] {
  display: none;
}

/* ── Cards ─────────────────────────────────────────────────────────── */

.tracker-card {
  border: 1px solid var(--color-border, #e1e1e1);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.tracker-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card-toggle {
  display: flex;
  align-items: flex-start;
  width: 100%;
  padding: 1rem 1.2rem;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-family: inherit;
  gap: 0.8rem;
}

.card-header {
  flex: 1;
  min-width: 0;
}

.card-header h3 {
  margin: 0 0 0.4rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.card-chevron {
  font-size: 0.7rem;
  opacity: 0.4;
  flex-shrink: 0;
  margin-top: 0.3rem;
  transition: transform 0.25s ease;
}

.card-body {
  padding: 0 1.2rem 1.2rem;
  border-top: 1px solid var(--color-border, #e1e1e1);
}

.card-body[hidden] {
  display: none;
}

/* ── Badges ────────────────────────────────────────────────────────── */

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-count {
  background: #f0f0f0;
  color: #555;
}

.badge-recent {
  background: #fef3c7;
  color: #92400e;
}

.badge-type {
  background: #ede9fe;
  color: #5b21b6;
}

.badge-horizon {
  background: #e0f2fe;
  color: #0369a1;
}

/* Status badges */
.status-early {
  background: #dbeafe;
  color: #1e40af;
}

.status-supported {
  background: #d1fae5;
  color: #065f46;
}

.status-challenged {
  background: #fef3c7;
  color: #92400e;
}

.status-falsified {
  background: #fee2e2;
  color: #991b1b;
}

.status-revised {
  background: #e5e7eb;
  color: #374151;
}

/* Arc status badges */
.arc-active {
  background: #d1fae5;
  color: #065f46;
}

.arc-watching {
  background: #dbeafe;
  color: #1e40af;
}

.arc-dormant {
  background: #e5e7eb;
  color: #6b7280;
}

/* ── Claim-specific ────────────────────────────────────────────────── */

.claim-title-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.claim-id {
  font-size: 0.8rem;
  font-weight: 700;
  background: #f3f4f6;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: #6b7280;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.claim-source {
  margin: 1rem 0;
  font-size: 0.95rem;
}

.source-label {
  font-weight: 600;
  opacity: 0.7;
}

.claim-source a {
  color: var(--ghost-accent-color, #3b82f6);
  text-decoration: none;
}

.claim-source a:hover {
  text-decoration: underline;
}

.claim-mechanism,
.claim-assumptions,
.claim-falsifiers,
.claim-revision {
  margin: 1.2rem 0;
}

.claim-mechanism h4,
.claim-assumptions h4,
.claim-falsifiers h4,
.claim-revision h4,
.evidence-section h4 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.6;
  margin: 0 0 0.5rem 0;
}

.claim-mechanism p {
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
}

.assumption-group {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.claim-falsifiers ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.95rem;
}

.claim-falsifiers li {
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

/* ── Evidence ──────────────────────────────────────────────────────── */

.evidence-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.2rem 0;
}

@media (max-width: 680px) {
  .evidence-columns {
    grid-template-columns: 1fr;
  }
}

.evidence-section {
  min-width: 0;
}

.evidence-supporting {
  border-left: 3px solid #10b981;
  padding-left: 0.8rem;
}

.evidence-complicating {
  border-left: 3px solid #f59e0b;
  padding-left: 0.8rem;
}

.evidence-entry {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
  line-height: 1.5;
  align-items: flex-start;
}

.evidence-icon {
  flex-shrink: 0;
  width: 1.2rem;
  text-align: center;
  font-weight: 700;
}

.evidence-entry.supporting .evidence-icon {
  color: #10b981;
}

.evidence-entry.complicating .evidence-icon {
  color: #f59e0b;
}

.evidence-date {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: #6b7280;
  min-width: 80px;
}

.evidence-text {
  min-width: 0;
}

.evidence-source {
  text-decoration: none;
  opacity: 0.6;
  margin-left: 0.3em;
  font-size: 0.85em;
}
.evidence-source:hover {
  opacity: 1;
}

/* ── Related Arcs ──────────────────────────────────────────────────── */

.claim-related-arcs {
  margin: 1rem 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.related-label {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-right: 0.3rem;
}

.related-arc-tag {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  background: #f3f4f6;
  border-radius: 12px;
  color: #374151;
}

/* ── Timeline ──────────────────────────────────────────────────────── */

.timeline {
  padding: 0.5rem 0;
}

.timeline-entry {
  display: flex;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 0.95rem;
  line-height: 1.55;
  align-items: flex-start;
}

.timeline-entry:last-child {
  border-bottom: none;
}

a.timeline-date {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--ghost-accent-color, #3b82f6);
  text-decoration: none;
  min-width: 85px;
  padding-top: 0.1rem;
}

a.timeline-date:hover {
  text-decoration: underline;
}

.timeline-text {
  min-width: 0;
}

.show-more-btn {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  margin: 0.5rem 0;
  border: 1px dashed var(--color-border, #e1e1e1);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ghost-accent-color, #3b82f6);
  font-family: inherit;
  transition: background 0.2s;
}

.show-more-btn:hover {
  background: rgba(59, 130, 246, 0.05);
}

/* ── Footer ────────────────────────────────────────────────────────── */

#tracker-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border, #e1e1e1);
  font-size: 0.9rem;
  opacity: 0.7;
}

.tracker-note {
  font-style: italic;
  line-height: 1.6;
}

/* ── Charts ─────────────────────────────────────────────────────────── */

#tracker-charts {
  margin-bottom: 2.5rem;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 680px) {
  .chart-row {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  border: 1px solid var(--color-border, #e1e1e1);
  border-radius: 8px;
  padding: 1.2rem;
  background: #ffffff;
  color: #1f2937;
}

.chart-title {
  margin: 0 0 0.8rem 0;
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.8;
  color: #374151;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 220px;
}

/* ── Misc ──────────────────────────────────────────────────────────── */

.loading-indicator {
  text-align: center;
  padding: 2rem;
  opacity: 0.5;
}

.no-results {
  text-align: center;
  padding: 2rem;
  opacity: 0.5;
  font-style: italic;
}

.error {
  color: #ef4444;
  text-align: center;
  padding: 2rem;
}

mark {
  background: #fef08a;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* ── Dark mode support ─────────────────────────────────────────────── */
/* Ghost Source sets .has-light-text on dark backgrounds */

.has-light-text .badge-count {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.has-light-text .badge-recent {
  background: rgba(254, 243, 199, 0.2);
  color: #fcd34d;
}

.has-light-text .badge-type {
  background: rgba(237, 233, 254, 0.15);
  color: #c4b5fd;
}

.has-light-text .badge-horizon {
  background: rgba(224, 242, 254, 0.15);
  color: #7dd3fc;
}

.has-light-text .claim-id {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

.has-light-text .related-arc-tag {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

.has-light-text .tracker-card {
  border-color: rgba(255, 255, 255, 0.12);
}

.has-light-text .tracker-card:hover {
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.06);
}

.has-light-text .section-toggle {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.has-light-text .card-body {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.has-light-text #tracker-search {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.has-light-text .filter-btn {
  border-color: rgba(255, 255, 255, 0.2);
}

.has-light-text .stat-card {
  border-color: rgba(255, 255, 255, 0.12);
}

.has-light-text .show-more-btn {
  border-color: rgba(255, 255, 255, 0.15);
}

.has-light-text .timeline-entry {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.has-light-text #tracker-footer {
  border-top-color: rgba(255, 255, 255, 0.12);
}

.has-light-text mark {
  background: rgba(254, 240, 138, 0.3);
}
