/* ===================================================================
   TRAINQUANTS - ACTIVITY HEATMAP DESIGN SYSTEM (css/activity-heatmap.css)
   Pixel-Accurate Contribution Calendar · LeetCode & GitHub Institutional Craft
   =================================================================== */

.tq-heatmap-card {
  background: #090a0d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease;
}

.tq-heatmap-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.tq-heatmap-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  width: 100%;
}

/* Header */
.tq-heatmap-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
}

.tq-heatmap-title-cluster {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tq-heatmap-headline {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: #94a3b8;
  display: flex;
  align-items: baseline;
  gap: 6px;
  letter-spacing: -0.01em;
}

.tq-heatmap-total {
  font-size: 18px;
  font-weight: 800;
  color: #f8fafc;
  font-family: var(--font-sans, system-ui, sans-serif);
}

.tq-heatmap-period {
  color: #cbd5e1;
}

.tq-heatmap-subtitle {
  font-size: 11.5px;
  color: #64748b;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.02em;
}

/* Streaks Pill Badges */
.tq-heatmap-stats-pills {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tq-streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  font-size: 12px;
  color: #e2e8f0;
}

.tq-streak-pill strong {
  color: #fbbf24;
  font-weight: 700;
}

.tq-streak-pill.secondary {
  background: rgba(41, 151, 255, 0.08);
  border-color: rgba(41, 151, 255, 0.25);
}

.tq-streak-pill.secondary strong {
  color: #38bdf8;
}

/* Scroller & Grid Container */
.tq-heatmap-scroller {
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.tq-heatmap-scroller::-webkit-scrollbar {
  height: 6px;
}

.tq-heatmap-scroller::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.tq-heatmap-canvas {
  display: grid;
  grid-template-areas:
    ". months"
    "weekdays grid";
  grid-template-columns: 28px 1fr;
  row-gap: 8px;
  column-gap: 8px;
  min-width: max-content;
  position: relative;
}

/* Month Labels across columns */
.tq-heatmap-months {
  grid-area: months;
  position: relative;
  height: 16px;
}

.tq-heatmap-month {
  position: absolute;
  left: calc(var(--col, 0) * 15px);
  font-size: 11px;
  color: #71717a;
  white-space: nowrap;
  font-weight: 500;
}

/* Weekday Labels on left */
.tq-heatmap-weekdays {
  grid-area: weekdays;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(7 * 15px);
  padding-top: 1px;
}

.tq-heatmap-weekday {
  font-size: 10px;
  height: 12px;
  line-height: 12px;
  color: #71717a;
  font-family: var(--font-mono, monospace);
}

/* Grid & Rows */
.tq-heatmap-grid {
  grid-area: grid;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.tq-heatmap-row {
  display: flex;
  gap: 3px;
}

/* Cells (Individual Days) */
.tq-cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background-color: #16181d;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  flex-shrink: 0;
}

.tq-cell.empty {
  visibility: hidden;
}

/* 5 Level Tints */
.tq-cell[data-level="0"] {
  background-color: #16181d;
}

.tq-cell[data-level="1"] {
  background-color: rgba(41, 151, 255, 0.28);
}

.tq-cell[data-level="2"] {
  background-color: rgba(41, 151, 255, 0.55);
}

.tq-cell[data-level="3"] {
  background-color: rgba(41, 151, 255, 0.80);
}

.tq-cell[data-level="4"] {
  background-color: #38bdf8;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.45);
}

/* Hover & Focus Interaction */
.tq-cell:hover,
.tq-cell:focus-visible {
  transform: scale(1.35);
  z-index: 30;
  box-shadow: 0 0 0 1.5px #ffffff, 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Highlight Filter States */
.tq-cell.dimmed {
  opacity: 0.18;
}

.tq-cell.highlighted {
  transform: scale(1.2);
  box-shadow: 0 0 0 1px #ffffff;
}

/* Today Pulse Indicator */
.tq-cell.today-pulse {
  border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Newly Solved Instant Animation */
.tq-cell.just-solved-pulse {
  animation: tqCellPulseCelebration 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  background-color: #34d399 !important;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.8) !important;
}

@keyframes tqCellPulseCelebration {
  0% { transform: scale(1); }
  35% { transform: scale(2.0); box-shadow: 0 0 24px rgba(52, 211, 153, 1); }
  70% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Footer & Legend */
.tq-heatmap-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: #71717a;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.tq-heatmap-caption {
  color: #94a3b8;
  font-size: 11.5px;
}

.tq-heatmap-caption i {
  color: #38bdf8;
  margin-right: 4px;
}

.tq-heatmap-scale {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tq-scale-lbl {
  font-size: 11px;
  color: #71717a;
  font-family: var(--font-mono, monospace);
}

.tq-scale-swatches {
  display: flex;
  gap: 3px;
}

.tq-scale-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid transparent;
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s ease, outline 0.15s ease;
}

.tq-scale-swatch[data-level="0"] { background-color: #16181d; }
.tq-scale-swatch[data-level="1"] { background-color: rgba(41, 151, 255, 0.28); }
.tq-scale-swatch[data-level="2"] { background-color: rgba(41, 151, 255, 0.55); }
.tq-scale-swatch[data-level="3"] { background-color: rgba(41, 151, 255, 0.80); }
.tq-scale-swatch[data-level="4"] { background-color: #38bdf8; }

.tq-scale-swatch:hover,
.tq-scale-swatch.active-filter {
  transform: scale(1.25);
  border-color: #ffffff;
}

/* Floating Gliding Tooltip */
.tq-heatmap-tooltip {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  background: #0f141c;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1), transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

.tq-heatmap-tooltip.visible {
  opacity: 1;
}

.tq-tooltip-count {
  font-size: 12px;
  color: #f8fafc;
  font-weight: 600;
}

.tq-tooltip-date {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.tq-tooltip-details {
  font-size: 10.5px;
  color: #38bdf8;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono, monospace);
}

/* Solve Event Toast */
.tq-heatmap-solve-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0c0e14;
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 10px;
  padding: 12px 18px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(52, 211, 153, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  pointer-events: none;
}

.tq-heatmap-solve-toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.toast-icon.prob {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.toast-icon.sim {
  background: rgba(41, 151, 255, 0.15);
  color: #38bdf8;
}

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toast-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #34d399;
  font-family: var(--font-mono, monospace);
}

.toast-desc {
  font-size: 12px;
  color: #e2e8f0;
}

.toast-streak-flame {
  font-size: 18px;
  margin-left: 8px;
}

/* ===================================================================
   INSTITUTIONAL HIGH-CONTRAST LIGHT MODE — ACTIVITY HEATMAP
   =================================================================== */
html.light-mode .tq-heatmap-card,
[data-theme="light"] .tq-heatmap-card {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03) !important;
}

html.light-mode .tq-heatmap-headline,
[data-theme="light"] .tq-heatmap-headline {
  color: #64748b !important;
}

html.light-mode .tq-heatmap-total,
[data-theme="light"] .tq-heatmap-total {
  color: #09090b !important;
}

html.light-mode .tq-heatmap-stat-box,
[data-theme="light"] .tq-heatmap-stat-box {
  background: #f8fafc !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

html.light-mode .tq-heatmap-stat-val,
[data-theme="light"] .tq-heatmap-stat-val {
  color: #09090b !important;
}

html.light-mode .tq-heatmap-stat-lbl,
[data-theme="light"] .tq-heatmap-stat-lbl {
  color: #64748b !important;
}

html.light-mode .tq-heatmap-cell[data-level="0"],
[data-theme="light"] .tq-heatmap-cell[data-level="0"] {
  background: #e2e8f0 !important;
}

html.light-mode .tq-heatmap-month,
html.light-mode .tq-heatmap-day-label,
[data-theme="light"] .tq-heatmap-month,
[data-theme="light"] .tq-heatmap-day-label {
  color: #64748b !important;
}

