/* Vips boot loading overlay - covers entire viewport */
#vips-loading-overlay {
    align-items: center;
    background-color: #262626;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    left: 0;
    opacity: 1;
    position: fixed;
    right: 0;
    top: 0;
    transition: opacity 0.3s ease;
    z-index: 99999;
}

/* Spinner container */
.vips-boot-spinner {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* The spinner GIF */
.vips-boot-spinner img {
    height: 96px;
    width: 96px;
}

/* Optional loading text (hidden by default, uncomment if wanted) */
/*
.vips-boot-spinner::after {
    color: #666;
    content: 'Loading...';
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 13px;
}
*/

/* Error state styling (injected by vips_boot.js on failure) */
.vips-boot-error {
    animation: vips-error-fadein 0.3s ease;
}

@keyframes vips-error-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hide overlay when complete (class added by JS) */
#vips-loading-overlay[aria-hidden="true"] {
    pointer-events: none;
}

/* Self-hosted fonts --------------------------------------------- */

@font-face {
    font-family: "Federo";
    src: url("./fonts/Federo-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Gafata";
    src: url("./fonts/gafata.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Nunito Sans";
    src: url("./fonts/NunitoSans-VariableFont_YTLC,opsz,wdth,wght.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Lato";
    src: url("./fonts/lato-regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Noto Sans SC (Simplified Chinese) */
@font-face {
    font-family: "Noto Sans SC";
    src: url("./fonts/NotoSansSC-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Noto Sans Bengali */
@font-face {
    font-family: "Noto Sans Bengali";
    src: url("./fonts/NotoSansBengali-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Noto Sans Devanagari (Hindi) */
@font-face {
    font-family: "Noto Sans Devanagari";
    src: url("./fonts/NotoSansDevanagari-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Noto Sans Kannada */
@font-face {
    font-family: "Noto Sans Kannada";
    src: url("./fonts/NotoSansKannada-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

body {
    background-color: #2f2f2f;
    color: #ccc;
    font-family: "Nunito Sans";
}

/* Make the main container fill the viewport height */
.container {
    box-sizing: border-box;
    display: flex;
    gap: 8px;
    height: 98vh;
    padding: 16px 0px 8px 16px;
}

/* Make form container scrollable */
.form-container {
    background-color: #353535;
    border-radius: 24px;
    box-shadow: 0px 3px 10px rgba(0, 0, 0, .1);
    box-sizing: border-box;
    height: 99.7%; /* Fill container height */
    max-width: 425px;
    min-width: 425px;
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: clip; /* Disable horizontal */
    padding-bottom: 16px;
    padding-top: 16px;
    width: 425px;
}

.results-container {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    flex: 1;
    height: 99.7%;
    justify-content: center;
    min-width: 300px;
    overflow-y: clip;
}

.form-container::-webkit-scrollbar {
    width: 8px;
}

.form-container::-webkit-scrollbar-track {
    background: #353535;
    border-radius: 4px;
    margin-bottom: 16px;
    margin-top: 16px;
}

.form-container::-webkit-scrollbar-thumb {
    background: #353535;
    border-radius: 4px;
}

.form-container::-webkit-scrollbar-thumb:hover {
    background: #777;
}

form {
    padding-left: 10px;
    width: 383px;
}

.results-container img.generated_image.transparent,
.transparent {
    background-color: #fff !important;
    background-image:
        repeating-linear-gradient(45deg, #ccc 0 10px, transparent 10px 20px),
        repeating-linear-gradient(-45deg, #ccc 0 10px, transparent 10px 20px) !important;
    background-size: 20px 20px !important;
    display: block;
    height: auto;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    width: auto;
}

.field-label {
    color: #ccc;
    cursor: help;
    display: inline-block;
    font-family: "Nunito Sans";
    font-size: 12px;
    padding-right: 12px;
    text-align: right;
    width: 74px;
}
.field-label.subfield {
    font-size: 12px;
}
.field-label.nohelp {
    cursor: default;
}
.field-group {
    align-items: center;
    display: inline-flex;
    margin-bottom: 16px;
    width: 390px;
}
.field-group.drop-zone {
    margin-bottom: 12px;
}
#main-title {
    align-items: center;
    color: #ccc;
    display: flex;
    flex-direction: row;
    font-family: "Federo", "Lato", sans-serif;
    font-size: 24px;
    justify-content: space-between;
    margin: 3px 20px 35px 20px;
    text-wrap-mode: nowrap;
}
#main-title span {
    display: inline-flex;
    align-items: center;
    flex-direction: row;
}
#main-title:hover, #main-title:hover img {
    cursor: pointer;
    color: white;
    opacity: 1;
}
.titleimg {
    opacity: 0.6;
    height: 36px;
    padding-right: 8px;
    vertical-align: middle;
}
select {
    background-color: #4c4c4c;
    border-radius: 6px;
    border: none;
    box-sizing: border-box;
    color: #ccc;
    display: inline-block;
    font-family: "Nunito Sans", "Gafata", Arial, Helvetica, sans-serif;
    font-size: 12px !important;
    height: 22px;
    margin: 0px 2px;
    overflow: hidden;
    padding-left: 4px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 238px;
}
select:focus {
    border-color: #666;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.25);
}
#amazon_size,
#aspect_ratio_imagen,
#assigned_output_profile,
#bggen_type,
#claidai_background_model_version,
#claidai_scene_viewpoint,
#enhance_gen_model,
#enhance_standard_model,
#fashn_model_version,
#garment_category,
#garment_photo_type,
#huhu_vton_model,
#langselect,
#lighting_model,
#model,
#osd-output-profile,
#outpainting_mode,
#person_generation,
#safety_setting,
#sharpen_gen_model,
#sharpen_model,
#size_preset,
#size_preset_dall_e_2,
#size_preset_dall_e_3,
#size_preset_gptimage,
#size_preset_ideogram,
#size_preset_recraft,
#template_mode,
#template_viewpoint,
#upscale_factor,
#upscale_type {
    text-transform: none;
}
h1 {
    font-family: "Federo";
    color: #ccc;
}
textarea {
    background-color: #444;
    border-radius: 6px;
    border: none;
    box-sizing: border-box;
    color: #ccc;
    font-family: "Nunito Sans", Arial, Helvetica, sans-serif;
    font-size: 13px;
    height: auto;
    line-height: 22px;
    min-height: 100px;
    padding: 8px 8px 8px 10px;
}
input[type="text"],
input[type="number"],
input#mp_display,
input#mp_display:focus,
input#mp_display:focus-visible {
    background-color: #444;
    border-radius: 6px;
    border: none;
    box-shadow: none;
    box-sizing: border-box;
    color: #ccc;
    font-size: 12px;
    height: auto;
    line-height: 16px;
    min-height: 22px;
    padding: 4px 4px 4px 8px;
    width: 238px;
}
input[type="text"]:focus,
input[type="text"]:focus-visible,
input[type="number"]:focus,
input[type="number"]:focus-visible,
textarea:focus {
    background-color: #fff !important;
    color: #353535 !important;
    box-shadow: 0 0 4px 2px #9ed7e0;
    border: none !important;
    outline: none;
}
input[type="range"] {
    width: 184px;
}

input[type="checkbox"] {
    margin-right: 100px; /* so consecutive checkboxes don't end up in the same row */
}
input[type="color"] {
    background-color: #444;
    block-size: 25px;
    width: 25px;
    border: none;
    cursor: pointer;
    margin-left: 6px;
    margin-right: 6px;
    padding: 0 2px 0 2px;
}

input[type="color"]:disabled {
    cursor: default;
}

input:focus::placeholder,
textarea:focus::placeholder {
    color: transparent;
}

.color-r,
.color-g,
.color-b,
#background_color_r,
#background_color_g,
#background_color_b,
#color-r,
#color-g,
#color-b {
    width: 50px;
    height: 20px;
    margin-right: 10px;
    border-radius: 6px;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.uploadbutton {
    margin-left: 2px;
    opacity: 0.5;
}

.uploadbutton img {
    height: 20px;
    width: 20px;
    margin-top: 4px;
}

.color-entry {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-direction: row;
}

#buttons {
    align-items: center;
    background-color: #353535; /* Match form-container background */
    bottom: -16px;
    display: inline-flex;
    gap: 20px;
    height: 40px;
    justify-content: flex-end;
    padding: 12px 4px 20px;
    position: sticky;
    width: 100%;
    z-index: 10; /* Ensure it stays on top */
}

/* Always-visible reuse button disabled state */
.reuse-button:disabled,
.reuse-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
}

/* Prevent hover/active effects on disabled reuse button */
.reuse-button:disabled:hover,
.reuse-button.disabled:hover {
    filter: grayscale(100%);
    opacity: 0.5;
}

.reuse-button:disabled:active,
.reuse-button.disabled:active {
    transform: none;
}

.button {
    height: 24px;
    cursor: pointer;
    opacity: 0.5;
}

.underlabelbtn {
    cursor: pointer;
    vertical-align: middle;
    margin: 8px 8px 0 106px;
    height: 14px;
    display: block;
}

.button:hover,
.uploadbutton:hover,
.color-entry img.add-color-entry:hover,
.color-entry img.remove-color-entry:hover,
#style_id_copy_to_clipboard:hover,
#avatar_id_copy_to_clipboard:hover,
.multifile-row img.multifile-add:hover,
.multifile-row img.multifile-remove:hover,
img.clear-color-weight:hover,
img.clear-single-value:hover {
    filter: brightness(2);
    opacity: 1 !important;
    cursor: pointer;
}
.button:active,
.uploadbutton img:active,
.color-entry img.add-color-entry:active,
.color-entry img.remove-color-entry:active,
#style_id_copy_to_clipboard:active,
#avatar_id_copy_to_clipboard:active,
.multifile-row img.multifile-add:active,
.multifile-row img.multifile-remove:active,
img.clear-color-weight:active,
img.clear-single-value:active {
    transform: translateY(2px);
}
.uploadbutton.inert,
.uploadbutton.inert:hover {
    filter: brightness(1);
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}
.uploadbutton.inert img:active {
    transform: translateY(0);
}
img#submit-button {
    height: 24px;
    margin-top: 2px;
}
img#submit-button:active {
    transform: translateY(2px);
}
img#reset-button {
    height: 26px;
    margin-top: 1px;
}

span.rangevalue {
    background-color: #5d5d5d;
    border-radius: 6px;
    color: #ccc;
    font-size: 12px;
    height: 16px;
    margin-left: 6px;
    padding: 2px 6px 2px 6px;
    text-align: center;
    width: 24px;
}
.rangevalue.degrees::after {
    content: '°';
}
input#claidai_output_width_value,
input#claidai_output_height_value {
    width: 112px;
    height: 22px !important;
    min-height: 22px !important;
    margin-left: 6px;
    border-radius: 6px;
}

select#claidai_output_width_mode,
select#claidai_output_height_mode {
    width: 90px;
    height: 22px;
}

span#width_unit,
span#height_unit {
    font-size: 13px;
    margin-left: 22px;
    color: #9b9b9b;
}

span#range_unit {
    font-size: 13px;
    margin-left: 12px;
    margin-right: 6px;
}

.generated-image {
    padding-top: 80px;
}
img.loading {
    width: 40px;
    height: 40px;
}
img.generated_image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: auto;
    height: auto;
    display: block; /* Remove any inline spacing */
}

