/* activity-heatmap.css -- Activity heatmap widget */

.activity-heatmap-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 6px 12px 8px 12px;
  display: flex;
  flex-direction: column;
}

.activity-heatmap-grid {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.ahm-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  cursor: default;
}

.ahm-day-label {
  width: 28px;
  font-size: 9px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
  white-space: nowrap;
  user-select: none;
}

.ahm-month-label {
  font-size: 9px;
  color: var(--text-faint);
  overflow: visible;
  white-space: nowrap;
  display: flex;
  align-items: flex-end;
  padding-bottom: 3px;
  user-select: none;
}

/* Intensity levels -- dark theme */
.ahm-cell.level-0      { background: var(--bg-elevated); }
.ahm-cell.level-1      { background: rgba(74, 222, 128, 0.2); }
.ahm-cell.level-2      { background: rgba(74, 222, 128, 0.45); }
.ahm-cell.level-3      { background: rgba(74, 222, 128, 0.7); }
.ahm-cell.level-4      { background: rgba(74, 222, 128, 1.0); }
.ahm-cell.level-future { background: transparent; }

/* Red intensity levels -- dark theme */
.ahm-cell.level-r1 { background: rgba(248, 113, 113, 0.2); }
.ahm-cell.level-r2 { background: rgba(248, 113, 113, 0.45); }
.ahm-cell.level-r3 { background: rgba(248, 113, 113, 0.7); }
.ahm-cell.level-r4 { background: rgba(248, 113, 113, 1.0); }

/* Red intensity levels -- light theme */
body.light .ahm-cell.level-r1 { background: rgba(185, 28, 28, 0.15); }
body.light .ahm-cell.level-r2 { background: rgba(185, 28, 28, 0.35); }
body.light .ahm-cell.level-r3 { background: rgba(185, 28, 28, 0.6); }
body.light .ahm-cell.level-r4 { background: rgba(185, 28, 28, 0.9); }

/* Orange intensity levels (B grade) -- dark theme */
.ahm-cell.level-o1 { background: rgba(249, 115, 22, 0.2); }
.ahm-cell.level-o2 { background: rgba(249, 115, 22, 0.45); }
.ahm-cell.level-o3 { background: rgba(249, 115, 22, 0.7); }
.ahm-cell.level-o4 { background: rgba(249, 115, 22, 1.0); }

/* Orange intensity levels (B grade) -- light theme */
body.light .ahm-cell.level-o1 { background: rgba(154, 52, 18, 0.15); }
body.light .ahm-cell.level-o2 { background: rgba(154, 52, 18, 0.35); }
body.light .ahm-cell.level-o3 { background: rgba(154, 52, 18, 0.6); }
body.light .ahm-cell.level-o4 { background: rgba(154, 52, 18, 0.9); }

/* Today indicator */
.ahm-cell.ahm-today { box-shadow: 0 0 0 0.5px var(--today); }

/* Light theme overrides */
body.light .ahm-cell.level-0      { background: var(--bg-elevated); }
body.light .ahm-cell.level-1      { background: rgba(21, 128, 61, 0.15); }
body.light .ahm-cell.level-2      { background: rgba(21, 128, 61, 0.35); }
body.light .ahm-cell.level-3      { background: rgba(21, 128, 61, 0.6); }
body.light .ahm-cell.level-4      { background: rgba(21, 128, 61, 0.9); }
body.light .ahm-cell.level-future { background: transparent; }

/* Tooltip */
.ahm-tooltip {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  pointer-events: none;
  z-index: 50;
  white-space: pre-line;
  display: none;
}
.ahm-tooltip.visible { display: block; }

/* Legend (in widget handle) */
.ahm-legend {
  display: flex;
  align-items: center;
  gap: 3px;
}
.ahm-legend .ahm-cell {
  width: 10px;
  height: 10px;
  display: inline-block;
}
.ahm-legend-text {
  font-size: 9px;
  color: var(--text-faint);
  user-select: none;
  margin: 0 2px;
}

/* Height is fixed (minH === maxH) -- show horizontal-only resize cursor */
#widget-activity-heatmap .ui-resizable-se { cursor: e-resize; }

/* Handle right group */
.ahm-handle-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Gear button */
.ahm-gear-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  border-radius: 3px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.ahm-gear-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

/* Settings dropdown */
.ahm-settings-dropdown {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 200px;
  max-width: 280px;
  z-index: 40;
  box-shadow: var(--shadow-sm);
  padding: 4px 0;
}
.ahm-settings-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.ahm-settings-icon {
  font-size: 0.875rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.ahm-settings-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ahm-settings-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 1rem;
  padding: 0 2px;
  border-radius: 3px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.ahm-settings-remove:hover {
  color: var(--red);
  background: var(--red-bg);
}
.ahm-settings-trash--armed,
.ahm-settings-trash--armed:hover {
  color: var(--red);
  background: var(--red-bg);
}

/* Per-source visibility toggle (eye / eye-off) */
.ahm-settings-eye {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s, background 0.15s, opacity 0.15s;
}
.ahm-settings-eye:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}
.ahm-settings-eye--off {
  opacity: 0.55;
}
.ahm-settings-eye--off:hover {
  opacity: 1;
}
.ahm-settings-eye svg {
  width: 14px;
  height: 14px;
}
.ahm-settings-footer {
  padding: 5px 10px 3px;
  font-size: 0.75rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

/* TRACKED section grouping: checklist name as header, per-item rows beneath */
.ahm-settings-group-header {
  padding-top: 4px;
  padding-bottom: 4px;
}
.ahm-settings-group-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ahm-settings-group-item {
  padding-left: 18px;
}

/* Frozen (archived) source rows in the gear settings menu */
.ahm-settings-item--frozen {
  opacity: 0.65;
  transition: opacity 0.15s;
}
.ahm-settings-item--frozen:hover {
  opacity: 1;
}
.ahm-settings-history-divider {
  border-top: 1px solid var(--border);
  margin: 0.4rem 0 0.2rem;
  padding: 0 10px;
  display: flex;
  align-items: center;
}
.ahm-settings-history-divider span {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 0.3rem;
}

.ahm-goal-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ahm-goal-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.ahm-goal-btn:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.ahm-goal-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.ahm-goal-value {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  min-width: 12px;
  text-align: center;
  user-select: none;
}

/* Mode toggle */
.ahm-mode-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 4px;
}

.ahm-mode-btn {
  flex: 1;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.75rem;
  color: var(--text-faint);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ahm-mode-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.ahm-mode-btn--active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

.ahm-mode-separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2px 0;
}

/* Per-instance tradelog on/off toggle button in the gear dropdown */
.ahm-settings-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text-faint);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ahm-settings-toggle:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}
.ahm-settings-toggle--on {
  color: var(--green);
  border-color: var(--green);
}
.ahm-settings-toggle--on:hover {
  background: rgba(74, 222, 128, 0.1);
}
