/*
 * Shared UI pieces used by more than one tool page: round icon buttons,
 * control rows, color swatches, the slider, and the bottom-sheet modal.
 * Load after theme.css and before the page's own stylesheet.
 */

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sundial-text);
  border: none;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.control-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--sundial-accent);
  height: 24px;
}

.swatch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--sundial-text-muted);
  cursor: pointer;
  padding: 0;
}

.swatch.selected {
  outline: 2px solid var(--sundial-accent);
  outline-offset: 2px;
}

/*
 * Chrome's native color-input swatch is drawn from its own internal shadow
 * DOM (::-webkit-color-swatch-wrapper / ::-webkit-color-swatch), and no
 * amount of border-radius/overflow clipping on the host element fully
 * suppresses the sliver of its own default background at the rounded edge,
 * most visible against black. So the native input is made fully invisible
 * here and only used as a click target + value holder; the circle the user
 * actually sees is a plain sibling span with no browser-internal styling to
 * fight, kept in sync with the input's value from JS.
 */
.color-swatch-picker {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.color-swatch-preview {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--sundial-text-muted);
  pointer-events: none;
}

.color-swatch-picker input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.swatch-row .color-swatch-picker {
  margin-left: auto;
}

/* Setup checklist modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  background: #0d0d0d;
  border-radius: 20px 20px 0 0;
  padding: 24px;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
  }
  .modal-sheet {
    border-radius: 20px;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.modal-done {
  background: none;
  border: none;
  color: var(--sundial-accent);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.checklist {
  background: var(--sundial-ink);
  border-radius: var(--sundial-radius);
  overflow: hidden;
}

.checklist-item {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.checklist-item h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.checklist-item p {
  margin: 0;
  font-size: 13px;
  color: var(--sundial-text-muted);
  line-height: 1.4;
}

.modal-footer-note {
  margin: 16px 4px 0;
  font-size: 12px;
  color: var(--sundial-text-muted);
  opacity: 0.7;
  line-height: 1.4;
}
