/* Stili generali */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 15px;
    background: #f5f5f5;
    padding-top: 60px;
    padding-bottom: 150px !important;
}

/* Card e contenitori */
.card {
    background: white;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

/* Header fisso */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #007bff;
    color: white;
    padding: 10px 15px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-info {
    font-size: 0.9em;
}

.header-info strong {
    font-weight: 600;
}

/* Stili per le lavorazioni */
.lavorazione-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s;
}

.lavorazione-item:last-child {
    border-bottom: none;
}

/* Stati delle lavorazioni */
@keyframes pulseYellow {
    0% { background-color: #ffffff; }
    50% { background-color: rgb(255, 230, 147); }
    100% { background-color: #ffffff; }
}

.stato-IZ {
}

.stato-ICC {
    animation: pulseYellow 1s infinite;
}

.stato-IP {
    background-color: #fff3cd;
}

.stato-CM {
    background-color: #e6ffe6;
}

/* Informazioni aggiuntive */
.operatori-attivi {
    font-size: 0.8em;
    color: #666;
    margin-top: 3px;
}

.tempo-totale {
    font-size: 0.8em;
    color: #28a745;
    margin-top: 3px;
}

.info-label {
    color: #ccc;
    font-size: 0.7em;
    margin-bottom: 10px;
}

.info-value {
    font-size: 1.1em;
    margin-bottom: 0px;
}

/* Icone e badge */
.anomalia-icon {
    color: #dc3545;
    margin-left: 5px;
}

/* Pulsanti */
.btn {
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    color: white;
    background-color: #007bff;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #0056b3;
}

.dettagli-btn {
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    color: white;
    background-color: rgb(154, 156, 159);
    transition: background-color 0.3s;
}

.dettagli-btn:hover {
    background-color: #0056b3;
}

.btn-info { background-color: #17a2b8; }
.btn-warning { background-color: #ffc107; color: #000; }
.btn-success { background-color: #28a745; }
.btn-secondary { background-color: #6c757d; }

.btn-info:hover { background-color: #138496; }
.btn-warning:hover { background-color: #e0a800; }
.btn-success:hover { background-color: #218838; }
.btn-secondary:hover { background-color: #5a6268; }

/* Tabelle */
table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
    background: white;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
    padding: 10px 8px;
}

td {
    padding: 10px 8px;
    font-size: 0.9em;
    vertical-align: middle;
}

.col-data { width: 20%; }
.col-tipo { width: 10%; }
.col-operatore { width: 40%; }
.col-note { width: 30%; }

/* Activity Table */
.activity-table td {
    vertical-align: middle;
}

.activity-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.activity-error {
    color: #dc3545;
    font-weight: bold;
}

/* Info Block */
.info-block {
    background-color: #fff3cd;
    border: 1px solid #dead1c;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    color: #856404;
}

.info-block-title {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.info-block-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.info-block-item {
    text-align: center;
}

.info-block-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #28a745;
}

.info-block-label {
    font-size: 0.9em;
    color: #666;
}

/* Status Band */
@keyframes pulseStatusBar {
    0% { background-color: #ffc107; }
    50% { background-color: #ffdb6d; }
    100% { background-color: #ffc107; }
}

.status-band {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    gap: 8px;
}

.status-band i {
    font-size: 16px;
}

.status-band.stato-IC {
    background-color: #ffc107;
    color: #000;
}

.status-band.stato-ICC {
    background-color: #ffc107;
    color: #000;
    animation: pulseStatusBar 2s infinite;
}

.status-band.stato-CM {
    background-color: #28a745;
    color: white;
}

.status-band.stato-IZ {
    background-color: #dc3545;
    color: white;
}

.status-band.stato-IP {
    background-color: #17a2b8;
    color: white;
}

/* Pulsanti fissi in fondo */
.actions-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;

}

.actions-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.actions-buttons button {
    flex: 1;
    width: 50%;
}

.complete-button {
    display: flex;
    justify-content: center;
    width: 100%;
    padding-top: 10px;
}

.btn-complete {
    width: 100%;
    height: 50px;
    background-color: white;
    color: #28a745;
    border: 3px solid #28a745 !important;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-complete:hover {
    background-color: #218838;
    color: #fff;
}

.btn {
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 0;
    padding: 20px;
    width: 50%;
    border-radius: 8px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
}

select, input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
}

textarea {
    resize: vertical;
    min-height: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.operatore-section {
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    background-color: #f9f9f9;
}

.operatore-section h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 0.9em;
    font-weight: bold;
}

/* Nuovi stili per la visualizzazione delle attività */
.attivita-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attivita-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.attivita-icona {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.attivita-note {
    flex-grow: 1;
    padding: 0 8px;
    font-size: 0.9em;
    overflow-wrap: break-word;
    word-break: break-word;
}

.attivita-data {
    font-size: 0.8em;
    color: #666;
    flex-shrink: 0;
    white-space: nowrap;
}

.activity-error {
    background-color: #fff3cd;
    border-left: 3px solid #ffc107;
}

.warning-text {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.warning-text i {
    color: #856404;
    font-size: 1.2em;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.operatore-corrente {
    background: #007bff;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.operatore-corrente i {
    color: #ffffff;
    font-size: 18px;
    margin-right: 8px;
}

.operatore-corrente strong {
    color: #ffffff;
    font-weight: 600;
    margin-left: 5px;
} 

.tempo-stimato, .tempo-totale {
    margin: 10px 0;
    font-size: 1em;
    border-radius: 4px;
}
.tempo-stimato {
    margin-bottom: 5px;
}
.tempo-totale {
    transition: color 0.3s ease;
}
.info-block-item .info-block-value, 
.info-block-item .info-block-label {
    transition: color 0.3s ease;
}

/* Stili specifici per la pagina commessa.php */
.sottoprodotti-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}
.sottoprodotti-table th, .sottoprodotti-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}
.sottoprodotti-table th {
    background-color: #f4f4f4;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}
.sottoprodotti-table tr:hover {
    background-color: #f8f8f8;
}
.prodotto-principale {
    background-color: #eef5ff;
    font-weight: bold;
}
.sottoprodotto {
    padding-left: 30px;
}
.stato-lavorazione {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: bold;
}
.stato-IC { background-color: #cfe2ff; color: #ffc107; }
.stato-ICC { background-color: #cfe2ff; color: #ffc107; }
.stato-CM { background-color: #d1e7dd; color: #198754; }
.stato-IZ { background-color: #fff3cd; color: #dc3545; }

.prodotto-sezione {
    margin-bottom: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}
.prodotto-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #eef5ff;
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
}
.prodotto-titolo {
    font-weight: bold;
    font-size: 1.1em;
}
.sottoprodotti-lista {
    padding: 15px;
    border-bottom: 1px solid #ddd;
}
.lavorazioni-prodotto {
    padding: 15px;
}
.lavorazioni-prodotto h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #555;
    font-size: 0.9em;
    text-transform: uppercase;
}
.prodotto-quantita {
    font-weight: normal;
    font-size: 0.9em;
    margin-left: 10px;
    color: #eee;
}
.sottoprodotti-lista h4, .lavorazioni-prodotto h4 {
    margin-top: 15px;
    margin-bottom: 15px;
    color: #555;
    font-size: 0.9em;
    text-transform: uppercase;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}
.no-lavorazioni {
    color: #999;
    font-style: italic;
    font-size: 0.9em;
}
.sottoprodotto-sezione {
    margin-bottom: 20px;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #dee2e6;
}
.sottoprodotto-titolo {
    font-size: 1.05em;
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 10px;
    color: #495057;
}
.sottoprodotto-lavorazioni {
    margin-left: 20px;
}
.lavorazione-sottoprodotto {
    margin-bottom: 8px;
    padding: 5px 0;
    border-bottom: 1px dashed #e9ecef;
    display: flex;
    align-items: center;
}
.lavorazione-sottoprodotto:last-child {
    border-bottom: none;
}
.lavorazione-link {
    color: #495057;
    text-decoration: none;
    display: flex;
    align-items: center;
    margin-right: 10px;
}
.lavorazione-link:hover {
    color: #0d6efd;
}
.lavorazione-link i {
    margin-right: 8px;
    color: #6c757d;
}
.no-lavorazioni {
    margin-left: 20px;
    color: #6c757d;
    font-style: italic;
}
.no-lavorazioni i {
    margin-right: 5px;
}
.sottoprodotto-principale {
    padding: 0 0 15px 0;
}
.sottoprodotto-principale:last-child {
    border-bottom: none;
}
.sottoprodotto-nome {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 0px;
    padding: 8px;
    color: #fff;
    background-color: #282f39;
    border-radius: 10px 10px 0 0;
}
.lavorazione-elemento {
    margin: 8px 0;
    padding: 12px 15px;
    background-color: #fff;
    border-left: 8px solid #dee2e6;
    display: flex;
    align-items: center;
    border-radius: 3px;
    font-size: 1.1em;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.lavorazione-elemento.stato-IC { border-left-color: #ffc107; }
.lavorazione-elemento.stato-ICC { border-left-color: #ffc107; }
.lavorazione-elemento.stato-CM { border-left-color: #198754; }
.lavorazione-elemento.stato-ER { border-left-color: #dc3545; }
.lavorazione-elemento.stato-IZ { border-left-color: #dc3545; }

.lavorazione-elemento i {
    margin-right: 12px;
    color: #6c757d;
    font-size: 1.1em;
}
.dettagli-link {
    margin-left: auto;
    padding: 5px 10px;
    background-color: #e9ecef;
    color: #495057;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: bold;
}
.dettagli-link:hover {
    background-color: #dee2e6;
}
.tempo-info {
    display: flex;
    align-items: center;
    margin-right: 12px;
    font-size: 0.85em;
    white-space: nowrap;
}
.tempo-ok {
    color: #198754;
}
.tempo-warning {
    color: #ffc107;
}
.tempo-danger {
    color: #dc3545;
}
.tempo-neutral {
    color: #6c757d;
}
.operatori-attivi {
    display: flex;
    align-items: center;
    margin-right: 12px;
    font-size: 0.85em;
}
.info-item {
    display: flex;
    align-items: center;
    margin-right: 12px;
}
.info-item i {
    margin-right: 5px;
    font-size: 0.9em;
}
/* Assicuriamo che l'icona prenda lo stesso colore del testo */
.tempo-ok i, .tempo-warning i, .tempo-danger i, .tempo-neutral i {
    color: inherit !important;
}

/* Stili specifici per la pagina index.php (lettore barcode) */
body.kiosk-mode {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f5f5f5;
    font-family: Arial, sans-serif;
}

.kiosk-container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    text-align: center;
}

.input-container {
    margin: 20px 0;
    width: 100%;
}

/* Stile specifico per input di ricerca/scansione */
.gun-input-scan {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    background: white;
    box-sizing: border-box;
    text-align: center;
    margin: 0;
}

.gun-input-scan:focus {
    border-color: #007bff;
}

.status-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-size: 18px;
}

.error {
    background: #ffe6e6;
    color: #dc3545;
}

.info {
    background: #e6f3ff;
    color: #0056b3;
}

.operator-name {
    font-weight: bold;
    font-size: 18px;
    color: #333;
    margin: 15px 0;
}

h1.kiosk-title {
    color: #333;
    margin-bottom: 10px;
    font-size: 20px;
    line-height: 1.3;
}

.step-indicator {
    font-size: 16px;
    color: #666;
    margin-bottom: 15px;
}

/* Dashboard Zone Cards */
.zona-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    font-weight: bold;
    transition: all 0.2s;
    min-height: 120px;
    text-align: center;
}

.zona-card:hover {
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.zona-card i {
    font-size: 2em;
    margin-bottom: 10px;
}

.zona-title {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 5px;
}

.zona-subtitle {
    font-size: 0.9em;
    opacity: 0.8;
}

.zona-stampa { background-color: #1ab394; }
.zona-digitale { background-color: #ff8f05; }
.zona-fustellatura { background-color: #ed5565; }
.zona-caldo { background-color: #23c6c8; }
.zona-accoppiatura { background-color: #9c27b0; }
.zona-incollatura { background-color: #795548; }
.zona-taglio { background-color: #00a6ff; }
.zona-staccatura { background-color: #607d8b; }
.zona-imballo { background-color: #4caf50; }
.zona-gestione { background-color: #676a6c; }

/* Lista Lavorazioni */
.lavorazioni-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lavorazione-card {
    transition: all 0.2s ease;
    cursor: pointer;
}

.lavorazione-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Badge Status */
.badge-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.status-ic {
    background-color: #ffc107;
    color: #000;
}

.status-scaduta {
    background-color: #dc3545;
    color: white;
}

.status-urgente {
    background-color: #dc3545;
    color: white;
}

.status-normale {
    background-color: #17a2b8;
    color: white;
}

.status-scadenza {
    background-color: #ffc107;
    color: #000;
}

/* Effetto lampeggiante per le lavorazioni attive */
.blinking {
    animation: blink 1.5s linear infinite;
}

@keyframes blink {
    0% { background-color: rgba(255, 193, 7, 0.1); }
    50% { background-color: rgba(255, 193, 7, 0.3); }
    100% { background-color: rgba(255, 193, 7, 0.1); }
}

/* Fix per modal Bootstrap - previene modal-backdrop sopra il contenuto e centra meglio */
.modal-backdrop {
    z-index: 1040 !important;
}

.modal-backdrop.fade.in {
    z-index: 1040 !important;
}

/* Solo per modal aperti/visibili - Bootstrap 3 usa .in, Bootstrap 4+ usa .show */
.modal.in,
.modal.show,
.modal[style*="display: block"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1050 !important;
}

.modal.fade.in {
    z-index: 1050 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Centra i modal dialog quando sono visibili */
.modal.in .modal-dialog,
.modal.show .modal-dialog,
.modal[style*="display: block"] .modal-dialog {
    margin: 0 !important;
    position: relative;
    width: 400px;
    min-width: 350px;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1060 !important;
}

.modal.fade.in .modal-dialog {
    z-index: 1060 !important;
}

.modal-dialog {
    z-index: 1060 !important;
}

.modal-content {
    z-index: 1070 !important;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

        .hr-line-modal{
            border-top: 1px solid #eee;
            margin-top: 10px;
            margin-bottom: 10px;
        }


        @keyframes pulse {
            0% { transform: translate(-50%, -50%) scale(1); }
            50% { transform: translate(-50%, -50%) scale(1.05); }
            100% { transform: translate(-50%, -50%) scale(1); }
        }

        /* Stili per il div del timeout warning */
        #timeout-warning {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: none;
            z-index: 2000;
            background: rgba(0, 0, 0, 0.5);
        }

        #timeout-warning::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: #dc3545;
            color: white;
            padding: 25px 35px;
            border-radius: 12px;
            box-shadow: 0 8px 20px rgba(0,0,0,0.4);
            text-align: center;
            font-size: 20px;
            font-weight: bold;
            animation: pulse 1s infinite;
            min-width: 280px;
            border: 3px solid rgba(255,255,255,0.2);
        }

        #timeout-warning .timeout-content {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: #dc3545;
            color: white;
            padding: 25px 35px;
            border-radius: 12px;
            box-shadow: 0 8px 20px rgba(0,0,0,0.4);
            text-align: center;
            font-size: 20px;
            font-weight: bold;
            animation: pulse 1s infinite;
            min-width: 280px;
            border: 3px solid rgba(255,255,255,0.2);
            line-height: 1.4;
        }