.file-preview {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 234px;
}

.file-preview img {
    border: 1px solid #7c7c7c;
    max-width: 34px;
    max-height: 46px;
    margin-left: 11px;
    object-fit: contain;
    transform-origin: bottom left;
}

/* =============================================================================
   FILE INPUT BOX - Unified upload/preview square
   ============================================================================= */

/* The 46x46 container that serves as both upload trigger and preview */
.file-input-box {
    align-items: center;
    background-color: #444;
    border-radius: 6px;
    border: 1px dashed #666;
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    height: 46px;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: border-color 0.15s, background-color 0.15s;
    width: 46px;
}

.file-input-box:hover {
    background-color: #4a4a4a;
    border-color: #888;
}

.file-input-box:active {
    transform: scale(0.9);
}

.file-input-box:active .box-plus-icon {
    font-size: 18px;
}

/* Disabled state */
.file-input-box.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.file-input-box.disabled:hover {
    background-color: #444;
    border-color: #666;
}

/* Plus icon for empty state */
.file-input-box .box-plus-icon {
    color: #888;
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
    pointer-events: none;
    transition: color 0.15s;
    user-select: none;
}

.file-input-box:hover .box-plus-icon {
    color: #bbb;
}

.file-input-box.disabled .box-plus-icon {
    color: #666;
}

