/* Shared tool page layout (image tools, cshtml, Blazor, markdown docs) */

.tool-page,
.container > .text-left {
  width: 100%;
  padding-bottom: 2rem;
}

.tool-page > h2,
.container > .text-left > h2,
.container > .text-left > h3:first-child {
  font-size: 1.35rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.35rem;
}

.tool-lead,
.container > .text-left > p:first-of-type {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.6;
  margin: 0 0 1.25rem;
  max-width: 52rem;
}

.tool-section {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tool-section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.tool-form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #605e5c;
}

.tool-field-col {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.tool-field-col .form-control,
.tool-field-col .form-select {
  width: 100%;
}

.tool-field-narrow {
  max-width: 16rem;
}

.tool-range {
  margin-top: 0.15rem;
}

.tool-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}

.tool-btn-row.mt-section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid #f0f0f0;
}

.tool-file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  overflow: hidden;
  vertical-align: middle;
}

.tool-file-btn-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.tool-file-btn-input:disabled {
  cursor: not-allowed;
}

.tool-message {
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.tool-message--error {
  color: #a4262c;
  background: #fdf3f4;
  border: 1px solid #f1bbbc;
}

.tool-message--busy {
  color: #0078d4;
  background: #f3f9fd;
  border: 1px solid #c7e0f4;
}

.tool-message--success {
  color: #0f6b3f;
  background: #edf9f1;
  border: 1px solid #b8e6cb;
}

.pomodoro-timer-wrap {
  text-align: center;
}

.pomodoro-timer {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: #1a1a1a;
  line-height: 1.1;
}

.pomodoro-progress {
  height: 8px;
  margin: 1rem auto 0;
  max-width: 28rem;
  border-radius: 999px;
  background: #f0f0f0;
}

.pomodoro-progress .progress-bar {
  background: #0d6efd;
  border-radius: 999px;
  transition: width 0.35s linear;
}

.pomodoro-heatmap-wrap {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.pomodoro-heatmap-labels {
  border-collapse: separate;
  border-spacing: 0 3px;
  font-size: 0.7rem;
  color: #888;
  flex: 0 0 auto;
}

.pomodoro-heatmap-labels td {
  height: 12px;
  line-height: 12px;
  padding: 0;
  text-align: center;
}

.pomodoro-heatmap {
  border-collapse: separate;
  border-spacing: 3px;
  flex: 0 0 auto;
}

.pomodoro-heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
}

.pomodoro-heatmap-cell--empty {
  background: transparent;
  cursor: default;
}

.tool-preview-wrap {
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 1rem;
  background: #fafafa;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tool-preview-wrap h3,
.tool-preview-wrap .tool-preview-heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.65rem;
  color: #333;
}

.tool-checkerboard {
  background: repeating-conic-gradient(#ebebeb 0% 25%, #fff 0% 50%) 50% / 14px 14px;
  border-radius: 6px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  flex: 1;
}

.tool-checkerboard canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 手写签名绘制区：画布铺满容器宽度 */
.signature-draw-pad {
  width: 100%;
  display: block;
  padding: 0;
  overflow: hidden;
}

.signature-bordered,
.signature-preview-box {
  border: 1px solid #ced4da !important;
  border-radius: 6px;
  background: #fff;
}

.signature-preview-box {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signature-draw-pad canvas {
  width: 100%;
  max-width: none;
  height: auto;
  display: block;
  vertical-align: top;
}

.tool-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
}

.tool-radio-row .form-check {
  margin-bottom: 0;
  min-height: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tool-note {
  font-size: 0.875rem;
  color: #666;
  line-height: 1.5;
  margin: 0;
}

.tool-split-row {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* Image merge: left sidebar + right preview */
.tool-merge-page .tool-lead {
  margin-bottom: 1rem;
}

.tool-merge-workspace {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tool-merge-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tool-merge-block {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tool-merge-block-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 0.75rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #f0f0f0;
}

.tool-merge-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.tool-merge-page .form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0;
  min-height: 1.5rem;
  padding-left: 0;
  flex: 0 0 auto;
  white-space: nowrap;
  position: static;
}

.tool-merge-page .form-check-input {
  position: static;
  float: none;
  margin: 0;
  flex-shrink: 0;
}

.tool-merge-page .form-check-input[type="radio"],
.tool-merge-page .form-check-input[type="checkbox"] {
  margin-top: 0;
  margin-left: 0;
}

.tool-merge-page .form-check-label {
  line-height: 1.35;
  padding-top: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.tool-merge-option-row,
.tool-merge-check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  row-gap: 0.5rem;
}

.tool-merge-check-row .form-control-color {
  flex: 0 0 auto;
}

.tool-merge-inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: flex-end;
}

.tool-merge-inline-row .tool-field-col {
  flex: 1 1 5rem;
  min-width: 4.5rem;
}

.tool-merge-list .list-group-item {
  padding: 0.45rem 0.65rem;
}

.tool-merge-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #f0f0f0;
}

.tool-merge-actions .btn-primary {
  flex: 1 1 auto;
  min-width: 0;
}

.tool-merge-actions .btn-outline-secondary {
  flex: 0 0 auto;
}

.tool-merge-preview {
  display: flex;
  flex-direction: column;
  background: #f5f6f8;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  overflow: hidden;
  min-height: 360px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tool-merge-preview-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.tool-merge-preview-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}

.tool-merge-zoom-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

.tool-merge-zoom-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  padding: 0 0.35rem;
  font-size: 0.8125rem;
  color: #666;
  user-select: none;
}

.tool-merge-viewport {
  flex: 1;
  margin: 1rem;
  min-height: 280px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: repeating-conic-gradient(#ebebeb 0% 25%, #fff 0% 50%) 50% / 14px 14px;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.tool-merge-viewport:not(.tool-merge-viewport--empty) {
  cursor: grab;
}

.tool-merge-viewport.is-panning {
  cursor: grabbing;
}

.tool-merge-viewport--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 0.875rem;
  cursor: default;
}

.tool-merge-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.tool-merge-stage canvas {
  display: block;
  max-width: none;
  width: auto;
  height: auto;
}

.tool-merge-viewport-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  color: #666;
  font-size: 0.875rem;
  pointer-events: none;
  z-index: 2;
}

