﻿/* =========================================================
   Inventory.css (Globale riutilizzabile)
   - Palette tema InventoryOne BLU
   - Buttons .btn + variants
   - Focus ring accessibile
   - Campi form comuni (.txt)
   - Overlay comune
   - Dialog messaggi
   - Bottoni azione griglie
   - Upload overlay + spinner
   ========================================================= */

:root {
    --inventory-blue: #1861b2;
    --inventory-blue-hover: #0f4f9d;
    --inventory-blue-light: #7fb0ee;
    --inventory-blue-soft: #eef5ff;
    --inventory-blue-soft-2: #eaf3ff;
    --inventory-blue-border: rgba(24, 97, 178, 0.35);
    --inventory-blue-focus: rgba(24, 97, 178, 0.22);
    --inventory-blue-focus-light: rgba(24, 97, 178, 0.32);
    --field-border: #d8dde8;
    --field-bg: #ffffff;
    --field-bg-disabled: #f2f3f7;
    --field-text-disabled: #6c717a;
    --field-placeholder: rgba(31, 35, 40, .45);
}

/* -------------------------
   BOTTONI COMUNI
   ------------------------- */
.btn {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--inventory-blue);
    background: var(--inventory-blue);
    color: #fff;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: transform .06s ease, filter .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}

    .btn:hover {
        background: var(--inventory-blue-hover);
        border-color: var(--inventory-blue-hover);
        filter: none;
    }

    .btn:active {
        transform: translateY(1px);
    }

    .btn:disabled,
    .btn[disabled] {
        opacity: .55;
        cursor: not-allowed;
        transform: none;
    }

/* varianti */
.btn-secondary {
    background: #6f86a8;
    border-color: #5b7396;
    color: #fff;
}

    .btn-secondary:hover {
        background: #5b7396;
        border-color: #4c6487;
    }

.btn-danger {
    background: #d92c2c;
    border-color: #b92323;
    color: #fff;
}

    .btn-danger:hover {
        background: #c32626;
        border-color: #a91f1f;
    }

.btn-outline-secondary {
    background: #fff !important;
    color: var(--inventory-blue) !important;
    border: 1px solid var(--inventory-blue) !important;
}

    .btn-outline-secondary:hover {
        background: var(--inventory-blue-soft) !important;
        border-color: var(--inventory-blue-hover) !important;
        color: var(--inventory-blue-hover) !important;
    }

/* LinkButton come disabled */
.btn.disabled,
a.btn.disabled {
    opacity: .55 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    transform: none !important;
}

a.btn {
    text-decoration: none !important;
}

    a.btn:hover {
        text-decoration: none !important;
    }

/* -------------------------
   FOCUS ACCESSIBILE BOTTONI
   ------------------------- */
.btn:focus,
.btn:focus-visible,
.e-btn:focus,
.e-btn:focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 3px var(--inventory-blue-focus-light) !important;
    border-color: var(--inventory-blue) !important;
}

button.btn::-moz-focus-inner {
    border: 0;
}

/* -------------------------
   CAMPI FORM COMUNI
   - usare CssClass="txt"
   ------------------------- */
.txt {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--field-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
    background: var(--field-bg);
    color: inherit;
}

    .txt:focus,
    .txt:focus-visible {
        border-color: var(--inventory-blue-light);
        box-shadow: 0 0 0 0.25rem var(--inventory-blue-focus-light);
    }

    .txt:disabled,
    .txt[disabled],
    .txt[readonly] {
        background: var(--field-bg-disabled);
        color: var(--field-text-disabled);
    }

    .txt::placeholder {
        color: var(--field-placeholder);
        opacity: 1;
    }

/* textarea/select se usati con classe txt */
textarea.txt {
    min-height: 90px;
    resize: vertical;
}

select.txt {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* -------------------------
   OVERLAY COMUNE
   ------------------------- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 30, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
    padding: 18px;
}

    .overlay .box {
        width: min(420px, 92vw);
        border-radius: 14px;
        background: #fff;
        padding: 18px;
        box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
        border: 1px solid #e7e9ee;
    }

/* -------------------------
   DIALOG MESSAGGI
   ------------------------- */
#dlgMsg .msg-wrap,
.msg-wrap {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    align-items: start;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #e7e9ee;
    background: #fff;
}

#dlgMsg .msg-icon,
.msg-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--inventory-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 20px;
    line-height: 1;
}

