/* ============================================= */
/* RESET E SFONDO GENERALE */
/* ============================================= */
* {
    box-sizing: border-box;
}

body {
    background-color: #0a0a0a;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

h1 {
    color: #ff4d4d;
    letter-spacing: 2px;
    border-bottom: 2px solid #00d4ff;
    padding-bottom: 10px;
    margin-bottom: 30px;
    text-align: center;
}

/* ============================================= */
/* LOGO */
/* ============================================= */
.logo-container {
    position: absolute;
    top: 20px;
    left: 20px;
}

.logo-container img {
    width: 50px;
    height: auto;
}

/* ============================================= */
/* SEZIONE UPLOAD */
/* ============================================= */
.upload-section {
    background-color: #1a1a1a;
    padding: 30px;
    border-radius: 10px;
    border-left: 5px solid #ff4d4d;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
    max-width: 600px;
}

.upload-section p {
    font-weight: bold;
    color: #00d4ff;
    margin-bottom: 15px;
}

input[type="file"] {
    display: none;
}

.custom-upload-button {
    background-color: #00d4ff;
    color: #000;
    border: 2px solid #ff4d4d;
    padding: 15px 30px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    display: inline-block;
    font-size: 16px;
}

.custom-upload-button:hover {
    background-color: #ff4d4d;
    color: #fff;
    box-shadow: 0 0 20px #ff4d4d;
    transform: scale(1.05);
}

/* Istruzioni */
.instructions {
    background: rgba(0, 212, 255, 0.05);
    padding: 15px 20px;
    border-radius: 10px;
    margin-top: 20px;
    font-size: 14px;
    color: #aaa;
    text-align: left;
}

.instructions ul {
    margin-left: 20px;
    margin-top: 10px;
    list-style: disc;
}

.instructions li {
    margin-bottom: 5px;
}

.instructions kbd {
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    color: #00d4ff;
    font-family: monospace;
}

/* ============================================= */
/* CANVAS SECTION */
/* ============================================= */
.canvas-section {
    display: none;
    width: 100%;
    max-width: 1450px;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    padding: 0 15px;
}

/* Zoom Bar */
.zoom-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    background: #1a1a1a;
    border-left: 5px solid #ff4d4d;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
    flex-wrap: wrap;
    width: 100%;
    max-width: 1400px;
    justify-content: center;
}

.zoom-bar button {
    background: #00d4ff;
    color: #000;
    border: 2px solid #ff4d4d;
    padding: 8px 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.zoom-bar button:hover {
    background: #ff4d4d;
    color: #fff;
    box-shadow: 0 0 15px #ff4d4d;
}

#zoomLevel {
    color: #00d4ff;
    font-weight: bold;
    font-size: 18px;
    min-width: 70px;
    text-align: center;
    background: #000;
    padding: 8px 15px;
    border-radius: 6px;
    border: 2px solid #333;
}

.zoom-hint {
    color: #666;
    font-size: 12px;
    margin-left: auto;
}

.zoom-hint kbd {
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    color: #00d4ff;
}

/* Canvas Container */
.canvas-container {
    position: relative;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
    border: 3px solid #00d4ff;
    width: 100%;
    max-width: 1400px;
}

#imageCanvas {
    display: block;
    cursor: crosshair;
    background-color: #0a0a0a;
    width: 100%;
}

#imageCanvas.panning {
    cursor: grab !important;
}

#imageCanvas.panning:active {
    cursor: grabbing !important;
}

/* ============================================= */
/* INFO BOX */
/* ============================================= */
.info-box {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 30px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid #00d4ff;
    padding: 12px 25px;
    margin: 15px 0;
    border-radius: 30px;
    width: fit-content;
}

.selection-count {
    font-size: 16px;
    color: #fff;
}

.selection-count strong {
    color: #ff4d4d;
    font-size: 20px;
}

.mode-indicator {
    font-size: 14px;
    color: #00d4ff;
    padding: 5px 15px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 20px;
}