.tool-merge-viewport-hint {
  position: absolute;
  left: 0.65rem;
  bottom: 0.45rem;
  font-size: 0.75rem;
  color: #888;
  pointer-events: none;
  z-index: 1;
  user-select: none;
}

@media (min-width: 992px) {
  .tool-split-row {
    flex-direction: row;
    align-items: stretch;
  }

  .tool-split-row > .tool-preview-col {
    flex: 1;
    min-width: 0;
  }

  .tool-merge-workspace {
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    min-height: min(720px, calc(100vh - 11rem));
  }

  .tool-merge-sidebar {
    flex: 0 0 340px;
    width: 340px;
    max-height: min(720px, calc(100vh - 11rem));
    overflow-y: auto;
    padding-right: 0.75rem;
    scrollbar-width: thin;
  }

  .tool-merge-preview {
    flex: 1;
    min-width: 0;
    border-radius: 8px;
    min-height: min(720px, calc(100vh - 11rem));
  }

  .tool-merge-viewport {
    min-height: 0;
  }
}

/* Markdown reference / About pages */
.tool-doc.markdown-body {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Legacy cshtml tool panels */
.container > .text-left > .JsonConvert,
.container > .text-left > .QrCode-Content,
.container > .text-left > .color-content,
.tool-page > .JsonConvert,
.tool-page > .QrCode-Content {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.container > .text-left .form-control,
.container > .text-left .form-select,
.container > .text-left textarea,
.tool-page .form-control,
.tool-page .form-select,
.tool-page textarea {
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: #fff;
}

.tool-page .form-control:focus,
.tool-page .form-select:focus,
.tool-page textarea:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.tool-page .tool-color-input {
  width: 100%;
  max-width: 8rem;
  height: 2.5rem;
  padding: 0.2rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: #fff;
}

.container > .text-left .btn,
.tool-page .btn {
  border-radius: 6px;
}

.container > .text-left .table,
.tool-page .table {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

/* CheckUrl and similar Blazor forms without tool-page sections */
.tool-page.div-input,
.container > .div-input.tool-page {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tool-page.div-input strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.tool-page.div-input .ip-colorvalue {
  max-width: 100%;
  width: min(100%, 480px);
  margin-bottom: 0.75rem;
}

.tool-page.div-input button {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Fluent UI tool pages */
.tool-page fluent-grid {
  width: 100%;
}

.tool-page fluent-button {
  margin-right: 0.35rem;
}

/* Simple Blazor pages with only a heading */
.container > h3:first-child {
  font-size: 1.35rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.75rem;
}

.container > .container.tool-page {
  width: 100%;
  max-width: 100%;
  padding-left: 0;
  padding-right: 0;
}