#dlgMsg .msg-title,
.msg-title {
    font-weight: 800;
    font-size: 16px;
    margin-bottom: 4px;
}

#dlgMsg .msg-text,
.msg-text {
    font-size: 14px;
    line-height: 1.35;
    color: #40454f;
    word-break: break-word;
    white-space: pre-line;
}

#dlgMsg .msg-actions,
.msg-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

/* stati */
#dlgMsg .msg-wrap.success .msg-icon,
.msg-wrap.success .msg-icon {
    background: #e9fbf0;
    color: #1f7a3b;
}

#dlgMsg .msg-wrap.error .msg-icon,
.msg-wrap.error .msg-icon {
    background: #ffecec;
    color: #b42318;
}

#dlgMsg .msg-wrap.warn .msg-icon,
.msg-wrap.warn .msg-icon {
    background: #fff7e6;
    color: #b45309;
}

#dlgMsg .msg-wrap.info .msg-icon,
.msg-wrap.info .msg-icon {
    background: var(--inventory-blue-soft-2);
    color: var(--inventory-blue);
}

/* simboli */
#dlgMsg .msg-wrap.success .msg-icon::before,
.msg-wrap.success .msg-icon::before {
    content: "✓";
}

#dlgMsg .msg-wrap.error .msg-icon::before,
.msg-wrap.error .msg-icon::before {
    content: "!";
}

#dlgMsg .msg-wrap.warn .msg-icon::before,
.msg-wrap.warn .msg-icon::before {
    content: "⚠";
    font-size: 18px;
}

#dlgMsg .msg-wrap.info .msg-icon::before,
.msg-wrap.info .msg-icon::before {
    content: "i";
    font-size: 18px;
}

.msg-pop {
    animation: msgPop .22s ease-out;
}

@keyframes msgPop {
    0% {
        transform: scale(.98);
        opacity: .6;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* -------------------------
   IMPORT LOG VIEWER
   ------------------------- */
.import-log-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100vh - 170px);
    max-height: 620px;
    min-height: 320px;
    padding: 10px 6px 2px;
    box-sizing: border-box;
}

@supports (height: 100dvh) {
    .import-log-wrap {
        height: calc(100dvh - 170px);
    }
}

.import-log-pre {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid #e7e9ee;
    border-radius: 12px;
    background: #f7fbff;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font: 12px/1.45 Consolas, "Courier New", monospace;
    color: #2b2f36;
}

.import-log-wrap .msg-actions {
    flex: 0 0 auto;
    margin-top: 0;
}

/* -------------------------
   BOTTONI AZIONE GRIGLIE
   ------------------------- */
.inv-act-btn {
    border: 1px solid #d8dde8 !important;
    background: #fff !important;
    border-radius: 10px !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    transition: transform .06s ease, background .15s ease, border-color .15s ease;
}

    .inv-act-btn:hover {
        background: var(--inventory-blue-soft) !important;
        border-color: #c8dcf8 !important;
    }

    .inv-act-btn:active {
        transform: translateY(1px);
    }

.inv-act-del:hover {
    background: #fff3f3 !important;
    border-color: #ffd0d0 !important;
}

.inv-ico {
    display: inline-block;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.inv-ico-edit:before {
    content: "✎";
    font-size: 16px;
    font-weight: 900;
    color: var(--inventory-blue);
}

.inv-ico-del:before {
    content: "🗑";
    font-size: 16px;
    color: #d92c2c;
}

/* -------------------------
   UPLOAD OVERLAY + SPINNER
   ------------------------- */
.inv-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(1px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
}

.inv-upload-overlay-box {
    display: grid;
    grid-template-columns: 22px 1fr;
    column-gap: 12px;
    row-gap: 3px;
    align-items: start;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, .10);
    background: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .10);
}

.inv-upload-overlay-text {
    font-weight: 800;
    opacity: .85;
}

.inv-spinner,
.inv-upload-loading-spinner,
.loading-spinner,
.pln-loading-spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid rgba(24, 97, 178, .18);
    border-top-color: rgba(24, 97, 178, 1);
    animation: invSpin .8s linear infinite;
}

@keyframes invSpin {
    to {
        transform: rotate(360deg);
    }
}

/* -------------------------
   UPLOAD DIALOG COMUNE
   ------------------------- */