/* ============================================= */
/* CONTROLLI */
/* ============================================= */
.controls {
    display: none;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.btn-process {
    background: linear-gradient(135deg, #00cc66, #00994d);
    color: #fff;
    border: 2px solid #00ff88;
}

.btn-clear {
    background: linear-gradient(135deg, #ff4d4d, #cc3333);
    color: #fff;
    border: 2px solid #ff6666;
}

.btn-undo {
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: #fff;
    border: 2px solid #00d4ff;
}

.btn-new {
    background: linear-gradient(135deg, #9933ff, #6600cc);
    color: #fff;
    border: 2px solid #aa44ff;
}

/* ============================================= */
/* LOADING */
/* ============================================= */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
    margin-top: 30px;
    color: #00d4ff;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================= */
/* RISULTATI - VIEWPORT FISSO */
/* ============================================= */
.results-section {
    display: none;
    margin-top: 30px;
    width: 100%;
    max-width: 1400px;
    background: #0d0d0d;
    border-radius: 15px;
    border: 2px solid #00d4ff;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
    border-bottom: 2px solid #333;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h2 {
    color: #00d4ff;
    margin: 0;
    font-size: 1.5em;
    border: none;
    padding: 0;
}

.results-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-results {
    background: #1a1a1a;
    color: #00d4ff;
    border: 2px solid #333;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-results:hover {
    background: #00d4ff;
    color: #000;
    border-color: #00d4ff;
}

/* Viewport con scroll */
.results-viewport {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: #0a0a0a;
}

/* Scrollbar personalizzata */
.results-viewport::-webkit-scrollbar {
    width: 12px;
}

.results-viewport::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 6px;
}

.results-viewport::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    border-radius: 6px;
    border: 2px solid #1a1a1a;
}

.results-viewport::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ff4d4d, #cc3333);
}

/* Container risultati */
#resultsContainer {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============================================= */
/* CARD RISULTATO */
/* ============================================= */
.result-card {
    background: #141414;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #333;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.result-card:hover {
    border-color: #00d4ff;
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.2);
}

/* Header della card */
.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #1a1a1a, #141414);
    border-bottom: 1px solid #333;
    cursor: pointer;
    user-select: none;
}

.result-card-header:hover {
    background: linear-gradient(135deg, #222, #1a1a1a);
}

.result-card-header h3 {
    color: #ff4d4d;
    margin: 0;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    padding: 0;
}

.result-card-header .badge {
    background: #00d4ff;
    color: #000;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.result-card-header .toggle-icon {
    color: #00d4ff;
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.result-card.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* Body della card */
.result-card-body {
    padding: 20px;
    overflow-x: auto;
}

.result-card.collapsed .result-card-body {
    display: none;
}

/* ============================================= */
/* INFO STRUTTURA TABELLA */
/* ============================================= */
.table-info {
    background: rgba(0, 212, 255, 0.1);
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #00d4ff;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.table-info-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.table-info-item .label {
    color: #888;
    font-size: 13px;
}

.table-info-item .value {
    color: #00d4ff;
    font-weight: bold;
}

/* ============================================= */
/* TABELLA STRUTTURATA */
/* ============================================= */
.structured-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
    border: 2px solid #333;
}

.structured-table th {
    background: #1a1a1a;
    color: #00d4ff;
    padding: 12px 15px;
    text-align: center;
    border: 1px solid #333;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 1;
}

.structured-table td {
    padding: 12px 15px;
    text-align: left;
    border: 1px solid #2a2a2a;
    color: #fff;
    background: #0d0d0d;
}

.structured-table tr {
    transition: all 0.2s ease;
}

.structured-table tbody tr:hover {
    background: rgba(0, 212, 255, 0.1);
}

.structured-table tbody tr:hover td {
    border-color: #00d4ff;
}

/* ============================================= */
/* AZIONI RISULTATI */
/* ============================================= */
.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #333;
    flex-wrap: wrap;
}

