/* Style général (complété par theme-win98-modern.css) */
body {
    user-select: none;
    -webkit-user-select: none;
}

input,
textarea {
    user-select: auto;
    -webkit-user-select: auto;
}

/* Mise en page principale */
#main-layout {
    width: 98vw;
    height: 98vh;
    box-shadow: 10px 10px 40px rgba(0, 0, 0, 0.6);
}

/* Menus — structure survol (styles visuels : theme-win98-modern.css) */
menu[role="menubar"] {
    display: flex;
    flex-direction: row;
    margin: 0 !important;
    padding: 0;
    list-style: none;
    cursor: default;
}

li[role="menuitem"] {
    position: relative;
    list-style: none;
}

li[role="menuitem"]>ul[role="menu"] {
    display: block;
    position: absolute;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: none;
}

/* Hitbox expansion (Mouse Bridge) : élargit la zone de survol pour éviter la fermeture accidentelle */
li[role="menuitem"]>ul[role="menu"]::before {
    content: "";
    position: absolute;
    top: -8px;
    right: -20px;
    bottom: -8px;
    left: 0;
    z-index: -1;
    pointer-events: auto;
    /* Empêche le clic à travers le pont invisible s'il y a un bouton dessous */
}

menu[role="menubar"]>li[role="menuitem"]>ul[role="menu"] {
    top: 100%;
    left: 0;
    min-width: 180px;
}

li[role="menuitem"]:hover>ul[role="menu"] {
    display: block;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: none;
}

li[role="menuitem"] ul[role="menu"] li[role="menuitem"] ul[role="menu"] {
    top: 0;
    left: 100%;
    margin-left: -2px;
}

/* Tool Options Bar */
.tool-options-bar,
#tool-options-bar {
    background: #c0c0c0;
    border-top: 1px solid #dfdfdf;
    box-shadow: inset 0 1px #fff;
    padding: 4px 6px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px 8px;
    font-size: 11px;
    min-height: 28px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.opt-tool-name {
    border-right: 1px solid #888;
    padding-right: 8px;
    font-weight: bold;
    min-width: 0;
    max-width: 11em;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.opt-grp {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px 8px;
    flex-shrink: 0;
}

.opt-grp[hidden] {
    display: none !important;
}

/* [hidden] doit primer sur .field-row { display:flex } sinon la case « Fermer » reste visible */
#tool-options-bar [hidden],
#tool-options-bar .field-row[hidden] {
    display: none !important;
}

.opt-bar-btn {
    padding: 2px 8px !important;
    min-width: 0 !important;
    min-height: 20px !important;
    color: #222 !important;
    text-shadow: none !important;
}

.wand-slider {
    width: 100px;
    vertical-align: middle;
}

.opt-num {
    min-width: 22px;
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

#tool-options-bar label {
    margin-right: 4px;
}

/* Barre d’options : cases compactes */
#tool-options-bar .opt-bar-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    white-space: nowrap;
}

#tool-options-bar .opt-bar-check input[type="checkbox"] {
    flex-shrink: 0;
}

.illu-opt-lbl {
    flex-shrink: 0;
    margin-right: 2px !important;
}

/* Jauge type « barre bleue » (tolérance baguette / pot) */
.illu-gauge-field {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.illu-gauge-wrap {
    --illu-gauge-pct: 0%;
    position: relative;
    display: inline-block;
    width: 104px;
    height: 18px;
    box-sizing: border-box;
    border: 1px solid #000;
    background: #fff;
    vertical-align: middle;
    flex-shrink: 0;
}

.illu-gauge-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--illu-gauge-pct);
    max-width: 100%;
    background: linear-gradient(180deg, #3a86e8 0%, #1e5bb8 100%);
    pointer-events: none;
    z-index: 0;
}

.illu-gauge-val {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    pointer-events: none;
    z-index: 1;
    font-variant-numeric: tabular-nums;
}

.illu-gauge-wrap--low .illu-gauge-val {
    color: #1a1a1a;
    text-shadow: none;
    justify-content: flex-end;
    padding-right: 4px;
    padding-left: 0;
}

.illu-gauge-input.wand-slider,
.illu-gauge-input {
    position: absolute !important;
    left: 0;
    top: 0;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0.02;
    cursor: pointer;
    z-index: 2;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    min-height: 0 !important;
}

.illu-gauge-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 18px;
    background: rgba(40, 40, 40, 0.45);
    border: 1px solid #333;
    border-radius: 1px;
}