/* Filled state - hide plus, show thumbnail */
.file-input-box.has-file {
    border-style: solid;
    border-color: #666;
    cursor: default;
}

.file-input-box.has-file .box-plus-icon {
    display: none;
}

/* Thumbnail inside the box */
.file-input-box .box-thumb {
    display: none;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.file-input-box.has-file .box-thumb {
    display: block;
}

/* Transparent thumbnail background */
.file-input-box.has-file.transparent .box-thumb {
    background-color: #fff;
    background-image:
        repeating-linear-gradient(45deg, #ccc 0 5px, transparent 5px 10px),
        repeating-linear-gradient(-45deg, #ccc 0 5px, transparent 5px 10px);
    background-size: 10px 10px;
    object-fit: contain;
}

/* Delete button overlay - appears on hover */
.file-input-box .box-delete-btn {
    align-items: center;
    background: rgba(211, 47, 47, 0.9);
    border-radius: 4px;
    border: 1px solid #ffffff80;
    color: #fff;
    cursor: pointer;
    display: flex;
    font-family: 'Nunito Sans', Arial, sans-serif;
    font-size: 12px;
    height: 18px;
    justify-content: center;
    left: 1px;
    line-height: 1;
    opacity: 0;
    padding: 0;
    position: absolute;
    top: 1px;
    transition: opacity 0.15s, background-color 0.15s;
    width: 18px;
    z-index: 2;
}

.file-input-box.has-file:hover .box-delete-btn {
    opacity: 1;
}

.file-input-box .box-delete-btn:hover {
    background: #e53935;
}

.file-input-box .box-delete-btn:active {
    transform: scale(0.95);
}

/* Hide delete button when disabled */
.file-input-box.disabled .box-delete-btn {
    display: none;
}

/* =============================================================================
   FILE INPUT WRAPPER - Updated layout with box
   ============================================================================= */

/* Updated wrapper to use the new box */
.file-input-wrapper {
    align-items: center;
    border-bottom: 1px solid hsl(0deg 0% 29.8% / 48%);
    border-top: 1px solid hsl(0deg 0% 29.8% / 48%);
    display: inline-flex;
    gap: 8px;
    padding: 10px 0;
    width: 256px;
}

/* Hide the old uploadbutton when new box is present */
.file-input-wrapper:has(.file-input-box) .uploadbutton {
    display: none;
}

/* File info now appears to the right of the box */
.file-input-wrapper .file-info-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 2px;
    min-width: 0;
}

/* Adjust file preview area for new layout */
.file-input-wrapper .file-preview {
    align-items: center;
    display: inline-flex;
    flex: 1;
    gap: 8px;
    width: auto;
}

/* Hide old preview thumbnail when box is used */
.file-input-wrapper:has(.file-input-box) .file-preview > img.thumb {
    display: none;
}

.multifile-row .file-input-wrapper .preview-actions {
    left: 136px;
}

/* Send to viewer button in new layout */
.file-input-wrapper .preview-actions {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 8px;
    left: 170px;
    position: absolute;
}

/* Hide old clear button when box is used (delete is in the box now) */
.file-input-wrapper:has(.file-input-box) .preview-actions .clear-single-value {
    display: none;
}

/* =============================================================================
   MULTIFILE ROW - Updated for box layout
   ============================================================================= */

/* Multifile row adjustments */
.multifile-row .file-input-box {
    flex-shrink: 0;
}

.multifile-row .file-input-wrapper {
    border: none;
    gap: 6px;
    padding: 0;
}

/* Named image entry adjustments */
.named-image-entry .file-input-box {
    height: 42px;
    width: 42px;
}

.named-image-entry .box-plus-icon {
    font-size: 20px;
}

.named-image-entry .box-delete-btn {
    height: 18px;
    width: 18px;
    font-size: 12px;
}

.zoomed-preview {
    background: #222;
    border: 1px solid #bdbdbd;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    display: none;
    max-height: 90vh !important;
    max-width: 95vw !important;
    pointer-events: none;
    position: fixed;
    z-index: 9999;
}

.style_id_presentation {
    font-size: 32px;
    line-height: 50px;
    margin-top: 8px;
}

#style_id_copy_to_clipboard {
    height: 21px;
    opacity: 0.5;
    margin-left: 12px;
}

.checkmarkbtn {
    width: 14px;
}

#style_id_copy_to_clipboard_checkmark {
    height: 21px;
    opacity: 1;
    margin-left: 8px;
}