.btn-copy {
    padding: 10px 20px;
    background: linear-gradient(135deg, #9933ff, #6600cc);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(153, 51, 255, 0.4);
}

.btn-copy.btn-csv {
    background: linear-gradient(135deg, #00cc66, #009944);
}

.btn-copy.btn-csv:hover {
    box-shadow: 0 5px 15px rgba(0, 204, 102, 0.4);
}

.btn-copy.btn-json {
    background: linear-gradient(135deg, #00d4ff, #0099cc);
}

.btn-copy.btn-json:hover {
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
}

/* ============================================= */
/* TOGGLE INFO */
/* ============================================= */
.toggle-info {
    background: rgba(0, 212, 255, 0.08);
    border: 1px dashed rgba(0, 212, 255, 0.4);
    padding: 12px 18px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 13px;
    color: #888;
}

.toggle-info kbd {
    background: #222;
    padding: 3px 8px;
    border-radius: 4px;
    color: #00d4ff;
    font-family: monospace;
    font-weight: bold;
    margin: 0 3px;
}

/* ============================================= */
/* NESSUN RISULTATO */
/* ============================================= */
.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-results .icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.no-results p {
    color: #ff4d4d;
    font-size: 16px;
    font-weight: normal;
}

/* ============================================= */
/* TOAST NOTIFICATION */
/* ============================================= */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #00cc66, #009944);
    color: #fff;
    padding: 15px 30px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 5px 30px rgba(0, 204, 102, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: linear-gradient(135deg, #ff4d4d, #cc3333);
    box-shadow: 0 5px 30px rgba(255, 77, 77, 0.5);
}

/* ============================================= */
/* RESPONSIVE */
/* ============================================= */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 1.5em;
    }

    .upload-section {
        padding: 20px;
    }

    .zoom-bar {
        padding: 10px 15px;
        gap: 8px;
    }

    .zoom-bar button {
        padding: 6px 12px;
        font-size: 12px;
    }

    .zoom-hint {
        display: none;
    }

    .controls {
        gap: 8px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 12px;
    }

    .results-header {
        padding: 15px;
        flex-direction: column;
        text-align: center;
    }

    .results-controls {
        justify-content: center;
    }

    .result-card-header {
        padding: 12px 15px;
    }

    .result-card-body {
        padding: 15px;
    }

    .result-actions {
        flex-direction: column;
    }

    .btn-copy {
        width: 100%;
        justify-content: center;
    }

    .info-box {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .table-info {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .logo-container {
        position: static;
        margin-bottom: 15px;
    }

    .canvas-section {
        padding: 0 5px;
    }

    .structured-table {
        font-size: 12px;
    }

    .structured-table th,
    .structured-table td {
        padding: 8px 10px;
    }
}

/*aggiunte per roba nuova*/

/* Pannello Selezioni */
    .selections-panel {
        background: #1a1a2e;
        border: 1px solid #333;
        border-radius: 8px;
        padding: 15px;
        margin: 10px 0;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .selections-panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #333;
    }
    
    .selections-panel-header h4 {
        margin: 0;
        color: #00d4ff;
    }
    
    .checkbox-all {
        display: flex;
        align-items: center;
        gap: 8px;
        color: #aaa;
        cursor: pointer;
    }
    
    .selections-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .selection-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #252540;
        padding: 10px 15px;
        border-radius: 6px;
        border-left: 4px solid #00d4ff;
    }
    
    .selection-item-info {
        display: flex;
        align-items: center;
        gap: 15px;
    }
    
    .selection-item-number {
        font-weight: bold;
        color: #00d4ff;
        font-size: 1.1em;
    }
    
    .selection-item-coords {
        color: #888;
        font-size: 0.85em;
    }
    
    .selection-item-actions {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .json-checkbox-label {
        display: flex;
        align-items: center;
        gap: 6px;
        color: #ffd93d;
        cursor: pointer;
        font-size: 0.9em;
    }
    
    .json-checkbox-label input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
    }
    
    .btn-remove-selection {
        background: #ff4d4d;
        border: none;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 0.85em;
    }
    
    .btn-remove-selection:hover {
        background: #ff6b6b;
    }

    /**aggiunta per sidebar/

    /* Stile della sidebar */
.sidebar {
  height: 100%;
  width: 0; /* Inizia chiuso */
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: #1a1a1a;
  overflow-x: hidden;
  transition: 0.5s; /* Velocità dell'animazione */
  padding-top: 60px;
}

/* Link dentro la sidebar */
.sidebar a {
  padding: 8px 8px 8px 32px;
  text-decoration: none;
  font-size: 25px;
  color: #ff4d4d;
  display: block;
  transition: 0.3s;
}

/* Colore al passaggio del mouse */
.sidebar a:hover {
    background-color: #ff4d4d;
    color: #00d4ff;
}

/* Posizione del tasto di chiusura */
.sidebar .closebtn {
  position: absolute;
  top: 0;
  right: 25px;
  font-size: 36px;
  margin-left: 50px;
}

/* Stile del tasto di apertura */
.openbtn {
    background-color: #00d4ff;
    color: #000;
    border: 2px solid #ff4d4d;
    padding: 15px 30px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    display: inline-block;
    font-size: 16px;
}

.openbtn:hover {
   background-color: #ff4d4d;
    color: #fff;
    box-shadow: 0 0 20px #ff4d4d;
    transform: scale(1.05);
}

/*classe div del bottone apertura*/
.posto_btnopen{
    text-align: left;
    padding: 45px 10px; /* Opzionale: per non farlo stare troppo attaccato al bordo */
    width: 100%;
}
    
    /* Badge fHa nei risultati */
    .fha-section {
        background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
        border: 2px solid #ffd93d;
        border-radius: 10px;
        padding: 15px;
        margin-top: 15px;
    }
    
    .fha-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 15px;
        color: #ffd93d;
    }
    
    .fha-header h4 {
        margin: 0;
    }
    
    .fha-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 10px;
    }
    
    .fha-item {
        background: #252540;
        padding: 12px;
        border-radius: 8px;
        border-left: 4px solid #00ff88;
    }
    
    .fha-item-label {
        font-size: 0.85em;
        color: #888;
        margin-bottom: 5px;
    }
    
    .fha-item-value {
        font-size: 1.4em;
        font-weight: bold;
        color: #00ff88;
    }
    
    .fha-item-sublabel {
        font-size: 0.75em;
        color: #666;
        margin-top: 3px;
    }
    
    .fha-row-card {
        background: #1e1e32;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .fha-row-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
    }
    
    .fha-row-title {
        color: #ffd93d;
        font-weight: bold;
    }
    
    .fha-row-values {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .fha-value-chip {
        background: #333;
        padding: 4px 10px;
        border-radius: 15px;
        font-size: 0.85em;
        color: #ddd;
    }
    
    .badge-json {
        background: #ffd93d;
        color: #1a1a2e;
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.75em;
        margin-left: 10px;
    }

    /*pezzi per il touch del */

    #imageCanvas {
    touch-action: none; /* Impedisce lo scroll della pagina mentre usi il canvas */
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Rendi i bottoni della sidebar più facili da cliccare */
.btn-remove-selection, .json-checkbox-label {
    padding: 10px;
    min-height: 44px;
}

/* =============================================
   PANNELLO PARAMETRI
   ============================================= */

.parametri-panel {
    margin-top: 12px;
    padding: 15px;
    background: rgba(0, 212, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.parametri-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: #00d4ff;
}

.parametri-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.parametro-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(26, 26, 46, 0.6);
    border: 2px solid;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.parametro-checkbox:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.parametro-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.parametro-label {
    font-weight: bold;
    font-size: 13px;
}

.parametri-summary {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    text-align: center;
    font-size: 12px;
    color: #aaa;
}

.btn-small {
    padding: 4px 10px;
    font-size: 11px;
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid #00d4ff;
    border-radius: 4px;
    color: #00d4ff;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: rgba(0, 212, 255, 0.3);
    transform: scale(1.05);
}

/* Aggiorna l'aspetto dei risultati */
.badge-json {
    display: inline-block;
    padding: 3px 8px;
    background: #ffd93d;
    color: #1a1a2e;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
}

/* =============================================
   PANNELLO PARAMETRI GLOBALI
   ============================================= */

.parametri-globali-panel {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95), rgba(16, 16, 36, 0.95));
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.2);
}

