/* ============================================
   JustShipped.Dev — Shared Styles
   ============================================ */

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

/* Base */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #ffffff;
  color: #333;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
}

button,
select {
  text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Layout */
.container {
  max-width: 620px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
  /* Flush left and right */
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.02em;
  margin: 0;
  padding: 0;
}

h1 a {
  color: inherit;
  text-decoration: none;
}

/* Navigation */
nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
}

nav a {
  color: #999;
  text-decoration: none;
  transition: color 0.2s;
}

nav a:hover {
  color: #111;
}

nav a.active {
  color: #111;
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid #e5e5e5;
  margin: 2rem 0;
}

/* ============================================
   Stats Bar
   ============================================ */
.stats-period {
  font-size: 0.75rem;
  font-weight: 600;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats {
  display: flex;
  gap: 2rem;
  /* Slightly reduced gap to prevent overlap on narrow screens */
  margin-bottom: 0.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: default;
}

button.stat {
  cursor: pointer;
  transition: opacity 0.2s;
}

button.stat:hover .stat-label,
button.stat:hover .stat-value {
  color: #111;
}

button.stat.active .stat-value {
  color: #111;
}

button.stat.active .stat-label {
  color: #111;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  line-height: 1.2;
  margin-top: 2px;
}

/* ============================================
   Heatmap
   ============================================ */
.heatmap {
  margin: 0.25rem 0 0.5rem 0;
}

.heatmap-row {
  display: flex !important;
  align-items: flex-start !important;
  position: relative;
  margin-bottom: 0.25rem;
  gap: 12px;
}

.heatmap-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.heatmap-grid {
  display: grid;
  /* Columns handled by inline style in JS */
  gap: 2px;
  flex: 1;
  /* Allow grid to expand/contract */
  min-width: 0;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: #ebedf0;
  transition: background-color 0.15s ease;
}

.heatmap-cell.interactive:hover {
  background-color: #30a14e;
  cursor: pointer;
}

.heatmap-date-label {
  margin-left: 0;
  /* Handled by gap on row */
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
  font-weight: 400;
  letter-spacing: 0.05em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.8;
  min-width: 100px;
  text-align: right;
  margin-top: 2px;
  /* Pull down slightly to align with cell top */
}

.org-header {
  margin: 2.5rem 0 1rem 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.org-header span {
  display: inline-block;
  padding-bottom: 4px;
}

.repos-list {
  padding: 0;
}

.repo {
  margin-bottom: 1.5rem;
}

.repo-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.repo-name a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.repo-name a:hover {
  border-bottom-color: #111;
}

.heatmap-cell.level-1 {
  background: #9be9a8;
}

.heatmap-cell.level-2 {
  background: #40c463;
}

.heatmap-cell.level-3 {
  background: #30a14e;
}

.heatmap-cell.level-4 {
  background: #216e39;
}

.heatmap-months {
  display: grid;
  /* Columns handled by inline style in JS */
  gap: 2px;
  margin-top: 2px;
}

.heatmap-months span {
  font-size: 0.6rem;
  color: #aaa;
  letter-spacing: 0.02em;
}

.heatmap-legend {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: flex-end;
  margin-top: 10px;
  font-size: 0.65rem;
  color: #aaa;
  gap: 10px;
}

.legend-colors {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 4px;
}

.heatmap-legend .heatmap-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.stat-timeframe {
  margin-left: auto;
  display: flex;
  gap: 12px;
  align-self: flex-end;
  padding-bottom: 4px;
  /* Align with stat-labels roughly */
}

.timeframe-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.8rem;
  color: #999;
  /* Match stat-label color */
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  /* Match stat-label weight */
  transition: color 0.2s;
}

.timeframe-btn:hover {
  color: #111;
}

.timeframe-btn.active {
  color: #111;
  /* Darker for active, but same weight */
}

.heatmap-legend .heatmap-cell:hover {
  transform: none;
}

/* ============================================
   Week Entries
   ============================================ */
.week-entry {
  margin-bottom: 3rem;
  padding: 0;
  /* Zero padding for flush alignment */
  border-radius: 0;
}

.week-date {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.week-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 1rem;
}

.week-entry a {
  color: #111;
}

.highlight-week {
  background-color: #f7f9fc;
  animation: highlightPulse 1.5s ease;
}

@keyframes highlightPulse {
  0% {
    background-color: #f7f9fc;
    box-shadow: 0 0 0 2px #eef2f8;
  }

  50% {
    background-color: #eef2f8;
    box-shadow: 0 0 0 4px #eef2f8;
  }

  100% {
    background-color: transparent;
    box-shadow: 0 0 0 0 transparent;
  }
}


.section-intro,
.page-description {
  font-size: 0.75rem;
  font-weight: 600;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
  display: block;
}

.page-description {
  text-transform: none;
  font-weight: 400;
  color: #999;
  line-height: 1.6;
}

.callout {
  margin-bottom: 2.5rem;
}

.callout-text {
  font-size: 0.85rem;
  color: #999;
  line-height: 1.6;
  margin: 0;
}

.filters-container {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  animation: fadeInUp 0.5s ease-out both;
}

.week-meta {
  color: #999;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
  align-items: center;
}

.additions {
  color: #1a7f37;
}

.deletions {
  color: #cf222e;
}

.badge-sprint {
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
  margin-left: 6px;
  bottom: 1px;
  position: relative;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  background: #eefdf5;
  color: #16a34a;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.2;
  vertical-align: middle;
  position: relative;
  bottom: 1px;
}

/* Week-over-week delta indicators */
.delta {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.2;
}

.delta-up {
  color: #1a7f37;
  background: #dafbe1;
}

.delta-down {
  color: #cf222e;
  background: #ffebe9;
}

.week-summary {
  font-size: 0.85rem;
  color: #666;
  margin: 0.75rem 0 1.25rem 0;
  line-height: 1.6;
  font-weight: 400;
}

/* Repos */
.org-section:first-child {
  margin-top: 0.5rem;
}

.repo {
  margin-bottom: 1rem;
}

.repo-name {
  font-weight: 500;
  color: #111;
}

.repo-name a {
  color: #111;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1.5px solid #eaeaea;
  padding-bottom: 1px;
  transition: border-bottom-color 0.2s;
}

.repo-name a:hover {
  border-bottom-color: #111;
}

.repo-details {
  font-size: 0.85rem;
  color: #999;
  line-height: 1.6;
}

.badge-sprint {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
  background: #f0f4ff;
  color: #5c7cfa;
  border: 1px solid #dbe4ff;
}

/* Org sections */
.org-section {
  margin-bottom: 1.5rem;
}


.private-summary {
  font-size: 0.8rem;
  color: #999;
  font-style: italic;
  margin-top: 0.5rem;
}

/* ============================================
   Projects Page
   ============================================ */
.project {
  margin-bottom: 1rem;
}

.project-name {
  font-weight: 500;
  color: #111;
}

.project-name a {
  color: #111;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1.5px solid #eaeaea;
  padding-bottom: 1px;
  transition: border-bottom-color 0.2s;
}

.project-name a:hover {
  border-bottom-color: #111;
}

.project-description {
  font-size: 0.85rem;
  color: #999;
  margin-top: 0.25rem;
  line-height: 1.6;
}

.project-meta {
  font-size: 0.85rem;
  color: #999;
  margin-top: 0.25rem;
}

/* ============================================
   Loading & Empty States
   ============================================ */
.loading {
  text-align: center;
  padding: 4rem 0;
  color: #bbb;
  font-size: 0.9rem;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: '';
  }

  25% {
    content: '.';
  }

  50% {
    content: '..';
  }

  75% {
    content: '...';
  }
}

.empty-state {
  color: #999;
  padding: 4rem 0;
}

.empty-state p {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.error-state {
  color: #cf222e;
  padding: 4rem 0;
  font-size: 0.9rem;
}

/* ============================================
   Show More Button
   ============================================ */
.show-more-btn {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-top: 1rem;
  background: transparent;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  color: #999;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.show-more-btn:hover {
  border-color: #ccc;
  color: #666;
}

/* ============================================
   Footer
   ============================================ */
footer {
  color: #bbb;
  font-size: 0.8rem;
}

footer a {
  color: #999;
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

footer a:hover {
  color: #555;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
  .container {
    padding: 2.5rem 1.25rem;
  }

  .stats {
    gap: 1.25rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .heatmap-months span {
    font-size: 0.5rem;
  }

  .heatmap-legend {
    font-size: 0.5rem;
    justify-content: center;
  }

  .heatmap-date-label {
    font-size: 10px;
  }
}