.multifile-row img.multifile-add,
.multifile-row img.multifile-remove,
.color-entry img.add-color-entry,
.color-entry img.remove-color-entry {
    height: 12px;
    opacity: 0.45;
}

.color-entry img.add-color-entry {
    top: 6px;
    right: -12px;
    z-index: 2;
}

.color-entry img.add-color-entry,
.color-entry img.remove-color-entry {
    position: absolute;
}

.color-entry img.remove-color-entry {
    top: 6px;
    right: -30px;
    z-index: 1;
}
/* make each entry stack, and indent under the label */
#color_scheme_list {
    display: flex;
    flex-direction: column;
    row-gap: 8px;
}

/* ensure the wrapper doesn't squash everything inline */
#color-scheme-list-field.field-group {
    display: block;
    margin-top: 4px;
}

/* only hide sliders (and their hidden inputs) in groups without weights */
.multifile-rows[data-has-weight="false"] .multifile-weight-slider,
.multifile-rows[data-has-weight="false"] .multifile-weight-hidden {
    display: none;
}

/* Non-weighted multifile rows: let file-input-wrapper use the slider column space */
.multifile-rows[data-has-weight="false"] .multifile-row .file-input-wrapper {
    grid-column: 1 / 3;  /* span columns 1-2 (preview + unused slider area) */
}