.parametri-globali-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0, 212, 255, 0.2);
}

.parametri-globali-header h3 {
    margin: 0;
    color: #00d4ff;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-toggle-parametri {
    padding: 8px 16px;
    background: rgba(0, 212, 255, 0.2);
    border: 2px solid #00d4ff;
    border-radius: 6px;
    color: #00d4ff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.btn-toggle-parametri:hover {
    background: rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.parametri-globali-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.parametro-checkbox-global {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(26, 26, 46, 0.6);
    border: 2px solid;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 14px;
}

.parametro-checkbox-global:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.2);
}

.parametro-checkbox-global input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #00d4ff;
}

.parametri-globali-summary {
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    border-left: 4px solid #00d4ff;
}

.parametri-globali-summary p {
    margin: 0;
    font-size: 14px;
    color: #ffd93d;
    line-height: 1.6;
}

.parametri-globali-summary strong {
    color: #00ff88;
}

/* Responsive */
@media (max-width: 768px) {
    .parametri-globali-checkboxes {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .parametri-globali-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .btn-toggle-parametri {
        width: 100%;
    }
}


/*AGGIUNTE PER SCELTA DATI*/

/* =============================================
   TABELLA SELEZIONE VALORI PER CALCOLI
   ============================================= */

.tabella-selezione-calcoli {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.05), rgba(0, 255, 136, 0.05));
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
}

