/* ============================================================================
   Print Settings modal styles. Re-uses the global .modal / .modal-overlay /
   .input-field shell from styles.css/theme.css so it inherits dark-mode
   colours automatically. Adds layout for the section blocks, toggle rows,
   colour pickers and range sliders.
   ============================================================================ */

.print-settings-modal { max-width: 720px; width: 92vw; }
.print-settings-modal .modal-body { max-height: calc(85vh - 80px); overflow-y: auto; }

.ps-intro {
  color: var(--text-secondary);
  font-size: 0.86rem;
  margin-bottom: 18px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}

.ps-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-primary);
}
.ps-section:last-of-type { border-bottom: none; }

.ps-section-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ps-hint {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin: -4px 0 10px;
}

/* Toggle rows — checkbox + label chips that wrap nicely on narrow screens. */
.ps-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.ps-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}
.ps-toggle:hover { border-color: var(--accent); }
.ps-toggle input { margin: 0; cursor: pointer; accent-color: var(--accent); }
.ps-toggle:has(input:checked) {
  background: rgba(229, 33, 33, 0.08);
  border-color: var(--accent);
  color: var(--text-primary);
  font-weight: 600;
}

/* Native colour input — squared rather than the OS default. */
.ps-color {
  width: 100%;
  height: 38px;
  padding: 2px;
  cursor: pointer;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
}
.ps-color::-webkit-color-swatch-wrapper { padding: 0; }
.ps-color::-webkit-color-swatch { border: none; border-radius: 4px; }
.ps-color::-moz-color-swatch { border: none; border-radius: 4px; }

/* Range sliders for opacity / size / font-size. */
.ps-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.ps-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.ps-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  cursor: pointer;
}
.ps-slider-val {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  margin-left: 6px;
}

.ps-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-primary);
}

/* ----------------------------------------------------------------------------
   Gear icon button — used in every module's toolbar to open the modal.
   ---------------------------------------------------------------------------- */
.btn-print-settings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-print-settings:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--accent);
}
.btn-print-settings.btn-icon-square {
  width: 36px; height: 36px;
  padding: 0;
  justify-content: center;
  font-size: 1.05rem;
}

@media (max-width: 600px) {
  .ps-toggle-row { gap: 6px; }
  .ps-toggle { padding: 6px 10px; font-size: 0.8rem; }
  .ps-actions { flex-direction: column; align-items: stretch; }
  .ps-actions > div { display: none; }  /* the spacer */
}

/* ============================================================================
   Module Settings popover — opens beneath the ⚙️ button in each module.
   Positioned absolutely by JS via .style.top/.left.
   ============================================================================ */
.module-settings-menu {
  position: fixed;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.35), 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 6px;
  z-index: 9000;
  display: none;
  animation: msMenuIn 0.16s ease-out;
}
.module-settings-menu.open { display: block; }

@keyframes msMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.module-settings-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}
.module-settings-item:hover,
.module-settings-item:focus-visible {
  background: var(--bg-input);
  outline: none;
}
.msi-icon {
  flex-shrink: 0;
  font-size: 1.15rem;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}
.module-settings-item:hover .msi-icon { background: var(--bg-card); }
.msi-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.msi-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}
.msi-hint {
  font-size: 0.74rem;
  color: var(--text-tertiary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msi-chev {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 1.1rem;
  font-weight: 300;
  transition: transform var(--transition-fast);
}
.module-settings-item:hover .msi-chev { color: var(--accent); transform: translateX(2px); }

@media (max-width: 480px) {
  .module-settings-menu { width: calc(100vw - 32px); }
}