/* Adjust file-preview to use available space */
.multifile-rows[data-has-weight="false"] .multifile-row .file-preview {
    display: inline-flex;
    align-items: center;
    flex: 1;
    gap: 6px;
}

/* MULTIFILE ROW: strict 4-column layout (preview | slider | add | remove) */
.multifile-row {
    border-bottom: 1px solid hsl(0deg 0% 29.8% / 48%);
    display: grid;
    grid-template-columns:
        74px /* preview box width */
        144px /* slider width */
        12px /* add-button width */
        12px; /* remove-button width */
    grid-auto-rows: 52px; /* row height */
    column-gap: 6px; /* gutter between cols */
    align-items: center; /* vertical centering */
    padding: 8px 0;
}

.multifile-row:first-child {
    border-top: 1px solid hsl(0deg 0% 29.8% / 48%);
}

/* Named image entries with stacked layout */
.named-image-entry {
    margin-bottom: 10px;
    border: 1px solid #4c4c4c;
    background-color: transparent;
    border-radius: 6px;
}
input.named-name-input {
    margin-bottom: 8px;
    padding-left: 10px;
    border-bottom-right-radius: 0px;
    border-bottom-left-radius: 0px;
}
.named-image-entry .multifile-row {
    grid-auto-rows: max-content;
    column-gap: 5px;
}
.named-image-entry .file-input-wrapper {
    border: none;
    margin-bottom: -3px;
    margin-top: -10px;
    margin-left: 10px;
    padding: 0;
}
.named-image-entry .file-preview {
    margin-bottom: 5px;
}
#gemini-image-refs-field label.field-label {
    margin-top: -18px;
}
.multifile-row .file-input-wrapper,
#reference-image-amazon-titan-file-field .file-input-wrapper,
#image-prompt-flux-pro-file-field .file-input-wrapper,
#vton-garment-image-file-field .file-input-wrapper,
#vton-model-image-file-field .file-input-wrapper {
    display: inline-flex;
    align-items: center;
}
.multifile-row .file-input-wrapper {
    border: none;
    padding: 0;
}
.multifile-row .multifile-weight-slider {
    width: 68px !important;
    margin: 0 0 0 68px;
}
.multifile-row img.multifile-add,
.multifile-row img.multifile-remove {
    width: 12px;
    height: 12px;
}
/* for rows without sliders/weights */
.multifile-rows[data-has-weight="false"] .multifile-row img.multifile-add {
    grid-column-start: 3;
    margin-left: auto;
}
.multifile-rows[data-has-weight="false"] .multifile-row img.multifile-remove {
    margin-left: auto;
}
/* =============================================================================
   MULTIFILE ROW WITH WEIGHTS - SLIDER BELOW LAYOUT

   Add this to intelligence.css (after the existing .multifile-row rules,
   around line 645)

   This restructures weighted multifile rows so the slider appears below
   the preview/buttons instead of competing horizontally for space.
   ============================================================================= */

