/*
 * modal.css - Dialogs, their form controls, and the segmented tab bar.
 * Shared by the popup and the signing page, which previously carried two
 * divergent copies. Load after controls.css, before any page stylesheet.
 */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 10, 12, 0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
}

/* A column so only the body scrolls: the title stays put and the actions stay
   reachable, instead of the footer drifting below the fold on a long form. */
.modal-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow: hidden;
  background: var(--sd-bg);
  border: 1px solid var(--sd-line);
  border-radius: var(--sd-radius-tile);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

/* No rule under the title: the whitespace already separates it. */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 20px 22px 4px;
}

.modal-header h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--sd-fg);
}

.close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: var(--sd-radius-pill);
  background: transparent;
  color: var(--sd-fg-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.close-btn:hover {
  background: var(--sd-well);
  color: var(--sd-fg);
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 22px 4px;
}

/* Pinned: it never scrolls out of reach, and a hairline appears only when there
   is content scrolled underneath it. */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--sd-line);
  background: var(--sd-bg);
}

/* Modals whose body always fits don't need the rule. */
.modal-footer.borderless {
  border-top: none;
}

/* ---- Form controls inside dialogs -------------------------------------- */

.settings-group {
  margin-bottom: 16px;
}

/* A group whose control is more than one element. */
.settings-stack > * + * {
  margin-top: 8px;
}

.settings-group:last-child {
  margin-bottom: 0;
}

.settings-group > label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--sd-fg);
}

/* A hint is a footnote, not a second label. It gets the smallest type on the
   screen and only appears where the control cannot speak for itself. */
.settings-hint {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--sd-fg-soft);
}

.modal input[type='text'],
.modal input[type='search'],
.modal select {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--sd-chip-line);
  border-radius: 12px;
  font-family: var(--sd-display);
  font-size: 14px;
  color: var(--sd-fg);
  background: var(--sd-bg);
  box-sizing: border-box;
}

.modal input[type='text']:focus,
.modal select:focus {
  outline: none;
  border-color: var(--sd-fg);
}

/* Native arrow removed so the control matches the rest of the system. */
.modal select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b70' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* ---- Segmented tabs ---------------------------------------------------- */
/* A single control that shows which of three ways you're creating a signature,
   rather than three buttons of which one is inexplicably blue. */

.signature-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: var(--sd-radius-pill);
  background: var(--sd-well);
}

.tab-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: var(--sd-radius-pill);
  background: transparent;
  color: var(--sd-fg-soft);
  font-family: var(--sd-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-btn:hover {
  color: var(--sd-fg);
}

.tab-btn.active {
  background: var(--sd-solid);
  color: var(--sd-on-solid);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ---- Icon choice cards ------------------------------------------------- */
/* For a handful of exclusive options. Shown, not hidden behind a select. */

.choice-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 8px;
  border: 1.5px solid var(--sd-chip-line);
  border-radius: 14px;
  background: var(--sd-bg);
  color: var(--sd-fg);
  font-family: var(--sd-display);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.choice-card svg {
  width: 18px;
  height: 18px;
  color: var(--sd-fg-soft);
  transition: color 0.15s ease;
}

.choice-card:hover {
  border-color: var(--sd-fg-soft);
}

.choice-card.selected {
  border-color: var(--sd-fg);
  background: var(--sd-well);
}

.choice-card.selected svg {
  color: var(--sd-fg);
}

.choice-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Date samples read better a little tighter than the default card. */
.option-card {
  padding: 10px 12px;
}

.option-sample {
  font-size: 14px;
}
