/**
 * Studio : barre d'édition de l'objet sélectionné (texte, image).
 */

/* ---------- Barre d'édition (texte, image) : flottante au-dessus du produit ---------- */
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools {
    background: #fff !important;
    border: 1px solid var(--ptc-trait);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
}
/* Rien de sélectionné : pas de barre */
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools[data-view="standard"],
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools[data-view="standard"],
html:where(.ptc-ui).ptc-mob body div#LumiseDesign div#lumise-top-tools[data-view="standard"] {
    display: none !important;
}

/* « Dupliquer » et « Supprimer » au bout de la barre (toolbar.js, buildObjectActions) */
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools > ul.ptc-tb-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 0 0 6px;
    padding: 0 0 0 8px;
    border-left: 1px solid var(--ptc-trait);
    float: none;
    list-style: none;
    order: 3;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools > ul.ptc-tb-actions > li {
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    height: auto !important;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools .ptc-tb-action button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px !important;
    height: 36px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ptc-encre) !important;
    cursor: pointer;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools .ptc-tb-action button svg {
    width: 19px;
    height: 19px;
}
/* Icônes seules, comme Spreadshirt : le nom au survol et pour les lecteurs d'écran */
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools .ptc-tb-action button span {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools .ptc-tb-action button:hover {
    background: var(--ptc-gris) !important;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools .ptc-tb-action.is-del button:hover {
    color: var(--ptc-rose) !important;
}

/* La molette dans le studio ne fait jamais défiler la page autour (iframe) */
html:where(.ptc-ui) {
    overscroll-behavior: none;
}

html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools {
    position: fixed !important;
    top: 14px !important;
    left: calc(var(--ptc-centre-x) + var(--ptc-centre-l) / 2) !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: max-content !important;
    min-width: 0 !important;
    max-width: calc(var(--ptc-centre-l) - 32px) !important;
    height: auto !important;
    padding: 2px 10px !important;
    border-radius: 22px;
    /* Les groupes d'outils de Lumise côte à côte, sur 2 lignes si besoin */
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools > ul.lumise-top-nav {
    float: none !important;
}
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools > ul.lumise-top-nav.right {
    order: 2;
}
/* Tiroir ouvert : la barre d'édition se centre sur la partie encore visible */
html:where(.ptc-ui).ptc-desk body:has(#lumise-text.active, #lumise-uploads.active, #lumise-templates.active) div#LumiseDesign div#lumise-top-tools {
    left: calc(var(--ptc-centre-x) + var(--ptc-tiroir) + (var(--ptc-centre-l) - var(--ptc-tiroir)) / 2) !important;
    max-width: calc(var(--ptc-centre-l) - var(--ptc-tiroir) - 24px) !important;
}

/* Barre d'édition sous la barre du haut, défilante si elle est longue */
html:where(.ptc-ui).ptc-mob body div#LumiseDesign div#lumise-top-tools {
    position: fixed !important;
    top: calc(var(--ptc-haut-m) + 4px) !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 6px !important;
    border-radius: 16px;
    z-index: 100001 !important;
    /* Une seule ligne qui défile, comme sur Spreadshirt */
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
html:where(.ptc-ui).ptc-mob body div#LumiseDesign div#lumise-top-tools > ul.lumise-top-nav {
    float: none !important;
    flex: 0 0 auto;
    width: auto !important;
    white-space: nowrap;
}
html:where(.ptc-ui).ptc-mob body div#LumiseDesign div#lumise-top-tools > ul.lumise-top-nav > li {
    float: none !important;
    display: inline-block;
    vertical-align: middle;
}
/* Générateur de QR code : désactivé dans les réglages, Lumise le cache autrement */
html:where(.ptc-ui).ptc-mob body div#LumiseDesign div#lumise-top-tools li[data-tool="qrcode-text"] {
    display: none !important;
}

