/* SpectrArt Framer - preview panel */

#spectrart-framer.saf-panel {
  position: sticky;
  top: 90px;
  background: #fff;
  border: 1px solid #e5e1d8;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(30, 26, 20, 0.08);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #2b2722;
}

#spectrart-framer .saf-stage {
  width: 100%;
  background: #f7f5f0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#spectrart-framer canvas {
  display: block;
}

#spectrart-framer .saf-info {
  margin-top: 12px;
}

#spectrart-framer .saf-spec {
  margin: 0 0 4px;
  font-size: 13px;
  color: #3a342c;
}

#spectrart-framer .saf-dpi {
  margin: 0;
  font-size: 12.5px;
  color: #6b6459;
}

#spectrart-framer .saf-area {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: #2b2722;
}

#spectrart-framer .saf-dpi.is-warn {
  color: #9a6a00;
}

#spectrart-framer .saf-dpi.is-bad {
  color: #b3261e;
  font-weight: 600;
}

#spectrart-framer .saf-note {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: #b3261e;
}

#spectrart-framer .saf-note.is-inline {
  color: #9a6a00;
}

#spectrart-framer .saf-controls {
  margin-top: 14px;
}

#spectrart-framer .saf-controls[hidden] {
  display: none;
}

#spectrart-framer .saf-materials {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

#spectrart-framer .saf-pill {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #ddd7cb;
  background: #fff;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  color: #4a443b;
  cursor: pointer;
}

#spectrart-framer .saf-pill.is-active {
  border-color: #2b2722;
  background: #f4f1ea;
  color: #2b2722;
  font-weight: 600;
}

#spectrart-framer .saf-colors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

#spectrart-framer .saf-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border: 1px solid #e2ddd3;
  background: #fff;
  border-radius: 7px;
  font: inherit;
  cursor: pointer;
}

#spectrart-framer .saf-chip.is-active {
  border-color: #2b2722;
  box-shadow: inset 0 0 0 1px #2b2722;
}

#spectrart-framer .saf-chip-swatch {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

#spectrart-framer .saf-chip-label {
  font-size: 10.5px;
  line-height: 1.15;
  color: #5b554b;
  text-align: left;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

#spectrart-framer .saf-chip.is-active .saf-chip-label {
  color: #2b2722;
  font-weight: 600;
}

#spectrart-framer .saf-subhead {
  margin: 10px 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #6b6459;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Frame fields are driven from the panel, so hide their form UI */
form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .saf-hidden {
  display: none !important;
}

/* the gallery/washi upload-type radio is never shown; keyed by name so a form
   re-save cannot bring it back */
form:is(.fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-el-group:has(input[name="File_Type_Upload"]) {
  display: none;
}

form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .saf-area-note {
  margin: 4px 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: #2b2722;
}

/* Single-column form: pair the frame size inputs and keep numbers compact */
form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-t-cell {
  display: block !important;
}

form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-el-group:has(input[name="Frame_Short_Side_in"]),
form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-el-group:has(input[name="Frame_Long_Side_in"]),
form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-el-group:has(input[name="Frame_Short_Side_cm"]),
form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-el-group:has(input[name="Frame_Long_Side_cm"]) {
  display: inline-block;
  vertical-align: top;
  width: calc(50% - 20px) !important;
  margin-right: 16px !important;
}

form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) input[type="number"].ff-el-form-control {
  max-width: 200px;
}

/* Fluent Forms image swatches, sized for the narrowed form column */
form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .fancy-input .ff_el_checkable_photo_holders {
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)) !important;
  padding-top: 20px !important;
  padding-bottom: 20px !important;
}

form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .fancy-input .ff-el-form-check {
  width: 100% !important;
  height: auto !important;
}

form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .fancy-input label.ff-el-image-input-src {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  background-size: cover !important;
}

form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .fancy-input .ff-el-form-check-label {
  width: 100% !important;
  box-sizing: border-box;
  white-space: normal !important;
}

form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .fancy-input .ff-el-form-check-label span {
  display: block;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

@media (max-width: 849px) {
  #spectrart-framer.saf-panel {
    position: static;
    margin-bottom: 18px;
  }

  .wp-block-column:has(#spectrart-framer) {
    order: -1;
  }
}

@media (max-width: 520px) {
  form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-el-group:has(input[name="Frame_Short_Side_in"]),
  form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-el-group:has(input[name="Frame_Long_Side_in"]),
  form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-el-group:has(input[name="Frame_Short_Side_cm"]),
  form:is(.fluent_form_240, .fluent_form_194, .fluent_form_195, .fluent_form_196, .fluent_form_198, .fluent_form_197) .ff-el-group:has(input[name="Frame_Long_Side_cm"]) {
    width: 100% !important;
    margin-right: 0 !important;
  }
}