/* Weighted multifile rows: 2-row layout with slider below */
.multifile-rows[data-has-weight="true"] .multifile-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    max-width: 256px;
}

/* File input wrapper on first row, flexible width */
.multifile-rows[data-has-weight="true"] .multifile-row .file-input-wrapper {
    flex: 1 1 auto;
    min-width: 0;  /* allow shrinking */
}

/* Add/remove buttons stay on first row */
.multifile-rows[data-has-weight="true"] .multifile-row img.multifile-add,
.multifile-rows[data-has-weight="true"] .multifile-row img.multifile-remove {
    flex: 0 0 auto;
}

/* Slider breaks to its own row and spans full width */
.multifile-rows[data-has-weight="true"] .multifile-row .multifile-weight-slider {
    flex: 0 0 100%;           /* force to new row */
    order: 10;                /* ensure it comes last visually */
    width: 100% !important;   /* override the 68px width */
    margin: 0 !important;     /* override the 68px left margin */
    max-width: 220px;         /* reasonable max width */
}

/* Allow more space for filename in weighted rows */
.multifile-rows[data-has-weight="true"] .multifile-row .file-input-filename {
    max-width: 176px;
}

/* Send to viewer in weighted rows */
.multifile-rows[data-has-weight="true"] .multifile-row .send-to-viewer-btn {
    margin-left: auto;
    margin-top: 0;
    flex-shrink: 0;
}

/* Ensure file-info-container can grow */
.multifile-rows[data-has-weight="true"] .multifile-row .file-info-container {
    flex: 1;
    min-width: 0;  /* allow text truncation */
}
div#color-palette-preset-field {
    margin-top: 4px;
}
.preset-palette-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 256px;
}
.preset-palette-item {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}
.preset-palette-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

/* .preset-palette-item input[type="radio"]:checked + label */
/* Make the label fill its <li> so background spans the whole row */
.preset-palette-item > label {
    display: flex;
    align-items: center;
    padding: 4px 0 4px 0;
    border-radius: 6px;
}

/* On hover OR when the radio is checked, give the same background */
.preset-palette-item > label:hover,
.preset-palette-item input[type="radio"]:checked + label {
    background-color: #5d5d5d;
    padding: 4px 0 4px 0;
}

/* Keep the name text white and larger when checked */
.preset-palette-item input[type="radio"]:checked + label .preset-palette-name {
    color: white;
}
.preset-palette-item label {
    flex: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.preset-palette-name {
    width: 82px;
    margin-right: 18px;
    margin-left: 18px;
    font-size: 13px;
}
.preset-swatches {
    display: flex;
    gap: 9px;
    margin-right: 1rem;
}
.preset-swatch {
    width: 15px;
    height: 15px;
    border: 1px solid #777;
}

input.color-hex-input {
    width: 70px;
    text-transform: uppercase;
    text-align: left;
}
input.color-weight-slider {
    width: 64px;
    margin-left: 12px;
    margin-right: 6px;
}
#color_palette_custom_list .remove-color-entry,
#color_palette_custom_list .add-color-entry {
    top: unset;
}
.color-hex-label {
    font-size: 12px;
}
#color_palette_custom_list {
    display: flex;
    flex-direction: column;
    row-gap: 8px;
}
#color_palette_custom_list .color-entry {
    display: flex; /* instead of inline-flex */
    align-items: center;
}
/* make "inactive" untouched sliders semi‐transparent */
.color-weight-slider.inactive {
    opacity: 0.3;
}
img.clear-color-weight,
img.clear-single-value {
    height: 16px;
    opacity: 0.45;
}
img.clear-color-weight {
    margin-left: 10px;
}
img.clear-single-value {
    border: none;
    margin-left: auto;
}

