.ky-labeller-container {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-color-popup);
    border-top-left-radius: 20px;
    font-family: var(--font-family);
    transition: .3s !important;
    position: relative;
    overflow: hidden;
}

.ky-labeller-loading-bar {
    width: 100%;
    height: .2rem;    
    background-color: var(--color-background-header);
}

.ky-labeller-toolbar {
    background-color: var(--color-background-header);
    padding: 3px;
    border-top-left-radius: 19px;
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    height: 36px;
}

.ky-draw-temp.dragging {
    cursor: grabbing !important;
}

.ky-labeller-rect {
  border: 2px solid #0000ff;
  background-color: transparent;
}

.ky-labeller-rect-label {
  position: relative;
  top: -18px;
  left: 0;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background-color: #0000ff;
  padding: 1px 5px;
  border-radius: 3px 3px 0 0;
  white-space: nowrap;
  pointer-events: none;
  line-height: 14px;
}

.ky-labeller-toolbar-content {
    padding-left: 3px;
    align-items: center;
    display: flex;
    justify-content: flex-start;
    flex-direction: row;
    flex-wrap: nowrap;       /* FORZA le icone su una sola riga */
    /* CANCELLA QUESTE RIGHE: */
    /* overflow-x: auto;    */
    /* overflow-y: hidden;  */
    
    /* AGGIUNGI QUESTA: */
    overflow: visible;
    height: 36px;            /* Leggermente alzato per fare respirare le icone */
    width: 100%;             /* Prende tutto lo spazio */
}

.ky-labeller-toolbar-content::-webkit-scrollbar {
    display: none;
}