.illu-gauge-input::-moz-range-thumb {
    width: 12px;
    height: 18px;
    background: rgba(40, 40, 40, 0.45);
    border: 1px solid #333;
    border-radius: 1px;
}

.illu-gauge-input::-moz-range-track {
    background: transparent;
}

/* Floating Tools — 2 colonnes */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 28px);
    justify-content: center;
    gap: 2px;
    padding: 4px 4px 6px;
    box-sizing: border-box;
}

.tool-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn svg {
    pointer-events: none;
}

.tool-btn.active {
    background: #dfdfdf;
    box-shadow: inset 1px 1px #000, inset -1px -1px #fff;
}

.tool-btn:disabled,
.tool-btn.tool-btn--mode-lock:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.85);
    box-shadow: none;
}

.tool-btn.tool-btn--planned:disabled {
    opacity: 0.4;
    cursor: help;
}

/* --- New Color Picker UI --- */
.color-picker-layout {
    font-family: 'MS Sans Serif', sans-serif;
}

.col-primary,
.col-secondary {
    cursor: pointer;
}

.col-swap:hover {
    background: #fff;
}

.color-section-title {
    font-weight: bold;
}

/* Panneau RVB / TSV / Alpha développé : plus compact (curseurs + colonnes en mode flottant) */
#color-sliders-panel {
    font-size: 11px;
    line-height: 1.2;
    gap: 0;
}

#color-sliders-panel .color-sliders-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
    align-items: start;
}

body:not(.ui-layout-floating) #color-sliders-panel .color-sliders-columns {
    grid-template-columns: 1fr;
    gap: 0;
}

#color-sliders-panel .color-sliders-col {
    min-width: 0;
}

#color-sliders-panel .color-section-title--sliders {
    font-size: 10px;
    line-height: 1.15;
    border-bottom: 1px solid #888;
    margin: 0 0 2px;
    padding: 0 0 1px;
}

#color-sliders-panel .color-section-title--alpha {
    margin-top: 4px;
}

#color-sliders-panel .color-slider-row {
    margin-bottom: 2px;
    gap: 4px;
    flex-wrap: nowrap;
    align-items: center;
    height: 30px;
}

#color-sliders-panel .color-slider-row--alpha {
    margin-bottom: 0;
}

#color-sliders-panel .color-slider-label {
    flex: 0 0 11px;
    width: 11px;
    margin: 0;
    padding: 0;
    font-size: 10px;
    text-align: center;
    color: inherit;
}

#color-sliders-panel .trk-wrapper {
    flex: 1 1 0;
    min-width: 0;
    height: 10px;
    margin-right: 0;
}

#color-sliders-panel .c-slider::-webkit-slider-thumb {
    width: 7px;
    height: 11px;
}

#color-sliders-panel .c-slider::-moz-range-thumb {
    width: 7px;
    height: 11px;
}

#color-sliders-panel input.illu-num-input {
    min-width: 40px;
    width: 40px;
    max-width: 44px;
    font-size: 10px;
    padding: 1px 2px;
}

#color-sliders-panel .color-hex-row {
    margin: 3px 0 0;
    gap: 4px;
    flex-wrap: nowrap;
}

#color-sliders-panel .color-hex-label {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    font-size: 10px;
    margin: 0;
}

#color-sliders-panel .color-hex-input {
    width: 100%;
    max-width: 72px;
    min-width: 0;
    flex: 1 1 auto;
    box-sizing: border-box;
    font-size: 10px;
    padding: 1px 4px;
    text-transform: uppercase;
}

.window illu-new-project-window {
    width: 250px !important;

}

/* Custom Sliders for color tracking */
.trk-wrapper {
    display: flex;
    width: 80px;
    height: 12px;
    margin-right: 4px;
    position: relative;
    border: 1px inset #fff;
}

.trk-wrapper.alpha-trk {
    background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 25% 50%) 50% / 8px 8px;
}

.trk-wrapper.alpha-trk::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent, var(--alpha-col, #000));
    pointer-events: none;
    z-index: 1;
}

.c-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    position: relative;
    z-index: 2;
    outline: none;
    cursor: crosshair;
}

.c-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 8px;
    height: 14px;
    background: transparent;
    border: none;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background-color: #000;
    cursor: pointer;
    transform: translateY(0);
}

.c-slider::-moz-range-thumb {
    width: 8px;
    height: 14px;
    background: transparent;
    border: none;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background-color: #000;
    cursor: pointer;
}

/* Small palette grid items */
.palette-swatch {
    width: 13px;
    height: 13px;
    border: 1px solid #c0c0c0;
    cursor: pointer;
    box-sizing: border-box;
}