/* Container for preview action buttons (clear + send to viewer) */
.preview-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: auto;
    justify-content: space-between;
    height: 40px;
}

/* Send to viewer button - rotated reuse icon */
img.send-to-viewer-btn {
    height: 16px;
    opacity: 0.45;
    border: none;
    cursor: pointer;
    transform: rotate(90deg); /* Point toward the viewer (right side) */
    transform-origin: initial;
}

.named-image-entry img.send-to-viewer-btn {
    position: absolute;
    top: 45%;
    left: 128px;
}

img.send-to-viewer-btn:hover {
    filter: brightness(2);
    opacity: 1 !important;
}

img.send-to-viewer-btn:active {
    transform: rotate(90deg) translateX(2px);
}

img.send-to-viewer-btn.disabled {
    opacity: 0.2 !important;
    cursor: not-allowed;
    filter: grayscale(100%);
}

img.send-to-viewer-btn.disabled:hover {
    filter: grayscale(100%);
    opacity: 0.2 !important;
}

img.send-to-viewer-btn.disabled:active {
    transform: rotate(90deg);
}

.background_color_hex {
    align-items: center;
    display: inline-flex;
    flex-direction: row;
    width: 256px;
}

#fileinputsize {
    color: #9f9f9f;
    cursor: default;
    font-size: 11px;
    margin-left: 2px;
    min-width: 120px;
}

.file-info-container {
    cursor: default;
    display: flex;
    flex-direction: column;
    flex: 1;
    line-height: 1.3;
    min-width: 0; /* Allow shrinking for text-overflow */
}

.file-input-filename {
    color: #bbb;
    font-size: 11px;
    overflow-wrap: break-word;
    max-width: 165px;
    cursor: default;
}

/* Multifile row filename adjustments */
.multifile-row .file-info-container {
    flex: none;
}

.multifile-row .file-input-filename,
.multifile-row #fileinputsize {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    margin-left: 0;
    max-width: 132px;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* give users visual feedback for DND */
.file-input-box.dragover {
    background-color: rgba(200, 200, 200, 0.2);
}

/* Hide legacy image when viewer is active */
#generatedImage {
    display: none;
}

.pose-buttons button {
    background-color: #444444;
    border-radius: 6px;
    border: 1px dashed #666;
    color: #ccc;
    cursor: pointer;
    font-family: 'Nunito Sans';
    font-size: 11px !important;
    height: 48px;
    padding: 4px 6px;
    width: 48px;
}

#openPoseEditorBtn:disabled {
    cursor: not-allowed;
    color: #8c8c8c !important;
    transform: translateY(0px) !important;
}

.pose-buttons {
    margin-left: -6px;
    margin-right: 6px;
    gap: 6px;
}

.sp-json-footer button:hover, .pose-buttons button:hover {
    color: white !important;
}

.sp-json-footer button:active, .pose-buttons button:active {
    transform: translateY(2px) !important;
}

.jsoneditor-contextmenu .jsoneditor-menu li button.jsoneditor-selected,
.jsoneditor-contextmenu .jsoneditor-menu li button.jsoneditor-selected:focus,
.jsoneditor-contextmenu .jsoneditor-menu li button.jsoneditor-selected:hover,
.jsoneditor-contextmenu .jsoneditor-menu button {
    background-color: #777777 !important;
}

.jsoneditor-contextmenu .jsoneditor-menu button {
    color: #fff !important;
}

.jsoneditor-menu>.jsoneditor-modes>button:disabled, .jsoneditor-menu>button:disabled {
     opacity: 0 !important;
}

.jsoneditor-menu>.jsoneditor-modes>button, .jsoneditor-menu>button,
.jsoneditor-contextmenu .jsoneditor-text {
    font-family: 'Nunito Sans', sans-serif !important;
}

