/* ==========================================================================
   TOOL BLOCK START - signature-resize
   signatureresize.css - Signature Resizer for UnitConverterTool.com
   Silo: Image Tools. Accent #4a90ff, hover #3a7fee.
   Built from tool-build.md sections 1, 3, 3b, 3d-crop, 3e and 3h-cloud.

   NOTE FOR ANYONE PORTING FROM A SIBLING GOVERNMENT ID TOOL: the two portrait
   alignment-overlay classes those tools add to the closed set are deliberately
   ABSENT from this file. They draw alignment rules across a portrait ID crop.
   Nothing on this page is a portrait ID crop, so those rules would be
   meaningless here and the dead CSS was left out rather than carried across.
   ========================================================================== */

/* --------------------------------------------------------------------------
   3a. ROOT AND HEADING
   -------------------------------------------------------------------------- */

.uct-tool {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
  font-family: 'DM Sans', sans-serif;
  color: #e5e7eb;
  /* NEVER set a background here. The page is already #0A0F1C. */
}
.uct-tool_heading { text-align: center; margin-bottom: 28px; }
.uct-tool_heading h1 {
  font-size: 32px; font-weight: 700; color: #fff; margin: 0 0 10px;
}
.uct-tool_description {
  font-size: 15px; color: #9ca3af; margin: 0; line-height: 1.6;
}

/* --------------------------------------------------------------------------
   3b. LAYOUT
   -------------------------------------------------------------------------- */

.uct-tool-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}
/* min-width: 0 lets the columns shrink below their content's min size. Without
 * it, Cropper's fixed-width container holds the grid column open on a window
 * resize or a phone rotation, and the stage can never shrink back down. */
