@import url("./habit-modal.css");

.habits-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.month-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 82px;
  text-align: center;
}

.habits-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.habits-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.habits-board {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.habits-chart-wrap {
  display: flex;
  align-items: stretch;
  padding: 16px 12px 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.habits-chart-spacer {
  width: 152px;
  flex-shrink: 0;
}

.habits-chart {
  flex: 1;
  min-width: 0;
  height: 110px;
  display: block;
}

.chart-axis-text {
  font-size: 10.5px;
  fill: var(--text-secondary);
}

.chart-grid-line {
  stroke: var(--border-subtle);
  stroke-dasharray: 2 3;
}

.habits-matrix-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}

.habits-matrix {
  width: 100%;
}

.matrix-header-row,
.matrix-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-subtle);
}

.matrix-row:last-child {
  border-bottom: none;
}

.matrix-corner,
.matrix-habit-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 152px;
  flex-shrink: 0;
  background: var(--bg-base);
  border-right: 1px solid var(--border-subtle);
  padding: 8px 10px;
}

.matrix-corner {
  display: flex;
  align-items: flex-end;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.matrix-habit-cell {
  border-top: none;
  border-bottom: none;
  border-left: none;
  text-align: left;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.matrix-habit-cell:hover {
  background: var(--bg-elevated);
}

.matrix-habit-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matrix-habit-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.matrix-habit-progress .progress-track {
  display: block;
  flex: 1;
  height: 5px;
}

.matrix-habit-progress .progress-fill {
  display: block;
}

.matrix-habit-progress small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.matrix-header-days {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 4px;
}

.matrix-weeks,
.matrix-days,
.matrix-dots {
  display: grid;
  gap: 1px;
  align-items: center;
}

.matrix-dots {
  flex: 1;
  min-width: 0;
  padding: 8px;
}

.matrix-week-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding-left: 2px;
  white-space: nowrap;
}

.matrix-day-head {
  text-align: center;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.matrix-day-head span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.matrix-day-head small {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.matrix-day-head.is-today span,
.matrix-day-head.is-today small {
  color: var(--accent-primary);
  font-weight: 700;
}

.matrix-dot {
  width: 18px;
  height: 18px;
  margin: 0 auto;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-base);
  color: var(--bg-base);
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 100ms ease, background-color 120ms ease, border-color 120ms ease;
}

.matrix-dot:hover:not(:disabled) {
  border-color: var(--accent-primary);
  transform: scale(1.08);
}

.matrix-dot:disabled {
  opacity: 0.3;
  cursor: default;
}

.matrix-dot.is-today {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.matrix-dot.is-done {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--bg-base);
}

.matrix-dot.is-relapse {
  background: rgba(239, 68, 68, 0.24);
  border-color: var(--status-danger);
  border-width: 1.5px;
}
