﻿/* ------------ Varianti tema ------------ */
.dl-grid.dl-light {
    --rg-border: #e1e1e1;
    --rg-bg: #ffffff;
    --rg-bg-2: #fafafa;
    --rg-header: #f4f4f4;
    --rg-header-text: #222;
    --rg-text: #222;
    --rg-accent: #2d7bdc;
    --rg-accent-2: #1e5fb0;
    --rg-shadow: rgba(0,0,0,.08);
    --btn-bg: #f5f5f5;
    --btn-bg-hover: #efefef;
    --btn-border: #d6d6d6;
    --btn-text: #222;
    --zebra1: #ffffff;
    --zebra2: #f9f9f9;
}

.dl-grid.dl-dark {
    --rg-border: #2c2c2c;
    --rg-bg: #1f1f1f;
    --rg-bg-2: #262626;
    --rg-header: #111;
    --rg-header-text: #eee;
    --rg-text: #e6e6e6;
    --rg-accent: #3fa9f5;
    --rg-accent-2: #2c7fbd;
    --rg-shadow: rgba(0,0,0,.35);
    --btn-bg: #3a3a3a;
    --btn-bg-hover: #4a4a4a;
    --btn-border: #5a5a5a;
    --btn-text: #f3f3f3;
    --zebra1: #2a2a2a;
    --zebra2: #242424;
}

