/* ========================================
   GitPulse — Card Styles
   Profile card, stats, charts, heatmap
   ======================================== */

/* Card Base */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: rgba(99,102,241,0.2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.card-title svg {
  color: var(--text-muted);
}

.card-body {
  min-height: 0;
}

/* Profile Grid */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.card-full {
  grid-column: 1 / -1;
}

.card-half {
  grid-column: span 1;
}

.card-third {
  grid-column: span 1;
}

/* 3-column row for the last 3 cards */
.profile-grid .card-third:nth-last-child(-n+3):first-child,
.profile-grid .card-third:nth-last-child(-n+3):first-child ~ .card-third {
  /* handled by the triple layout below */
}

/* Animate cards staggered */
.animate-card {
  opacity: 0;
  transform: translateY(20px);
}

.animate-card.visible {
  animation: cardIn 0.5s ease forwards;
}

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

/* ========================================
   Profile Header
   ======================================== */
.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  min-width: 0;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

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

.profile-username {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.profile-name {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-top: 0.125rem;
}

.profile-bio {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  line-height: 1.4;
  max-width: 400px;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.625rem;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.meta-item svg {
  width: 14px;
  height: 14px;
}

/* Profile Stats Row */
.profile-stats {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.stat-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  text-align: center;
  min-width: 80px;
  transition: border-color 0.2s;
}

.stat-mini:hover {
  border-color: rgba(99,102,241,0.3);
}

.stat-mini-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-mini-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-mini-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* ========================================
   Language Breakdown
   ======================================== */
.languages-wrapper {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.lang-chart-container {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.lang-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
}

.lang-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lang-name {
  color: var(--text-secondary);
  flex: 1;
}

.lang-pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========================================
   Top Repos
   ======================================== */
.repo-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.repo-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(30,41,59,0.5);
}

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

.repo-info {
  min-width: 0;
  flex: 1;
}

.repo-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary-light);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-name:hover {
  color: var(--primary);
  text-decoration: underline;
}

.repo-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.375rem;
}

.repo-lang {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.repo-lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.repo-stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.repo-stat svg {
  width: 12px;
  height: 12px;
}

/* ========================================
   Heatmap
   ======================================== */
.heatmap-wrapper {
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.heatmap-container {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: fit-content;
}

.heatmap-months {
  display: flex;
  padding-left: 32px;
  gap: 0;
  margin-bottom: 0.25rem;
}

.heatmap-month-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.heatmap-body {
  display: flex;
  gap: 0.125rem;
}

.heatmap-days-labels {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding-right: 0.375rem;
  justify-content: space-between;
}

.heatmap-day-label {
  font-size: 0.5625rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  height: 12px;
  display: flex;
  align-items: center;
}

.heatmap-grid {
  display: flex;
  gap: 2px;
}

.heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  cursor: pointer;
  transition: outline 0.15s;
}

.heatmap-cell:hover {
  outline: 1px solid var(--text-muted);
  outline-offset: 1px;
}

.heatmap-tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.625rem;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
  pointer-events: none;
  z-index: 100;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

/* Heatmap Colors */
.heatmap-0 { background: #161b22; }
.heatmap-1 { background: #0e4429; }
.heatmap-2 { background: #006d32; }
.heatmap-3 { background: #26a641; }
.heatmap-4 { background: #39d353; }

/* ========================================
   Chart Container
   ======================================== */
.chart-container {
  position: relative;
  height: 240px;
}

.chart-container canvas {
  max-height: 100%;
}

/* ========================================
   Insights
   ======================================== */
.insight-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

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

.insight-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  text-align: right;
}

/* ========================================
   Recent Activity
   ======================================== */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(30,41,59,0.5);
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  color: var(--text-muted);
}

.activity-text {
  flex: 1;
  min-width: 0;
}

.activity-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-desc strong {
  color: var(--text-primary);
  font-weight: 600;
}

.activity-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.125rem;
}

/* ========================================
   Profile Score
   ======================================== */
.score-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.score-ring-container {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 1rem;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.score-ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease;
}

.score-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
}

.score-verdict {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  max-width: 180px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.875rem;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .card-half,
  .card-third {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .profile-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
  }

  .profile-info {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .profile-stats {
    width: 100%;
    justify-content: flex-start;
  }

  .stat-mini {
    min-width: 70px;
    padding: 0.5rem 0.75rem;
  }

  .stat-mini-value {
    font-size: 1rem;
  }

  .profile-username {
    font-size: 1.375rem;
  }

  .languages-wrapper {
    flex-direction: column;
  }

  .lang-chart-container {
    width: 140px;
    height: 140px;
  }

  .heatmap-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chart-container {
    height: 200px;
  }

  .card {
    padding: 1.25rem;
  }
}

/* Triple column layout for last 3 cards on large screens */
@media (min-width: 1025px) {
  .profile-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .card-half {
    grid-column: span 3;
  }

  .card-full {
    grid-column: span 6;
  }

  .card-third {
    grid-column: span 2;
  }
}
