/*
  Riquadri e file del planogramma (libreria Manet.VisionDA.Components.Planogram).
  Un solo foglio per App, Dashboard e Web App: prima ogni host ne teneva una copia che divergeva.
  Nessuna dipendenza da Tailwind/daisyUI: i colori del tema entrano dalle variabili daisyUI quando ci
  sono (--color-primary, --color-error, --color-warning, --color-base-200) con un ripiego fisso.
  Gli host lo includono con <link href="_content/Manet.VisionDA.Components.Planogram/planogram.css">.
*/

/* #region Fila (tray) */

.tray-grid {
    --tray-cols: 8;
    --spring-size: 40px;
    display: flex;
    gap: 3px;
    position: relative;
    min-width: calc(var(--spring-size) * var(--tray-cols));
}

    .tray-grid.tray-grid-labeled {
        margin-left: 14px;
    }

.spring-status-wrapper {
    position: relative;
    border-radius: 6px;
}

    .spring-status-wrapper.spring-status-wrapper-error {
        box-shadow: 0px 0px 4px 0px #ff3b00;
    }

    .spring-status-wrapper.spring-status-wrapper-selected {
        filter: brightness(1.1);
        outline: 2px solid #ffffffa6;
        z-index: 1;
    }

.tray-sidelabel {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 100%;
    margin: 0;
    padding-right: 2px;
    overflow: hidden;
    font-size: 8px;
    line-height: 1;
    text-wrap: nowrap;
    text-orientation: upright;
    writing-mode: vertical-rl;
    text-transform: uppercase;
    opacity: .7;
}

/* #endregion */

/* #region Riquadro (spring box) */

.spring-box {
    --color-1: #494949;
    --color-2: #12121e;
    --spring-colspan: 1.0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    flex: 1 1 auto;
    background: #22222c;
    color: #ffffff;
    height: 80px;
    border: 1px solid #ffffff26;
    min-width: calc(var(--spring-size, 40px) * var(--spring-colspan));
    position: relative;
    transform-origin: center center;
    z-index: 1;
    box-sizing: border-box;
}

.tray-grid .spring-box {
    flex: 0 0 calc((100% - (var(--tray-cols) - 1) * 3px) / var(--tray-cols) * var(--spring-colspan));
}

    .tray-grid .spring-box.spring-box-auto {
        flex: 1 1 auto;
    }

.spring-box.spring-box-compact {
    height: 36px;
    border-radius: 4px;
    --spring-size: 28px;
}

.spring-box.spring-box-inline {
    height: 25px;
    width: 25px;
    min-width: 25px;
    flex: 0 0 25px;
    border-radius: 6px;
}

.spring-box.spring-box-clickable {
    cursor: pointer;
}