.tabella-selezione-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0, 212, 255, 0.2);
}

.tabella-selezione-header h4 {
    margin: 0;
    color: #00d4ff;
    font-size: 18px;
}

.tabella-selezione-actions {
    display: flex;
    gap: 10px;
}

.parametro-row-selezione {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(26, 26, 46, 0.6);
    border-radius: 8px;
    border-left: 4px solid;
}

.parametro-row-header-selezione {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.parametro-tipo {
    font-size: 16px;
    font-weight: bold;
}

.parametro-stats {
    font-size: 13px;
    color: #aaa;
}

.valori-grid-selezione {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.valore-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.valore-checkbox-item:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.valore-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #00d4ff;
}

.valore-label {
    font-weight: bold;
    font-size: 14px;
    color: #fff;
}

.selezione-row-summary {
    padding: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    color: #00ff88;
}

.tabella-selezione-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid rgba(0, 212, 255, 0.2);
}

.riepilogo-selezione {
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    color: #fff;
}

/* Card Risultati Selezione */
.risultati-selezione-card {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 212, 255, 0.1));
    border: 2px solid #00ff88;
    border-radius: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.risultati-selezione-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.risultati-selezione-header h4 {
    margin: 0;
    color: #00ff88;
}

.btn-close-small {
    background: transparent;
    border: none;
    color: #ff6b6b;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
}

.btn-close-small:hover {
    color: #ff4d4d;
}

.stat-row {
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(26, 26, 46, 0.8);
    border-radius: 8px;
    border-left: 4px solid;
}

.stat-row-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stat-tipo {
    font-size: 16px;
    font-weight: bold;
}

.stat-count {
    color: #aaa;
    font-size: 13px;
}

.stat-row-data {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.stat-label {
    color: #aaa;
    font-size: 12px;
}

.stat-value {
    font-weight: bold;
    color: #00d4ff;
}

.stat-row-valori details {
    cursor: pointer;
}

.stat-row-valori summary {
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    color: #00d4ff;
    font-size: 13px;
}

.valori-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip-valore {
    padding: 5px 10px;
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid #00d4ff;
    border-radius: 12px;
    font-size: 12px;
    color: #00d4ff;
}

.risultati-selezione-footer {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #00d4ff, #00ff88);
    color: #0a0a0a;
    font-weight: bold;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.4);
}