.palette-swatch:hover {
    border-color: #000;
}



/* Tabs MDI — inactif : enfoncé (inset) ; actif : surélevé (relief), relié à la zone client */
.tab {
    padding: 4px 12px 3px 12px;
    background: #b8b8b8;
    border: 2px solid;
    border-color: #808080 #ffffff #dfdfdf #808080;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    margin-right: 2px;
    font-size: 13px;
    cursor: pointer;
    min-width: 80px;
    text-align: center;
    position: relative;
    top: 2px;
    z-index: 1;
    font-weight: 600;
    box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.12);
}

.tab.active {
    padding: 5px 12px 4px 12px;
    top: 0;
    z-index: 3;
    font-weight: bold;
    background: #c0c0c0;
    border-color: #ffffff #808080 #808080 #ffffff;
    border-bottom-color: transparent;
    box-shadow: none;
}

.tab:hover:not(.active) {
    background: #bcbcbc;
}

#tab-bar-outer,
#tab-bar {
    z-index: 10;
}

/* Portée des effets : styles principaux dans theme-win98-modern.css (même look que les onglets MDI) */

/* Petits écrans : grille d’outils et barre d’options plus compactes */





/* Barre de statut : document ouvert / édition masque */
.status-bar-field.status-doc-open {
    font-weight: 600;
    padding-left: 8px;
    margin-left: 4px;
    border-left: 3px solid var(--mp-accent, #1e4a8c);
}

.status-bar-field.status-editing-mask {
    font-style: italic;
    border-left-color: #6b4fd6;
    opacity: 0.95;
}

body.theme-dark .status-bar-field.status-doc-open {
    border-left-color: var(--mp-accent);
}

.tab-thumb {
    display: block;
    object-fit: contain;
    border: 1px solid #808080;
    background: repeating-conic-gradient(#e0e0e0 0% 25%, #ffffff 0% 50%);
    background-size: 6px 6px;
    flex-shrink: 0;
    pointer-events: none;
}

#layers-list .layer-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    touch-action: none;
}

#layers-list .layer-row.layer-row--dragging {
    position: relative;
    z-index: 3;
    opacity: 0.95;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
    outline: 1px dotted #4a6cb4;
    outline-offset: 1px;
}

/* Champs RVB / TSV : assez larges, sans flèches spinner (navigateurs WebKit / Firefox). */
input.illu-num-input {
    min-width: 56px;
    width: 56px;
    max-width: 72px;
    box-sizing: border-box;
    text-align: right;
    -moz-appearance: textfield;
    appearance: textfield;
}

input.illu-num-input::-webkit-outer-spin-button,
input.illu-num-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#layers-list .layer-eye {
    flex-shrink: 0;
    cursor: pointer;
}

#layers-list .layer-thumb {
    display: block;
    object-fit: contain;
    border: 1px solid #a0a0a0;
    background: repeating-conic-gradient(#e8e8e8 0% 25%, #ffffff 0% 50%);
    background-size: 5px 5px;
    flex-shrink: 0;
    pointer-events: none;
}

#layers-list .layer-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#layers-list .layer-alpha-btn {
    flex-shrink: 0;
    font-size: var(--mp-ui-font-size, 13px);
    font-weight: bold;
    padding: 0 6px;
    min-width: var(--mp-control-min-height, 24px);
    min-height: var(--mp-control-min-height, 24px);
    line-height: 1.2;
    box-sizing: border-box;
    cursor: pointer;
    border: 1px solid #808080;
    background: #c0c0c0;
}

#layers-list .layer-dynfx-btn {
    flex-shrink: 0;
    font-size: var(--mp-ui-font-size, 13px);
    font-weight: 700;
    font-style: italic;
    padding: 0 6px;
    min-width: var(--mp-control-min-height, 24px);
    min-height: var(--mp-control-min-height, 24px);
    line-height: 1.2;
    box-sizing: border-box;
    cursor: pointer;
    border: 1px solid #808080;
    background: #c0c0c0;
    color: #333;
}

#layers-list .layer-dynfx-btn.layer-dynfx-btn--on {
    background: #dfe8ff;
    border-color: #4a6cb4;
    color: #1a3d7a;
}

#layers-list .layer-dynfx-btn.layer-dynfx-btn--disabled,
#layers-list .layer-dynfx-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

#layers-list .layer-dynfilter-alpha-preview-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    padding: 0 4px;
    min-width: 24px;
    min-height: 22px;
    line-height: 1;
    cursor: pointer;
    border: 1px solid #808080;
    background: #c0c0c0;
    color: #333;
}