.spring-box.spring-box-selected {
    outline: 2px solid var(--color-primary, #6d5dfc);
    box-shadow: 0 0 4px 1px var(--color-primary, #6d5dfc);
    z-index: 2;
}

/* Legato a ciò che è sotto il mouse (classi messe dal JS dell'host): bordo FISSO (hv-strong); per i
   contatori e la legenda (hv-anim) il bordo girevole della Web App (conic-gradient + --border-angle).
   Mentre qualcosa è sotto il mouse (html.hv-active) la selezione col click non si mostra. */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.spring-box.hv-strong {
    outline: 2px solid var(--color-warning, #ff8c00);
    outline-offset: 1px;
    box-shadow: 0 0 6px 1px var(--color-warning, #ff8c00);
    z-index: 3;
}

.spring-box.hv-strong.hv-anim {
    outline: none;
    box-shadow: none;
    --border-angle: 0deg;
}

    .spring-box.hv-strong.hv-anim::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        padding: 2px;
        background-image: conic-gradient(from var(--border-angle), transparent 55%, #3cb5e3, #7156f2);
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask-composite: exclude;
        animation: spin-border 2.5s linear infinite;
        pointer-events: none;
        z-index: 4;
    }

@keyframes spin-border {
    from { --border-angle: 0deg; }
    to { --border-angle: 360deg; }
}

html.hv-active .spring-box.spring-box-selected:not(.hv-strong) {
    outline: none;
    box-shadow: none;
}

    html.hv-active .spring-box.spring-box-selected:not(.hv-strong)::after {
        display: none;
    }

.spring-box::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-radius: 2px;
    transition: all 0.1s linear;
}

.spring-box.spring-box-clickable:hover::after,
.spring-box.spring-box-selected::after {
    --arrow-size: 8px;
    border-left: var(--arrow-size) solid transparent;
    border-right: var(--arrow-size) solid transparent;
    border-top: var(--arrow-size) solid #e8e8e8;
}

.spring-box .spring-box-body {
    width: 100%;
    position: relative;
    text-align: center;
}

.spring-box .spring-status-top-left-info {
    position: absolute;
    top: 4px;
    left: 4px;
}

.spring-box .spring-status-top-info {
    position: absolute;
    top: 4px;
    right: 4px;
}

.spring-box .spring-status-bottom-info {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
}

.spring-box .spring-status-center {
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    color: #ffffff;
    margin: 0;
}

.spring-box.spring-box-compact .spring-status-center {
    font-size: 0.65rem;
    padding: 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spring-box .spring-status-color {
    margin-top: 4px;
    height: 3px;
    flex-grow: 1;
    position: relative;
}

    .spring-box .spring-status-color::before,
    .spring-box .spring-status-color::after {
        content: "";
        position: absolute;
        inset: 0;
        background-color: var(--color-2);
        border-radius: 1px;
    }

    .spring-box .spring-status-color::before {
        filter: blur(2px);
        opacity: 1;
        transform: translateY(-1px);
    }

/* #endregion */

/* #region Colori (una classe per SpringBoxColor) */

.spring-box.planogram-spring {
    --color-1: #494949;
    --color-2: #5a5a66;
}

.spring-box.missingtraining {
    --color-1: #d254ff;
    --color-2: #8657ff;
}

.spring-box.ok {
    --color-1: #007d27;
    --color-2: #4fe57e;
}

.spring-box.okbutcheck {
    --color-1: #007d27;
    --color-2: #ff8800;
}

.spring-box.okempty {
    --color-1: #007d27;
    --color-2: #14141e;
}

.spring-box.okupdated {
    --color-1: #000dff;
    --color-2: #5e65f9;
}

.spring-box.okupdatedbutcheck {
    --color-1: #000dff;
    --color-2: #ff8800;
}

.spring-box.okupdatedempty {
    --color-1: #000dff;
    --color-2: #14141e;
}

.spring-box.ko {
    --color-1: #f50000;
    --color-2: #ff3b00;
}

.spring-box.koempty {
    --color-1: #f50000;
    --color-2: #14141e;
}

.spring-box.koplanogram {
    --color-1: #202020;
    --color-2: #272727;
    border: 1px dashed var(--color-error, #f50000);
}

.spring-box.komanualcheck {
    --color-1: #202020;
    --color-2: #272727;
    border: 1px dashed var(--color-warning, #ffad3c);
}

.spring-box.komissingoncatalog {
    --color-1: #ffd53c;
    --color-2: #ff3b00;
}

.spring-box.kowarning {
    --color-1: #ffad3c;
    --color-2: #ffd53c;
}

.spring-box.oknorequirements {
    --color-1: #f5f5f5;
    --color-2: #c5c5c5;
}

/* #endregion */

/* #region Nodo apri/chiudi (collapser) */

.pg-collapser {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    background: var(--color-base-200, #f3f4f6);
    width: fit-content;
    min-width: 100%;
    box-sizing: border-box;
}

.pg-collapser.pg-collapser-open {
    margin-bottom: 1rem;
}

.pg-collapser-header {
    display: flex;
    flex-grow: 1;
    padding: .5rem .75rem;
    border-radius: 8px;
}

    .pg-collapser-header.pg-collapser-clickable {
        cursor: pointer;
    }

        .pg-collapser-header.pg-collapser-clickable:hover {
            background-color: #adadb11f;
        }

.pg-collapser-content {
    padding: 0;
    width: min(100%, calc(100vw - 20px));
    position: sticky;
    left: 0;
    border-radius: 6px;
}

.pg-collapser-close {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: .5rem;
    cursor: pointer;
    opacity: .6;
}

    .pg-collapser-close:hover {
        opacity: 1;
        background-color: #adadb11f;
    }

/* #endregion */