/* ------------ Wrapper principale ------------ */
.dl-grid {
    /* nessuna palette, dipende dalla classe dl-light/dl-dark */
}

    .dl-grid > .aspNet-UpdatePanel,
    .dl-grid > .aspNet-UpdatePanel * {
        box-sizing: border-box;
    }

    /* blocco complessivo (card) */
    .dl-grid .card {
        background: var(--rg-bg);
        color: var(--rg-text);
        border: 1px solid var(--rg-border);
        border-radius: 12px;
        box-shadow: 0 8px 20px var(--rg-shadow);
        padding: 16px;
    }

    /* barra ricerca (primo div della DualList) */
    .dl-grid .searchbar {
        background: var(--rg-header);
        color: var(--rg-header-text);
        border: 1px solid var(--rg-border);
        border-radius: 10px;
        padding: 8px 10px;
        margin-bottom: 12px;
    }

        .dl-grid .searchbar input[type="text"] {
            background: var(--rg-bg-2);
            color: var(--rg-header-text);
            border: 1px solid var(--rg-border);
            border-radius: 8px;
            padding: 6px 8px;
            outline: none;
        }

            .dl-grid .searchbar input[type="text"]:focus {
                border-color: var(--rg-accent);
                box-shadow: 0 0 0 3px rgba(45,123,220,.15);
            }

    /* intestazioni Available/Selected */
    .dl-grid .section-title {
        display: block;
        padding: 8px 10px;
        margin: 6px 0 8px;
        background: linear-gradient(0deg, var(--rg-header), var(--rg-bg));
        color: var(--rg-header-text);
        border: 1px solid var(--rg-border);
        border-radius: 8px;
        font-weight: 600;
    }

    /* listbox */
    .dl-grid select {
        width: 100%;
        height: 260px;
        background: var(--rg-bg-2);
        color: var(--rg-text);
        border: 1px solid var(--rg-border);
        border-radius: 10px;
        padding: 6px;
        font-size: 14px;
        outline: none;
        scrollbar-width: thin;
        scrollbar-color: #bbb #eee;
    }

    .dl-grid.dl-dark select {
        scrollbar-color: #444 #1a1a1a;
    }

    /* scrollbar webkit */
    .dl-grid select::-webkit-scrollbar {
        width: 10px;
    }

    .dl-grid select::-webkit-scrollbar-track {
        background: #eee;
        border-radius: 8px;
    }

    .dl-grid select::-webkit-scrollbar-thumb {
        background: #bbb;
        border-radius: 8px;
    }

        .dl-grid select::-webkit-scrollbar-thumb:hover {
            background: #aaa;
        }

    .dl-grid.dl-dark select::-webkit-scrollbar-track {
        background: #1a1a1a;
    }

    .dl-grid.dl-dark select::-webkit-scrollbar-thumb {
        background: #444;
    }

        .dl-grid.dl-dark select::-webkit-scrollbar-thumb:hover {
            background: #555;
        }

    .dl-grid option {
        padding: 6px 8px;
    }

        /* selezione option */
        .dl-grid option:checked {
            background: linear-gradient(0deg, var(--rg-accent-2), var(--rg-accent)) !important;
            color: #fff !important;
        }

    /* contatori */
    .dl-grid .count {
        color: #666;
        font-size: 12px;
    }

    .dl-grid.dl-dark .count {
        color: #bdbdbd;
    }

    /* colonna centrale bottoni */
    .dl-grid .btncol {
        background: var(--rg-bg-2);
        border: 1px dashed var(--rg-border);
        padding: 10px;
        border-radius: 12px;
    }

    /* bottoni */
    .dl-grid input[type="submit"],
    .dl-grid button,
    .dl-grid input[type="button"] {
        background: var(--btn-bg);
        color: var(--btn-text);
        border: 1px solid var(--btn-border);
        border-radius: 10px;
        padding: 8px 12px;
        font-weight: 600;
        cursor: pointer;
        transition: transform .05s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
        box-shadow: 0 2px 0 rgba(0,0,0,.15);
    }

        .dl-grid input[type="submit"]:hover,
        .dl-grid button:hover,
        .dl-grid input[type="button"]:hover {
            background: var(--btn-bg-hover);
            border-color: var(--rg-accent);
            box-shadow: 0 0 0 3px rgba(45,123,220,.12);
        }

        .dl-grid input[type="submit"]:active,
        .dl-grid button:active,
        .dl-grid input[type="button"]:active {
            transform: translateY(1px);
            box-shadow: 0 1px 0 rgba(0,0,0,.15);
        }

    /* zebra a livello di <select> come fallback grafico (non perfetto su tutte le UI) */
    .dl-grid select {
        background-image: linear-gradient(var(--zebra2) 50%, rgba(0,0,0,0) 0);
        background-size: 100% 3.2em;
        background-position-y: 1.6em;
    }

    /* --- Fix contrasto per tema chiaro --- */
    .dl-grid.dl-light select {
        background: #fff !important; /* niente overlay scuro */
        color: #111 !important;
        background-image: none !important; /* disattiva zebra fallback */
    }

    .dl-grid.dl-light option {
        color: #111 !important;
        background: transparent !important; /* lascia lo sfondo del select */
    }

        /* selezione visibile */
        .dl-grid.dl-light option:checked {
            background: linear-gradient(0deg, #1e5fb0, #2d7bdc) !important;
            color: #fff !important;
        }

    /* contatori più leggibili su chiaro */
    .dl-grid.dl-light .count {
        color: #555 !important;
    }

    /* colonna bottoni in chiaro */
    .dl-grid.dl-light .btncol {
        background: #f7f7f7 !important;
        border-color: #ddd !important;
    }

    /* input search su chiaro */
    .dl-grid.dl-light .searchbar input[type="text"] {
        background: #fff !important;
        color: #222 !important;
        border-color: #d9d9d9 !important;
    }
    /* --- Riduzione font e interlinea nelle listbox --- */
    .dl-grid select {
        font-size: 12px !important; /* prima era 14px */
        line-height: 1.2 !important; /* compatta le righe */
        padding: 4px !important; /* meno padding interno */
    }

    .dl-grid option {
        padding: 2px 6px !important; /* riduci spazio verticale */
        font-size: 12px !important;
        line-height: 1.2 !important;
    }


    /* --- Bottoni compatti nella colonna centrale --- */
    .dl-grid input[type="submit"],
    .dl-grid button,
    .dl-grid input[type="button"] {
        font-size: 11px !important; /* prima 14px circa */
        padding: 4px 8px !important; /* prima 8px 12px */
        border-radius: 6px !important;
        min-width: 32px; /* mantiene leggibilità anche con "<<" */
        line-height: 1.2 !important;
    }