#layers-list .layer-dynfilter-alpha-preview-btn i {
    pointer-events: none;
}

#layers-list .layer-dynfilter-alpha-preview-btn.layer-dynfilter-alpha-preview-btn--on {
    background: #fff3cd;
    border-color: #c9a227;
    color: #6b4e00;
}

#layers-list .layer-alpha-clear-btn {
    flex-shrink: 0;
    font-size: 10px;
    padding: 0 4px;
    min-width: 22px;
    line-height: 1.3;
    cursor: pointer;
    border: 1px solid #808080;
    background: #c0c0c0;
    color: #555;
}

#layers-list .layer-alpha-clear-btn:hover {
    background: #ffe0e0;
    border-color: #c44;
    color: #900;
}

/* Calque avec masque α lié : fond ambré (distinct du filtre dynamique violet). */
#layers-list .layer-row.layer-row--alpha-mask {
    background: linear-gradient(180deg, #fff8e6 0%, #ffecc4 100%);
    border-left: 3px solid #d4a017;
    box-sizing: border-box;
}

#layers-list .layer-row.layer-row--alpha-mask.active {
    background: linear-gradient(180deg, #b8860b 0%, #8a6508 100%);
    border-left-color: #ffdf7e;
    color: #fff;
}

#layers-list .layer-row.layer-row--alpha-mask.active .layer-name {
    color: #fff;
}

#layers-list .layer-row.layer-row--alpha-mask.active .layer-alpha-btn {
    color: #fff;
    font-weight: 700;
}

/* Panneau fusion / opacité : tailles alignées sur theme-win98-modern (#win-layers). */
#layer-bounds-panel.layer-bounds-panel-compact {
    padding: 6px 6px;
    font-size: var(--mp-ui-font-size, 13px);
    max-height: 92px;
    overflow: auto;
    flex-shrink: 0;
}

#layer-bounds-panel .layer-bounds-panel__row {
    flex-wrap: wrap;
    gap: 4px 6px;
    align-items: center;
    margin-bottom: 4px;
}

#layer-bounds-panel .layer-bounds-panel__label {
    min-width: 44px;
    flex-shrink: 0;
    font-size: inherit;
}

#layer-bounds-panel .layer-bounds-panel__blend {
    flex: 1;
    min-width: 0;
    font-size: inherit;
    line-height: 1.35;
    min-height: var(--mp-control-min-height, 24px);
    padding: 2px 6px;
    box-sizing: border-box;
}

#layer-bounds-panel .layer-bounds-panel__opacity-range {
    flex: 1;
    min-width: 48px;
}

#layer-bounds-panel .layer-bounds-panel__opacity-val {
    width: 28px;
    flex-shrink: 0;
    text-align: right;
    font-size: inherit;
}

/* Calque filtre dynamique (ƒ) : ligne distincte, masque = tampon seul (pas de masque α séparé). */
#layers-list .layer-row.layer-row--dyn-filter {
    background: linear-gradient(180deg, #ebe6f7 0%, #ddd4f2 100%);
    border-left: 3px solid #6b4fc9;
    box-sizing: border-box;
}

#layers-list .layer-row.layer-row--dyn-filter.active {
    background: linear-gradient(180deg, #5c4a9e 0%, #4a3a82 100%);
    border-left-color: #b9a6ff;
    color: #fff;
}

#layers-list .layer-row.layer-row--dyn-filter.active .layer-name {
    color: #fff;
}

#layers-list .layer-row.layer-row--dyn-filter.active .layer-dynfx-btn {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
}

#layers-list .layer-row.layer-row--dyn-filter.active .layer-dynfx-btn.layer-dynfx-btn--on {
    background: rgba(200, 210, 255, 0.35);
    border-color: #d0c4ff;
    color: #fff;
}

/* Gabarit Win98 (23×75 min) uniquement sur les vraies boîtes de dialogue — pas sur .tool-btn, onglets, etc. */
#dialog-overlay button,
#import-choice-overlay button,
#close-tab-overlay button,
#effect-dialog button:not(.illu-scope-btn) {
    min-height: 23px;
    min-width: 75px;
}

/* Jamais d’option « ombre » sous l’outil courbe 3 pts (si un fragment HTML existe encore). */
#tool-cubic-shadow-row {
    display: none !important;
}


.illu-mobile-drawer__sub-list {

    display: flex;
    flex-direction: column;
    /* align-content: flex-start; */
    /* flex-wrap: nowrap; */
    gap: 5px;
    margin: 5px;
}