.btn-primary {
    background: var(--inventory-blue);
    border-color: var(--inventory-blue);
    color: #fff;
}

    .btn-primary:hover,
    .btn-primary:active,
    .btn-primary.active {
        background: var(--inventory-blue-hover);
        border-color: var(--inventory-blue-hover);
        color: #fff;
    }

    .btn-primary:focus,
    .btn-primary.focus {
        background: var(--inventory-blue);
        border-color: var(--inventory-blue);
        color: #fff;
        box-shadow: 0 0 0 0.25rem var(--inventory-blue-focus-light);
    }

#dlgUpload {
    position: relative;
    min-width: 320px;
    padding: 12px;
}

.inv-upload-hint {
    font-size: 13px;
    font-weight: 700;
    color: rgba(31, 35, 40, .72);
    margin-bottom: 10px;
}

.inv-upload-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

#dlgUpload .inv-upload-actions .btn {
    height: 36px !important;
    padding: 0 14px !important;
    border-radius: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.inv-upload-msg {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.25;
    color: rgba(31, 35, 40, .75);
    word-break: break-word;
}

/* -------------------------
   Telerik RadAsyncUpload
   ------------------------- */
#dlgUpload .RadAsyncUpload,
#dlgUpload .RadAsyncUpload * {
    box-sizing: border-box;
}

#dlgUpload .RadAsyncUpload {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

    #dlgUpload .RadAsyncUpload .ruSelectWrap {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }

    #dlgUpload .RadAsyncUpload .ruFakeInput {
        width: 320px !important;
        height: 36px !important;
        line-height: 36px !important;
        border-radius: 10px !important;
    }

    #dlgUpload .RadAsyncUpload .ruBrowse {
        height: 36px !important;
        line-height: 36px !important;
        padding: 0 14px !important;
        border-radius: 10px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

        #dlgUpload .RadAsyncUpload .ruBrowse span {
            white-space: nowrap !important;
        }

@media (max-width: 520px) {
    #dlgUpload {
        min-width: 0;
    }

        #dlgUpload .RadAsyncUpload {
            flex-direction: column !important;
            align-items: stretch !important;
        }

            #dlgUpload .RadAsyncUpload .ruFakeInput {
                width: 100% !important;
            }

    .inv-upload-actions {
        justify-content: center;
    }

    #dlgUpload .inv-upload-actions .btn {
        flex: 1 1 calc(50% - 10px);
        min-width: 140px;
    }
}

/* -------------------------
   PAGE LOADING OVERLAY
   - usato per loadingOverlay delle pagine CRUD
   ------------------------- */
#loadingOverlay.overlay {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    padding: 18px;
    box-sizing: border-box;
    z-index: 999999 !important;
}

@supports (height: 100dvh) {
    #loadingOverlay.overlay {
        height: 100dvh;
        min-height: 100dvh;
    }
}

#loadingOverlay.overlay .box {
    margin: 0 !important;
}

/* =========================================================
   GLOBAL PAGE LOADING OVERLAY
   - spinner + titolo + testo
   ========================================================= */
#loadingOverlay.overlay .box,
#plnLoadingOverlay .box,
#plnLoadingOverlayLong .box {
    width: min(460px, calc(100% - 44px));
    max-width: calc(100% - 44px);
}

.loading-row,
.pln-loading-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    column-gap: 12px;
    row-gap: 3px;
    align-items: start;
}

.loading-spinner,
.pln-loading-spinner {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    margin-top: 2px;
}

.loading-content,
.pln-loading-content {
    grid-column: 2;
    min-width: 0;
}

.loading-title,
.pln-loading-title {
    margin: 0 0 4px 0;
    font-weight: 800;
    line-height: 1.2;
}

.loading-text,
.pln-loading-text {
    margin: 0;
    line-height: 1.2;
}

/* =========================================================
   UPLOAD OVERLAY CONTENT
   - spinner + titolo + testo
   ========================================================= */
.inv-upload-loading-spinner {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    margin-top: 2px;
}

.inv-upload-loading-content {
    grid-column: 2;
    min-width: 0;
}

.inv-upload-loading-title {
    margin: 0 0 4px 0;
    font-weight: 800;
    line-height: 1.2;
}

.inv-upload-loading-text {
    margin: 0;
    line-height: 1.2;
}

.inv-upload-overlay-text {
    font-weight: 800;
    opacity: .85;
}