.btn-primary-small {
    padding: 8px 16px;
    background: linear-gradient(135deg, #00d4ff, #00ff88);
    border: none;
    border-radius: 6px;
    color: #0a0a0a;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 212, 255, 0.3);
}

/* =============================================
   INTERFACCIA SELEZIONE VALORI - PREVIEW
   ============================================= */

.selezione-valori-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.selezione-valori-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
}

.selezione-valori-subtitle {
    margin: 0 0 20px 0;
    opacity: 0.9;
    font-size: 16px;
}

.selezione-valori-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-success {
    background: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);
    color: #0a0a0a;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.btn-danger {
    background: #ff6b6b;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

/* Card Selezione Valori */
.card-selezione-valori {
    background: #1e1e2e;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
    border: 2px solid #2d2d44;
    transition: all 0.3s ease;
}

.card-selezione-valori:hover {
    border-color: #00d4ff;
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.2);
}

.card-selezione-header {
    background: linear-gradient(135deg, #2d2d44 0%, #1e1e2e 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #00d4ff;
}

.card-selezione-header h3 {
    margin: 0;
    color: #00d4ff;
    font-size: 20px;
}

.card-selezione-body {
    padding: 20px;
}

/* Riga Parametro nella Preview */
.parametro-selezione-row {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    border-left-width: 4px;
    border-left-style: solid;
}

.parametro-selezione-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.parametro-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.parametro-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    color: #0a0a0a;
}

.parametro-stats-inline {
    color: #aaa;
    font-size: 13px;
}

.parametro-stats-inline strong {
    color: #00ff88;
    font-size: 15px;
}

.parametro-actions {
    display: flex;
    gap: 8px;
}

.btn-mini {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: #2d2d44;
    color: #fff;
    transition: all 0.2s;
}

.btn-mini:hover {
    background: #00d4ff;
    color: #0a0a0a;
    transform: scale(1.05);
}

/* Grid Valori Preview */
.valori-grid-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.valore-checkbox-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.valore-checkbox-preview:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.valore-checkbox-preview input[type="checkbox"] {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.valore-numero {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 13px;
    color: #fff;
    margin-left: 20px;
}

.valore-checkbox-preview input[type="checkbox"]:checked + .valore-numero {
    color: #00ff88;
}

/* Summary Parametro */
.parametro-summary {
    text-align: right;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.summary-count {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
}

.summary-success {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.summary-warning {
    background: rgba(255, 217, 61, 0.2);
    color: #ffd93d;
}

.summary-danger {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

/* Footer Card con Riepilogo */
.card-selezione-footer {
    background: rgba(0, 0, 0, 0.3);
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.riepilogo-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 16px;
}

.riepilogo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0, 212, 255, 0.3);
}

.riepilogo-header strong {
    color: #00d4ff;
    font-size: 16px;
}

.riepilogo-total {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: bold;
}

.riepilogo-dettagli {
    display: grid;
    gap: 10px;
}

.riepilogo-tipo {
    display: grid;
    grid-template-columns: 80px 80px 1fr;
    align-items: center;
    gap: 12px;
}

.riepilogo-tipo-label {
    font-weight: bold;
    color: #aaa;
}

.riepilogo-tipo-count {
    font-family: 'Courier New', monospace;
    color: #00ff88;
    font-weight: bold;
}

.riepilogo-progress {
    background: rgba(255, 255, 255, 0.1);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.riepilogo-progress-bar {
    background: linear-gradient(90deg, #00ff88, #00d4ff);
    height: 100%;
    transition: width 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .selezione-valori-header {
        padding: 20px;
    }
    
    .selezione-valori-header h2 {
        font-size: 22px;
    }
    
    .selezione-valori-actions {
        flex-direction: column;
    }
    
    .selezione-valori-actions button {
        width: 100%;
    }
    
    .valori-grid-preview {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .parametro-selezione-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .riepilogo-tipo {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}