.uct-tool-main, .uct-tool-sidebar { min-width: 0; }
@media (max-width: 1024px) {
  .uct-tool-layout { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   3c. UPLOAD AREA
   -------------------------------------------------------------------------- */

.uct-upload-area {
  background: #1a1f2e;
  border: 2px dashed #3a4258;
  border-radius: 12px;
  padding: 40px 24px;
  text-align: center;
  transition: border-color .2s ease, background .2s ease;
}
.uct-upload-area.drag-over {
  border-color: #4a90ff;
  background: #1e2538;
}
.uct-upload-area h3 {
  font-size: 18px; font-weight: 600; color: #e5e7eb; margin: 16px 0 6px;
}
.uct-upload-area p { font-size: 14px; color: #9ca3af; margin: 0 0 14px; }
.upload-icon svg { stroke: #4a90ff; }
.uct-hidden-input { display: none; }
.uct-tool_drop-text { font-size: 13px; color: #6b7280; margin-top: 14px; }

.uct-trust-strip {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid #2a3348;
}
.uct-trust-strip span { font-size: 12px; color: #9ca3af; }

/* WCAG AA. #6b7280 is only 3.96:1 on #0A0F1C and fails. */
.uct-helper-text { font-size: 13px; color: #9ca3af; margin: 10px 0 0; }

/* --------------------------------------------------------------------------
   3d. CLOUD SPLIT BUTTON
   -------------------------------------------------------------------------- */

.uct-dropdown-container { position: relative; display: inline-block; }
.uct-split-btn-group { display: flex; }

.uct-btn-main {
  background: #4a90ff; color: #fff; border: none;
  padding: 12px 22px; border-radius: 8px 0 0 8px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; min-height: 44px; transition: background .15s ease;
}
.uct-btn-main:hover { background: #3a7fee; }

.uct-btn-arrow {
  background: #4a90ff; color: #fff;
  border: none; border-left: 1px solid rgba(255,255,255,.2);
  padding: 12px 14px; border-radius: 0 8px 8px 0;
  cursor: pointer; min-height: 44px; display: flex; align-items: center;
}
.uct-btn-arrow:hover { background: #3a7fee; }

.uct-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 220px; background: #252d3f; border: 1px solid #3a4258;
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 30; overflow: hidden;
}
.uct-dropdown-menu.show { display: block; }

.uct-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; min-height: 44px;     /* Apple HIG minimum */
  font-size: 14px; color: #e5e7eb; cursor: pointer;
  transition: background .12s ease;
}
.uct-dropdown-item:hover { background: #1e2538; }
.uct-dropdown-item svg { flex-shrink: 0; }

/* --------------------------------------------------------------------------
   3d-crop. CROP STAGE
   -------------------------------------------------------------------------- */

.uct-crop-stage {
  background: #1a1f2e; border: 1px solid #3a4258; border-radius: 12px;
  padding: 12px; overflow: hidden;
}
.uct-crop-stage.drag-over { border-color: #4a90ff; background: #1e2538; }

/* REQUIRED. Cropper's initContainer() measures parentNode.offsetWidth, which is
   the BORDER box, so it swallows the stage's padding and border and builds a
   container 26px wider than the space it has. On a portrait crop the overhang
   is empty; on a landscape crop the right edge of the image and the crop box
   are clipped, and the user can drag into a strip they cannot see. This
   padding-free, border-free wrapper is what Cropper measures instead.
   EVERY crop on this page is landscape or square, so this is load-bearing. */
.uct-crop-frame { position: relative; padding: 0; border: 0; font-size: 0; }

/* Direct child. Cropper moves the img inside .cropper-canvas on init, so this
   rule sizes the frame BEFORE Cropper measures it and stops applying after,
   which is exactly what you want. A descendant selector would also hit the
   clones Cropper builds for its preview boxes. */
.uct-crop-frame > img {
  display: block; max-width: 100%;
  max-height: 520px;            /* Cropper sizes its container from this */
}
.uct-crop-stage:focus { outline: none; }
.uct-crop-stage:focus-visible { outline: 2px solid #4a90ff; outline-offset: 2px; }

/* Batch file switcher. Rendered only when more than one file is loaded. */
.uct-crop-filmstrip {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 12px 2px 4px; margin-top: 10px; border-top: 1px solid #2a3348;
}
.uct-crop-thumb {
  flex: 0 0 auto; width: 56px; height: 56px; padding: 0;
  background: #252d3f; border: 2px solid #3a4258; border-radius: 8px;
  overflow: hidden; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s ease;
}
.uct-crop-thumb img { display: block; max-width: 100%; max-height: 100%; }
.uct-crop-thumb:hover  { border-color: #4a90ff; }
.uct-crop-thumb.active { border-color: #4a90ff; }
.uct-crop-thumb:focus-visible { outline: 2px solid #4a90ff; outline-offset: 2px; }

/* CROPPER THEME OVERRIDE. Cropper defaults to #39f, which is not our accent.
 * The lazy <link> is appended to document.head at runtime, so it lands AFTER
 * this file in the cascade. #signature-resize .cropper-point (0,1,1) still
 * beats .cropper-point (0,1,0) on specificity, so these win with zero
 * !important. */
#signature-resize .cropper-view-box  { outline: 1px solid #4a90ff; outline-color: #4a90ff; }
#signature-resize .cropper-line,
#signature-resize .cropper-point     { background-color: #4a90ff; }
#signature-resize .cropper-line      { opacity: .5; }
#signature-resize .cropper-point     { width: 12px; height: 12px; opacity: 1; }  /* touch */
#signature-resize .cropper-point.point-se { width: 14px; height: 14px; }
#signature-resize .cropper-modal     { background-color: #000; opacity: .62; }
#signature-resize .cropper-dashed    { border-color: rgba(255,255,255,.32); }
#signature-resize .cropper-center::before,
#signature-resize .cropper-center::after { background-color: #4a90ff; }

/* --------------------------------------------------------------------------
   3e. OPTIONS PANEL, TABS, PRESETS, TYPED INPUTS AND THE INK SLIDER
   -------------------------------------------------------------------------- */

.uct-options-panel {
  background: #1a1f2e; border: 1px solid #3a4258; border-radius: 12px;
  overflow: hidden;
}
.uct-options-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; min-height: 44px; cursor: pointer; user-select: none;
}
.uct-options-toggle-left {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: #e5e7eb;
}
.uct-options-toggle-arrow { color: #9ca3af; transition: transform .2s ease; }
.uct-options-panel.collapsed .uct-options-toggle-arrow { transform: rotate(-90deg); }

/* Live state badge. Shows the preset, the size and the KB rule when collapsed. */
.uct-options-summary { font-size: 12px; font-weight: 400; color: #9ca3af; }

.uct-options-body {
  max-height: 2000px; overflow: hidden;
  transition: max-height .25s ease, padding .25s ease;
  padding: 0 18px 18px;
}
.uct-options-panel.collapsed .uct-options-body {
  max-height: 0; padding-top: 0; padding-bottom: 0;
}

.uct-options-section { padding-top: 16px; }
.uct-options-section + .uct-options-section {
  margin-top: 16px; border-top: 1px solid #2a3348;
}
.uct-options-section-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: #9ca3af;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px;
}

/* TABS - the single / three-stack mode toggle */
.uct-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.uct-tab {
  flex: 1; min-width: 70px; min-height: 44px;   /* 44px is not optional */
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: #252d3f; border: 1px solid #3a4258; border-radius: 8px;
  padding: 10px 12px; font-family: inherit; font-size: 13px; font-weight: 600;
  color: #9ca3af; cursor: pointer; transition: all .15s ease;
}
.uct-tab:hover  { border-color: #4a90ff; color: #e5e7eb; }
.uct-tab.active { background: #4a90ff; border-color: #4a90ff; color: #fff; }
.uct-tab:focus-visible { outline: 2px solid #4a90ff; outline-offset: 2px; }

/* SUB-PANELS - the stack canvas fields and the custom size fields */
.uct-subpanel { display: none; margin-top: 14px; }
.uct-subpanel.active { display: block; }
.uct-subpanel-title { font-size: 13px; font-weight: 600; color: #e5e7eb; margin-bottom: 10px; }

/* NUMBER INPUT ROW. flex-wrap is here because this row carries THREE fields,
 * not the usual two, and 3 x 44px plus gaps is a tight fit in a 360px sidebar.
 * Without it a long label can push the third field out of the panel. */
.uct-input-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.uct-input-group { flex: 1; min-width: 88px; }
.uct-input-group label {
  display: block; font-size: 12px; color: #9ca3af; margin-bottom: 5px;
}

/* .uct-input-field is used TWICE on this page: by the typed size fields above,
 * and by the URL box that cloud-handlers.js injects into its import modal.
 * cloud-handlers.js hardcodes the class name, so this rule is required, not
 * optional. Without it that box renders as a 21px white browser default inside
 * a dark modal, well under the 44px tap target. */
.uct-input-group input,
.uct-input-field {
  width: 100%; box-sizing: border-box;
  background: #1e2538; border: 1px solid #3a4258; border-radius: 6px;
  padding: 10px 12px; min-height: 44px;
  font-family: inherit; font-size: 14px; color: #e5e7eb;
}
.uct-input-group input:focus,
.uct-input-field:focus { outline: none; border-color: #4a90ff; }

/* SLIDER. The JS sets --uct-fill to the thumb percentage; the gradient below
 * READS it, so the track left of the thumb is accent and the right is grey.
 * The runnable-track and range-track MUST stay transparent, or they paint over
 * the gradient and the fill disappears. */
.uct-slider-row { display: flex; align-items: center; gap: 14px; }
.uct-slider-track {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px; outline: none; cursor: pointer;
  background: linear-gradient(to right,
      #4a90ff 0%, #4a90ff var(--uct-fill, 0%),
      #3a4258 var(--uct-fill, 0%), #3a4258 100%);
}
.uct-slider-track::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: transparent; }
.uct-slider-track::-moz-range-track            { height: 6px; border-radius: 3px; background: transparent; }
.uct-slider-track::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%; background: #4a90ff;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); cursor: pointer;
}
.uct-slider-track::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: #4a90ff;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); cursor: pointer;
}
.uct-slider-track:focus-visible { outline: 2px solid #4a90ff; outline-offset: 4px; }
.uct-slider-value {
  min-width: 44px; text-align: right; font-size: 14px; font-weight: 600; color: #e5e7eb;
}
.uct-slider-labels {
  display: flex; justify-content: space-between;
  font-size: 12px; color: #6b7280; margin-top: 6px;
}

/* PRESET CARDS */
.uct-preset-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px;
  margin-top: 12px;
}
.uct-preset-card {
  background: #252d3f; border: 1px solid #3a4258; border-radius: 8px;
  padding: 10px; text-align: center; cursor: pointer; transition: all .15s ease;
}
.uct-preset-card:hover     { border-color: #4a90ff; }
.uct-preset-card.selected  { background: #1e2538; border-color: #4a90ff; }
.uct-preset-card:focus-visible { outline: 2px solid #4a90ff; outline-offset: 2px; }
.uct-preset-name { font-size: 13px; font-weight: 600; color: #e5e7eb; }
.uct-preset-dims { font-size: 11px; color: #6b7280; margin-top: 2px; }

/* --------------------------------------------------------------------------
   3f. ACTIONS
   -------------------------------------------------------------------------- */

.uct-action-btn-primary {
  width: 100%; margin-top: 14px; min-height: 52px;
  background: #1a2542; color: #fff;
  border: 1px solid #4a90ff; border-radius: 10px;
  font-family: inherit; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: background .15s ease;
}
.uct-action-btn-primary:hover:not(:disabled) { background: #222f52; }
.uct-action-btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* Busy state. The JS adds this class while work is running. */
.uct-action-btn-primary.is-busy { pointer-events: none; opacity: .7; }
.uct-action-btn-primary.is-busy::after {
  content: ''; display: inline-block; margin-left: 10px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: uct-spin .7s linear infinite; vertical-align: middle;
}
@keyframes uct-spin { to { transform: rotate(360deg); } }

.uct-controls-area {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 22px 0;
}
.uct-action-btn {
  background: #4a90ff; color: #fff; border: none; border-radius: 8px;
  padding: 12px 22px; min-height: 44px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.uct-action-btn:hover:not(:disabled) { background: #3a7fee; }
.uct-action-btn:disabled { opacity: .5; cursor: not-allowed; }

.uct-secondary-btn, .uct-rerun-btn {
  background: transparent; color: #9ca3af;
  border: 1px solid #3a4258; border-radius: 8px;
  padding: 12px 22px; min-height: 44px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.uct-secondary-btn:hover, .uct-rerun-btn:hover { border-color: #4a90ff; color: #e5e7eb; }

/* STICKY PRIMARY ACTION ON MOBILE. position: fixed, not sticky: a sticky
 * element only sticks within its own scroll container, and the sidebar ends
 * long before the viewport does. Only once there is something to act on. */
@media (max-width: 768px) {
  .uct-tool.uct-has-input .uct-action-btn-primary {
    position: fixed; left: 16px; right: 16px; bottom: 16px;
    width: auto; z-index: 40; box-shadow: 0 6px 20px rgba(0,0,0,.5);
  }
  .uct-tool.uct-has-input .uct-results,
  .uct-tool.uct-has-input .uct-privacy-note { padding-bottom: 80px; }
}

/* --------------------------------------------------------------------------
   3g. RESULTS
   -------------------------------------------------------------------------- */

.uct-file-item {
  background: #1a1f2e; border: 1px solid #3a4258; border-radius: 10px;
  padding: 14px; margin-bottom: 10px;
}
.uct-file-item-row { display: flex; align-items: center; gap: 14px; }
.uct-file-thumb {
  width: 56px; height: 56px; flex-shrink: 0;
  background: #252d3f; border-radius: 6px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.uct-file-thumb canvas, .uct-file-thumb img { max-width: 100%; max-height: 100%; }
.uct-file-info { flex: 1; min-width: 0; }
.uct-file-name {
  font-size: 14px; font-weight: 600; color: #e5e7eb;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.uct-file-meta   { font-size: 12px; color: #9ca3af; margin-top: 3px; }
.uct-file-status { font-size: 12px; color: #9ca3af; margin-top: 3px; }

.uct-progress-bar {
  height: 4px; background: #2a3348; border-radius: 2px;
  overflow: hidden; margin-top: 7px;
}
.uct-progress-fill {
  height: 100%; width: 0; background: #4a90ff; transition: width .2s ease;
}

/* SIZE COMPARE. Green when it worked, amber when it did not. Honest either way. */
.uct-size-compare { font-size: 12px; margin-top: 4px; }
.uct-size-decreased { color: #4ade80; }
.uct-size-increased { color: #fbbf24; }
.uct-size-same      { color: #9ca3af; }

.uct-action-area { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.uct-download-link {
  background: #4a90ff; color: #fff; text-decoration: none;
  padding: 8px 16px; min-height: 44px; border-radius: 6px;
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 600;
}
.uct-download-link:hover { background: #3a7fee; color: #fff; }

/* COMPLIANCE CHECKLIST - built from the result grid and tiles. */
.uct-result-label { font-size: 13px; color: #9ca3af; margin: 14px 0 6px; }
.uct-result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
}
.uct-result-tile {
  background: #1a1f2e; border: 1px solid #3a4258; border-radius: 10px; padding: 16px;
}
.uct-result-tile-label { font-size: 12px; color: #9ca3af; }
.uct-result-tile-value { font-size: 20px; font-weight: 700; color: #e5e7eb; margin-top: 4px; }

/* The checklist tiles inside a file row are denser than the page-level tiles. */
.uct-file-item .uct-result-label { margin-top: 12px; }
.uct-file-item .uct-result-grid {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px;
}
.uct-file-item .uct-result-tile { padding: 10px 12px; }
.uct-file-item .uct-result-tile-value { font-size: 15px; margin-top: 2px; }

/* --------------------------------------------------------------------------
   3h. MESSAGES, NOTES, UTILITY
   -------------------------------------------------------------------------- */

/* The ONLY error surface. Never alert(). */
.uct-error-msg {
  background: rgba(192,57,43,.12); border: 1px solid #c0392b; border-radius: 8px;
  padding: 12px 16px; margin-bottom: 10px; font-size: 13px; color: #e5e7eb;
}
/* Inside the options panel the same row is a validation message rather than a
   page-level banner, so it sits under the field it belongs to. */
.uct-options-body .uct-error-msg { margin: 10px 0 0; padding: 10px 12px; }
.uct-error-text { color: #c0392b; font-size: 12px; }

.uct-output-note, .uct-privacy-note {
  font-size: 12px; color: #9ca3af; text-align: center;
  line-height: 1.6; margin: 14px 0 0;
}
.uct-hidden { display: none !important; }

/* Inline links inside the tool */
.uct-tool a:not(.uct-download-link):not(.uct-action-btn) { color: #4a90ff; }

/* --------------------------------------------------------------------------
   3h-cloud. THE CLOUD URL-IMPORT MODAL - injected by cloud-handlers.js.
   Class names are hardcoded by cloud-handlers.js. Do not rename.
   .uct-input-field is defined up in 3e, shared with the typed size fields.
   -------------------------------------------------------------------------- */

.uct-modal-overlay {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(0,0,0,.66);
}
.uct-modal-content {
  width: 100%; max-width: 460px;
  background: #111B2E; border: 1px solid #26324a; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden;
}
.uct-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid #26324a;
}
.uct-modal-header h3 { margin: 0; font-size: 16px; color: #e5e7eb; }
.uct-modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: #9ca3af; padding: 4px 8px;
}
.uct-modal-close:hover { color: #e5e7eb; }
.uct-modal-body { padding: 18px; }
.uct-modal-info { margin: 0 0 12px; font-size: 13px; color: #9ca3af; line-height: 1.6; }
.uct-modal-note { margin: 10px 0 0; font-size: 12px; color: #9ca3af; line-height: 1.6; }
.uct-modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 18px; border-top: 1px solid #26324a;
}

@media (max-width: 480px) {
  .uct-modal-footer { flex-direction: column-reverse; }
  .uct-modal-footer .uct-action-btn,
  .uct-modal-footer .uct-secondary-btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   3i. MOBILE
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .uct-tool { padding: 0 16px; overflow-x: hidden; }
  .uct-tool_heading h1 { font-size: 24px; }
  .uct-upload-area { padding: 28px 16px; }
  .uct-file-item-row { flex-wrap: wrap; }
  .uct-action-area { width: 100%; }
  .uct-download-link { flex: 1; justify-content: center; }
  .uct-preset-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .uct-crop-stage { padding: 8px; }
  .uct-crop-frame > img { max-height: 360px; }
}
@media (max-width: 480px) {
  .uct-tool_heading h1 { font-size: 21px; }
  .uct-trust-strip { flex-direction: column; gap: 7px; }
  .uct-tabs { flex-direction: column; }
  .uct-tab { width: 100%; }
  .uct-input-row { flex-wrap: wrap; }
  .uct-crop-frame > img { max-height: 300px; }
}

/* ==========================================================================
   TOOL BLOCK END - signature-resize
   ========================================================================== */