.jsoneditor-frame {
    border-radius: 6px !important;
}

.jsoneditor input[type=text] {
    background-color: #ffffff !important;
    font-size: 13px !important;
}

/*
input#mp_display,
input#mp_display:focus,
input#mp_display:focus-visible
*/

a.jsoneditor-value,
div.jsoneditor-default,
div.jsoneditor-field,
div.jsoneditor-readonly,
div.jsoneditor-value {
    min-width: 140px !important;
}

/* Footer */
.sp-json-footer {
    padding: 8px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Stop background scroll when modal open */
body.sp-json-modal-open {
    overflow: hidden;
}

/* Role-based coloring */
.json-role-system {
    color: #ffb74d;
    font-weight: 600;
}
.json-role-user {
    color: #81d4fa;
}
.json-role-assistant {
    color: #c5e1a5;
}



/* LANGUAGE SUPPORT */

#langselect {
    margin-right: 56px;
    margin-top: 6px;
    color: #ccc;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

#langselect:hover {
    opacity: 1;
}

/* Base: ".usenunito" always in Nunito Sans */
.usenunito {
    font-family: "Nunito Sans", "Gafata", Arial, Helvetica, sans-serif !important;
}

.usefedero {
    font-family: "Federo", "Lato", Arial, Helvetica, sans-serif !important;
}

/* ==========================================================================
   Kannada font overrides
   ========================================================================== */
html:lang(kn-IN) body,
html:lang(kn-IN) .field-label,
html:lang(kn-IN) select,
html:lang(kn-IN) textarea,
html:lang(kn-IN) input,
html:lang(kn-IN) h1 {
    font-family: "Noto Sans Kannada", "Nunito Sans", Arial, Helvetica, sans-serif;
}

/* ==========================================================================
   Bengali font overrides
   ========================================================================== */
html:lang(bn-BD) body,
html:lang(bn-BD) .field-label,
html:lang(bn-BD) select,
html:lang(bn-BD) textarea,
html:lang(bn-BD) input,
html:lang(bn-BD) h1 {
    font-family: "Noto Sans Bengali", "Nunito Sans", Arial, Helvetica, sans-serif;
}

/* ==========================================================================
   Hindi/Devanagari font overrides
   ========================================================================== */
html:lang(hi-IN) body,
html:lang(hi-IN) .field-label,
html:lang(hi-IN) select,
html:lang(hi-IN) textarea,
html:lang(hi-IN) input,
html:lang(hi-IN) h1 {
    font-family: "Noto Sans Devanagari", "Nunito Sans", Arial, Helvetica, sans-serif;
}

/* ==========================================================================
   Simplified Chinese font overrides
   ========================================================================== */
html:lang(zh-CN) body,
html:lang(zh-CN) .field-label,
html:lang(zh-CN) select,
html:lang(zh-CN) textarea,
html:lang(zh-CN) input,
html:lang(zh-CN) h1 {
    font-family: "Noto Sans SC", "Nunito Sans", Arial, Helvetica, sans-serif;
}

/* ==========================================================================
   Force Latin fonts for branding elements regardless of language
   ========================================================================== */
html:lang(kn-IN) .usenunito,
html:lang(bn-BD) .usenunito,
html:lang(hi-IN) .usenunito,
html:lang(es) .usenunito,
html:lang(zh-CN) .usenunito {
    font-family: "Nunito Sans", Arial, Helvetica, sans-serif !important;
}

/* ==========================================================================
   Make selectors taller to accommodate descenders and ascenders of some langs
   ========================================================================== */
html:lang(bn-BD) select,
html:lang(hi-IN) select,
html:lang(kn-IN) select {
    height: 26px;
}

html:lang(kn-IN) #main-title-text.usefedero,
html:lang(bn-BD) #main-title-text.usefedero,
html:lang(hi-IN) #main-title-text.usefedero,
html:lang(es) #main-title-text.usefedero,
html:lang(zh-CN) #main-title-text.usefedero {
    font-family: "Federo", Arial, Helvetica, sans-serif !important;
}