.ky-labeller-toolbar-input {
    position: relative;
    height: 30px;
    width: 30px;
    padding: 0px;
    border: 0px;
    margin: 0px;
    margin-left: 6px;
    border-radius: 6px;
    background-color: transparent;
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ky-labeller-toolbar-input:not(.ky-labeller-toolbar-color) {
    color: var(--color-text);
}

.ky-labeller-toolbar-input:hover {
    background-color: var(--color-content);
}

.ky-labeller-toolbar-input-value {
    height: 28px;
    width: 48px;
    padding: 0px;
    border: 1px solid var(--color-content);
    margin: 0px;
    background-color: transparent;
    color: var(--color-text);
}

.ky-labeller-toolbar-option {
    background-color: var(--color-background-header);
}

.ky-toolbar-underline {
    display: none;
    height: 2px;
    width: 20px;
    background-color: red;
}

.ky-labeller-canvas {
    position: relative;
    transform-origin: top left; 
    /* Rende lo zoom dai bottoni fluido e non "a scatti" */
    transition: transform 0.2s ease-out;
    background-color: var(--background-popup);
    user-select: none;
    -webkit-user-select: none; 
    -ms-user-select: none;     
}

.ky-labeller-content {
    overflow: scroll;
    height: calc(100% - 36px);  
    /* user-select: none;
    -webkit-user-select: none; 
    -ms-user-select: none;      */
}

.ky-labeller-temp {
    position: relative;
    /* user-select: text !important;
    -webkit-user-select: text !important;
    pointer-events: auto; */
}

.ky-labeller-resizable-rect,
.ky-labeller-resizable-ellipse {
    position: relative;
    top: 10px;
    left: 10px;
    width: 90px;
    height: 90px;
    box-shadow: inset 0px 0px 0px 4px #000;
}

.ky-labeller-resizable-rect:hover,
.ky-labeller-resizable-ellipse:hover {
    cursor: grab;
}

.ky-labeller-resizable-rect:checked,
.ky-labeller-resizable-ellipse:checked {
    cursor: grabbing;
}

.ky-labeller-rect-resizer {
    position: relative;
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background-color: #00f;
    z-index: 10;
    visibility: hidden;
}

/* Top-left */
.ky-draw-rect-resizer-tl {
    top: -3px;
    left: -3px;
}

/* Top-right */
.ky-draw-rect-resizer-tr {
    top: -3px;
    left: calc(100% - 3px);
}

/* Bottom-left */
.ky-draw-rect-resizer-bl {
    top: calc(100% - 3px);
    left: -3px;
}

/* Bottom-right */
.ky-draw-rect-resizer-br {
    top: calc(100% - 3px);
    left: calc(100% - 3px);
}


/* Right Middle */
/* .ky-cad-rect-resizer-r,
.ky-cad-ellipse-resizer-r {
    top: 20px;
    left: 100px;
} */

/* Hover Cursors */
/* .ky-cad-rect-resizer-tl:hover,
.ky-cad-ellipse-resizer-tl:hover {
    cursor: nw-resize;
} */

.ky-labeller-rect-resizer-tr:hover,
.ky-labeller-ellipse-resizer-tr:hover {
    cursor: ne-resize;
}

.ky-labeller-rect-resizer-bl:hover,
.ky-labeller-ellipse-resizer-bl:hover {
    cursor: sw-resize;
}

.ky-labeller-rect-resizer-br:hover,
.ky-labeller-ellipse-resizer-br:hover {
    cursor: se-resize;
}

.ky-labeller-toolbar-hidden {
    display: none;
}

.ky-labeller-toolbar-dynamic-selected {
    color: var(--color-blue) !important;
    font-style: italic;
}

/* .ky-labeller-rect-resizer-l,
.ky-labeller-ellipse-resizer-l {
    top: 20px;
    left: 20px;
} */

.ky-labeller-resizable-text {
    position: relative;
    left: 20px;
    top: 5px;
    height: 30px;
    width: 80px;
    padding: 0px;
    margin: 0px;
    border: 0px;
    box-shadow: inset 0px 0px 0px 2px #00f;
    background: transparent;
    color: #000;
}

.ky-labeller-rect-resizer-r,
.ky-labeller-ellipse-resizer-r {
    top: 20px;
    left: 100px;
}

.ky-hide-block {
    display: none;
    visibility: hidden;
}

.ky-labeller-load {
    height: calc(100% - 36px);
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    background: rgba(141, 141, 141, 0.49);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.ky-labeller-load-center {
    height: 30px;
    width: 150px;
    display: flex;
}

.ky-labeller-load-mover {
    height: 30px;
    width: 30px;
    border-radius: 15px;
    position: relative;
}

.ky-labeller-load-mover-1 {
    background-color: white;
    left: 0px;
    animation-name: mover1;
    animation-duration: 4s;
    animation-iteration-count: infinite;
}

.ky-labeller-load-mover-2 {
    background-color: gray;
    left: 60px;
    animation-name: mover2;
    animation-duration: 4s;
    animation-iteration-count: infinite;
}

.ky-labeller-load-mover-3 {
    background-color: black;
    left: 120px;
    animation-name: mover3;
    animation-duration: 4s;
    animation-iteration-count: infinite;
}

@keyframes mover1 {
    0% {
        left: 0px;
    }

    50% {
        left: 120px;
    }

    100% {
        left: 0px;
    }
}

@keyframes mover2 {
    0% {
        left: 60px;
    }

    25% {
        left: 120px;
    }

    50% {
        left: 60px;
    }

    75% {
        left: 0px;
    }

    100% {
        left: 60px;
    }
}

@keyframes mover3 {
    0% {
        left: 120px;
    }

    50% {
        left: 0px;
    }

    100% {
        left: 120px;
    }
}

.ky-labeller-popup {
    position: absolute;
    width: 17rem;
    height: auto;
    min-height: 18rem;
    z-index: 9999;
    box-shadow: var(--window-shadow, 0px 0px 20px 0px rgba(0, 0, 0, 0.35));
    border-radius: var(--radius-content, 1rem);
    background: var(--color-content);
    transform: scale(calc(1 / var(--canvas-scale)));
    transform-origin: top left;    
    display: flex;
    flex-direction: column;
    gap: .4rem;
    justify-content: center;
}

.ky-labeller-popup,
.ky-labeller-popup {
    user-select: text !important;
    -webkit-user-select: text !important;
    pointer-events: auto;
} 

.ky-close-labeller-popup{
    position: relative;
    top: 1rem;
    left: 1rem;
    visibility: visible;
    cursor: pointer;
    z-index: 1;
}

/* .ky-confirm-cad-popup{
    position: relative;
    bottom: 1rem;
    left: calc(50% - 2rem);
} */

.ky-labeller-popup-buttons {
    display: flex;
    justify-content: center;
    gap: .35rem;
}

.ky-labeller-popup-content{
    margin: .9rem;
    padding-top: 0;
    display: flex;
    flex-direction: row;
    gap: .35rem;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-bottom: 0;
}


.ky-labeller-hidden{
    display: none;
}

.ky-labeller-boundaries{
    height: 17rem !important;
    background-color: var(--color-dbo-orange) !important;
}

.ky-labeller-toolbar-boundaries{
    text-align: center;
    word-break: break-all;
    font-size: .8rem;
    word-spacing:9999px;
}

.ky-labeller-popup-note{
    width: 15rem;
    word-break: break-all;
    word-spacing:9999px;
    height: 6rem;
}

.ky-labeller-popup-title{
    word-break: keep-all;
    color: var(--color-text);
    text-align: center;
    font-size: 1.2rem;
}

/* Posizionamento del contenitore del colore */
.ky-labeller-color-picker-wrapper {
    position: relative;
    display: inline-block;
}

/* La tendina a comparsa */
.ky-labeller-color-dropdown {
    position: absolute;
    top: 36px;
    left: 6px;
    background-color: var(--color-content, #ffffff);
    border: 1px solid var(--border-color-popup, #ccc);
    border-radius: 6px;
    padding: 8px;
    display: none;           /* ← nascosto di default */
    flex-direction: row;     /* ← AGGIUNGI QUESTO */
    flex-wrap: wrap;         /* ← rimane com'era */
    width: 100px;
    gap: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* I singoli pallini di colore */
.ky-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

.ky-color-swatch:hover {
    transform: scale(1.2);
}

.ky-labeller-toolbar-input-color {
    height: 28px;
    width: 40px;
    padding: 2px;
    border: 1px solid var(--color-content);
    margin: 0px;
    margin-left: 6px;
    border-radius: 6px;
    cursor: pointer;
}
/* 1. Quando NESSUNO STRUMENTO è attivo: Mostra il cursore di spostamento */
.ky-labeller-canvas:not(.ky-is-drawing) .ky-labeller-overlay-svg rect[data-id]:not(.ky-labeller-temp):hover {
    cursor: move;
}

/* 2. Quando SIAMO IN FASE DI DISEGNO: Mantieni il mirino anche se passi sopra un rettangolo! */
.ky-labeller-canvas.ky-is-drawing .ky-labeller-overlay-svg rect[data-id]:not(.ky-labeller-temp):hover {
    cursor: crosshair;
}