/* Barre d'édition, ordinateur et mobile : texte d'abord (police, gras…), puis
   couleur et placement, puis Dupliquer / Supprimer */
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools > ul[data-mode="text"] {
    order: 1;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools > ul[data-mode="image"] {
    order: 1;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools > ul[data-mode="standard"] {
    order: 2;
}

/* Barre d'édition : « Couleur » (pastille) et « Taille » écrits en clair (toolbar.js, labelTools) */
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools span.ptc-tb-labelled {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    padding: 0 10px;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools li[data-tool="fill"] > span.ptc-tb-labelled > i {
    display: none !important;
}
:where(html.ptc-ui) .ptc-tb-swatch {
    display: inline-block;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2);
}
:where(html.ptc-ui) .ptc-tb-label {
    font-style: normal;
    font-size: 13px;
    font-weight: 600;
    color: var(--ptc-encre);
    white-space: nowrap;
}

/* Barre d'édition sur une ligne : outils plus serrés ; « Position » (verrouiller
   l'objet) retiré, rarement utile ici ; libellés cachés si la colonne est étroite */
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools li[data-tool="position"] {
    display: none !important;
}
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools > ul.lumise-top-nav > li {
    min-width: 0 !important;
}
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools > ul.lumise-top-nav > li > span[data-tip]:not(.ptc-tb-labelled) {
    padding-left: 9px !important;
    padding-right: 9px !important;
}
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools li[data-tool="font"] button.dropdown {
    max-width: 140px !important;
}
@media (max-width: 1400px) {
    html:where(.ptc-ui).ptc-desk .ptc-tb-label:not(.ptc-tb-label--keep) {
        display: none;
    }
}
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools > ul.lumise-top-nav:not(.ptc-tb-actions) > li {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Barre d'édition : champ « Ton texte » en tête (toolbar.js, buildTextField) */
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools > ul.ptc-tb-text {
    display: flex;
    align-items: center;
    order: 0;
    float: none;
    margin: 0 6px 0 0;
    padding: 0;
    list-style: none;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools > ul.ptc-tb-text[hidden] {
    display: none !important;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools > ul.ptc-tb-text > li {
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}
:where(html.ptc-ui) .ptc-tb-input {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 170px;
    min-height: 36px;
    margin: 0;
    padding: 0 10px;
    box-sizing: border-box;
    border: 1px solid #d5d5d5;
    border-radius: 18px;
    background: #fff;
    cursor: text;
}
:where(html.ptc-ui) .ptc-tb-input:focus-within {
    border-color: var(--ptc-encre);
}
:where(html.ptc-ui) .ptc-tb-input svg {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    color: var(--ptc-doux);
}
html:where(.ptc-ui) body div#LumiseDesign .ptc-tb-input textarea {
    flex: 1 1 auto;
    width: 100% !important;
    min-width: 0;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    border: 0 !important;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ptc-encre) !important;
    font: inherit;
    font-size: 14px !important;
    line-height: 18px !important;
    resize: none;
    overflow: hidden;
}
html:where(.ptc-ui).ptc-mob .ptc-tb-input {
    width: 150px;
}
/* Écran moyen : « Couleur » en pastille seule, pour garder la barre sur une ligne */
@media (max-width: 1700px) {
    html:where(.ptc-ui).ptc-desk .ptc-tb-label:not(.ptc-tb-label--keep) {
        display: none;
    }
}

/* Sous-menu Couleur de la barre d'édition : pastilles rondes, sans défilement */
html:where(.ptc-ui) body div#LumiseDesign #lumise-top-tools ul.lumise-color-presets {
    display: grid !important;
    grid-template-columns: repeat(6, 28px);
    gap: 10px;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    margin: 12px 0 4px !important;
    padding: 0 !important;
}
html:where(.ptc-ui) body div#LumiseDesign #lumise-top-tools ul.lumise-color-presets li {
    width: 28px !important;
    height: 28px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
    cursor: pointer;
    transition: transform .12s;
}
html:where(.ptc-ui) body div#LumiseDesign #lumise-top-tools ul.lumise-color-presets li:hover {
    transform: scale(1.12);
}
html:where(.ptc-ui) body div#LumiseDesign #lumise-top-tools #lumise-fill,
html:where(.ptc-ui) body div#LumiseDesign #lumise-top-tools #lumise-stroke {
    height: 36px !important;
    border: 1px solid #d5d5d5 !important;
    border-radius: 18px !important;
    padding: 0 14px !important;
    font-size: 13px !important;
}

/* ---------- Barre d'une image : l'essentiel, nommé en clair ---------- */
/* Masque (réservé aux modèles), « Effacer les filtres » (les Filtres ont déjà
   « Original ») et Couleur (sans effet sur une photo) : cachés */
:where(html.ptc-ui) body div#LumiseDesign div#lumise-top-tools li[data-tool="masks"],
:where(html.ptc-ui) body div#LumiseDesign div#lumise-top-tools li[data-callback="imageFXReset"],
:where(html.ptc-ui) body div#LumiseDesign div#lumise-top-tools[data-view="image"] li[data-tool="fill"] {
    display: none !important;
}

/* ---------- Barre d'édition : ce qui ne sert pas au client ---------- */
/* « Transformations » (rotation et inclinaison par curseurs) : la rotation se
   fait avec la poignée, l'inclinaison déforme le texte ou l'image sans intérêt */
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools li[data-tool="transform"] {
    display: none !important;
}
/* Champ « Ton texte » centré dans la hauteur de la barre */
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools ul.ptc-tb-text {
    align-self: stretch;
    display: flex;
    align-items: center;
}
html:where(.ptc-ui) body div#LumiseDesign div#lumise-top-tools ul.ptc-tb-text > li {
    display: flex !important;
    align-items: center;
    height: 100% !important;
}

/* Barre d'édition (ordinateur) : les infobulles s'ouvrent sous la barre, pas
   au-dessus où elles étaient coupées par le haut du studio */
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools [data-tip="true"] > span:not(.ptc-tb-label) {
    top: calc(100% + 12px) !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    z-index: 30 !important;
    padding: 5px 10px !important;
    border-radius: 6px !important;
    background: var(--ptc-encre, #222) !important;
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 16px !important;
    pointer-events: none;
}
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools [data-tip="true"]:hover > span:not(.ptc-tb-label) {
    top: calc(100% + 8px) !important;
}
html:where(.ptc-ui).ptc-desk body div#LumiseDesign div#lumise-top-tools [data-tip="true"] > span:not(.ptc-tb-label)::after {
    top: auto !important;
    bottom: 100% !important;
    border: 5px solid transparent !important;
    border-bottom-color: var(--ptc-encre, #222) !important;
}
