/* ==========================================================================
   SOFTBOOK AI — IMAGE COMPOSER (page layer)
   Extracted from the inline <style> in create-image.html so the standalone
   page and the studio workspace share one copy. Loads after create-image.css.
   ========================================================================== */

    /* ----------------------------------------------------------------
       Dropdowns. create-image.css leaves <select> flush against its own
       text, and the native arrow disappears once the chip sets a
       transparent background — so pad it and draw the chevron here. This
       is the same fix create-video.html carries; the two pages share the
       chip rail markup but not its stylesheet.
       ---------------------------------------------------------------- */
    .composer-rail .chip select,
    .chip select {
      appearance: none;
      -webkit-appearance: none;
      padding: 6px 26px 6px 10px;
      border: 0;
      border-radius: 8px;
      background-color: transparent;
      color: inherit;
      font: inherit;
      line-height: 1.4;
      cursor: pointer;
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23a0a6b2'><path d='M4.6 6.2 8 9.6l3.4-3.4 1.1 1.1L8 11.8 3.5 7.3z'/></svg>");
      background-repeat: no-repeat;
      background-position: right 8px center;
      background-size: 12px;
    }

    /* ----------------------------------------------------------------
       UPLOAD SLOTS

       One row per slot: thumbnail left, label and action right. The old
       version was a full tile per slot with a heading, a rule, a
       full-width button and a 190px preview — the footprint of a real
       step for what is a single decision, and it pushed the prompt off
       the first screen on a laptop.

       The thumbnail IS the button. A separate "Choose from gallery"
       control next to an empty square asks which one to press.
       ---------------------------------------------------------------- */
    .ci-uploads {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      padding: 0 var(--sb-gap, 16px) 12px;
    }

    /* Kept as a block: image-form.js sets .style.display = "block" on
       these in ten places, so the flex layout lives on the row inside
       rather than on the box itself. */
    .ci-upload { flex: 1 1 240px; min-width: 0; }

    .ci-upload-row {
      display: flex;
      align-items: center;
      gap: 11px;
	  margin-top: 13px !important;
      padding: 8px;
      border-radius: var(--sb-r-md);
      background: var(--sb-fill-2);
      border: 1px solid var(--sb-line);
      transition: border-color 160ms ease;
    }
    .ci-upload-row:hover { border-color: var(--sb-violet); }

    .ci-upload-thumb {
      position: relative;
      flex: 0 0 56px;
      width: 56px;
      height: 56px;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px dashed var(--sb-line-strong);
      border-radius: 10px;
      background: var(--sb-fill-1, rgba(127,127,127,.06));
      color: var(--sb-text-dim);
      cursor: pointer;
      overflow: hidden;
      -webkit-tap-highlight-color: transparent;
    }
    .ci-upload-thumb img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .ci-upload-thumb i { display: block; font-size: 17px; line-height: 1; vertical-align: 0; }
    /* Once a picture is in, the plus has nothing left to say. */
    .ci-upload-thumb img:not(.d-none) ~ i { display: none; }
    .ci-upload-thumb:has(img:not(.d-none)) { border-style: solid; }

    .ci-upload-copy { min-width: 0; }
    .ci-upload-label {
      display: block;
      font-size: .82rem;
      font-weight: 600;
      margin: 0;
      line-height: 1.3;
    }
    .ci-upload-copy .custom-note { font-size: .7rem; line-height: 1.35; }
    .ci-upload-cta {
      display: block;
      font-size: .72rem;
      color: var(--sb-violet);
      margin-top: 2px;
    }

    @media (max-width: 575.98px) {
      .ci-uploads { padding-left: 14px; padding-right: 14px; }
      .ci-upload { flex: 1 1 100%; }
    }

    /* ----------------------------------------------------------------
       Character counters. Both fields already carried a maxlength, so the
       browser silently stopped accepting keystrokes at the ceiling — which
       reads as a broken keyboard rather than as a limit. Stating the
       number turns it into a rule instead of a surprise.
       ---------------------------------------------------------------- */
    .char-count {
      margin-top: 4px;
      text-align: right;
      font-size: .7rem;
      font-variant-numeric: tabular-nums;
      color: var(--sb-text-dim);
      transition: color 160ms ease;
    }
    .char-count.is-near { color: #ffb74d; }
    .char-count.is-full { color: #ff6b6b; font-weight: 600; }
    /* ----------------------------------------------------------------
       Title field. It sits between the settings rail and the description
       box, so it gets a divider above it and enough room to read as a
       question rather than another chip. The horizontal padding matches
       .composer-body in create-image.css so the title input and the
       description box below it share one left edge.
       ---------------------------------------------------------------- */
    .composer-body.ci-title-row {
      padding: 14px 16px 2px;
      margin-top: 0;
      border-top: 1px solid var(--sb-line);
    }
    .ci-title-row .form-label {
      display: block;
      margin-bottom: 7px;
      font-size: .8125rem;
      font-weight: 600;
    }
    .ci-title-row #title {
      padding: 11px 14px;
      border-radius: var(--sb-r-md);
      font-size: .9375rem;
    }
    .ci-title-row .sb-hint { display: block; margin-top: 6px; }

    @media (max-width: 575.98px) {
      .composer-body.ci-title-row { padding: 12px 12px 2px; }
    }

/* ==========================================================================
   BULK + A SECOND IMAGE
   In bulk, the first uploader is replaced by the multi-select grid, but a
   second box — the design reference, or the other half of a merge — is a
   single constant applied to every job, so it stays.

   Hidden with a class rather than style.display because
   configureUploadStepInner owns that property; writing it here would leave
   the box hidden after switching back to single.
   ========================================================================== */
#upload_images.bulk-mode #uploadBox1 { display: none !important; }

/* With only one box left the heading is misleading, so it names the job. */
#upload_images.bulk-mode .ci-uploads::before {
  content: "Applied to every image in the batch";
  display: block;
  margin-bottom: 10px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sb-text-faint);
}
