/**
 * PDF Comparator Frontend Styles
 */

/* Container */
.pdf-comparator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Form Styles */
.pdf-comparator-form-container {
    background-color: #f9f9f9;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pdf-comparator-form .form-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.pdf-comparator-form .form-group {
    flex: 1;
    min-width: 250px;
    margin-right: 15px;
    margin-bottom: 15px;
}

.pdf-comparator-form .form-group:last-child {
    margin-right: 0;
}

.pdf-comparator-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.pdf-comparator-form input[type="file"] {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.pdf-comparator-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
}

/* File Upload Styling */
.file-upload-container {
    position: relative;
    width: 100%;
    cursor: pointer;
}

/* Custom Fields Styling */
.custom-fields-container {
    width: 100%;
}

#custom-fields-list {
    margin-bottom: 15px;
}

.custom-field-item {
    display: flex;
    align-items: baseline;
    margin-bottom: 10px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.custom-field-item input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
}

.custom-field-item .remove-field {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
}

.add-custom-field-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
}

.file-upload-preview {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border: 2px dashed #ccc;
    border-radius: 4px;
    background-color: #fff;
    min-height: 45px;
    transition: all 0.3s ease;
}

.file-upload-preview:hover {
    border-color: #999;
}

.file-upload-preview .file-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #666;
}

.file-upload-preview.has-file {
    border-style: solid;
    border-color: #4CAF50;
}

.file-upload-preview.has-file .file-name {
    color: #333;
    font-weight: 500;
}

/* Submit Button */
.pdf-comparator-submit {
    background-color: #2271b1;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.pdf-comparator-submit:hover {
    background-color: #135e96;
}

/* Loading Indicator */
.pdf-comparator-loading {
    text-align: center;
    padding: 20px;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #2271b1;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Message */
.pdf-comparator-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

/* Results Container */
.pdf-comparator-result {
    background-color: #fff;
    border-radius: 5px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pdf-comparator-result h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #333;
}

/* PDF Generation Styles */
.pdf-generation-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Disclaimer section */
.field-selection-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.hidden-field-selection {
    display: none !important;
}

.disclaimer-section label {
    font-weight: bold;
    color: #333;
}

.disclaimer-section textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: background-color 0.3s ease;
}

.disclaimer-section textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.disclaimer-section textarea[readonly] {
    background-color: #f8f8f8;
    cursor: default;
}

.disclaimer-section button {
    transition: background-color 0.3s ease;
}

.disclaimer-section button:hover {
    opacity: 0.9;
}

.generate-pdf-button,button#export-audit-history-xlsx {
    background-color: #4CAF50 !important;
    color: white;
    border: none;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s ease; border:1px solid #fff;
}

.generate-pdf-button:hover {
    background-color: #45a049;
}

.generate-pdf-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.pdf-download-link {
    margin-top: 10px;
}

.pdf-download {
    display: inline-block;
    background-color: #2196F3;
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
}

.pdf-download:hover {
    background-color: #0b7dda;
    text-decoration: none;
    color: white;
}

.pdf-comparator-result-content {
    overflow-x: auto;
}

/* Comparison Table Styling */
.pdf-comparator-result-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.pdf-comparator-result-content th {
    background-color: #f5f5f5;
    text-align: left;
    padding: 12px;
    border: 1px solid #ddd;
    font-weight: 600;
}

.pdf-comparator-result-content td {
    padding: 10px 12px;
    border: 1px solid #ddd;
    vertical-align: top;
}

.pdf-comparator-result-content tr:nth-child(even) {
    background-color: #f9f9f9;
}

.pdf-comparator-result-content tr:hover {
    background-color: #f1f1f1;
}

/* Highlight differences */
.pdf-comparator-result-content .diff-highlight {
    background-color: #fff9c4;
    padding: 2px;
}

.pdf-comparator-result-content .missing-data {
    color: #e53935;
    font-style: italic;
}

/* History Section */
.pdf-comparator-history-container {
    background-color: #fff;
    border-radius: 5px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pdf-comparator-history-container h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.pdf-comparator-history-list {
    max-height: 300px;
    overflow-y: auto;
}

.pdf-comparator-history-item {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pdf-comparator-history-item:hover {
    background-color: #f5f5f5;
}

.pdf-comparator-history-item h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.pdf-comparator-history-item p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.pdf-comparator-history-item .pdf-download-link {
    margin-top: 8px;
    text-align: right;
}

.pdf-comparator-history-item .pdf-download {
    display: inline-block;
    padding: 5px 10px;
    background-color: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 3px;
    font-size: 13px;
    transition: background-color 0.2s ease;
}

.pdf-comparator-history-item .pdf-download:hover {
    background-color: #005177;
}

.pdf-comparator-result-content .input[type="text"] {padding:3px 5px} 
/* Field Selection Section */
.field-selection-section {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

.hidden-field-selection {
    display: none !important;
}

.field-selection-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.field-selection-controls {
    margin-bottom: 15px;
}

.field-selection-controls button {
    background-color: #007cba;
    color: white;
    border: none;
    padding: 8px 12px;
    margin-right: 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.field-selection-controls button:hover {
    background-color: #005a87;
}

.field-checkbox {
    display: flex;
    align-items: center;
    padding: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.field-checkbox:hover {
    background-color: #f0f0f0;
}

.field-checkbox input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.field-checkbox span {
    font-size: 14px;
    color: #333;
    user-select: none;
}

.field-checkbox input[type="checkbox"]:checked + span {
    font-weight: 500;
    color: #007cba;
}
/* Stili per la struttura div ora gestiti in comparison-div-styles.css */

/* Stile per le righe salvate */
.saved-selection {
    background-color: rgba(76, 175, 80, 0.2) !important; /* Verde chiaro con trasparenza */
    transition: background-color 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pdf-comparator-form .form-row {
        flex-direction: column;
    }
    
    .pdf-comparator-form .form-group {
        margin-right: 0;
        width: 100%;
    }
    
    .field-checkboxes {
        grid-template-columns: 1fr;
        max-height: 150px;
    }
    
    .field-selection-controls button {
        margin-bottom: 5px;
        display: block;
        width: 100%;
    }
}

/* Advanced History Styles */
.pdf-comparator-advanced-history-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Product Group Styles */
.product-group {
    margin-bottom: 25px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
}

.product-group-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-group-header:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
}

.product-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.toggle-icon {
    margin-right: 10px;
    transition: transform 0.3s ease;
    font-size: 14px;
    color: #6c757d;
}

.product-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.product-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.comparisons-count {
    background-color: #007cba;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.latest-date {
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
}

.product-comparisons {
    padding: 0;
    transition: all 0.3s ease;
    overflow-x: scroll;
}

.product-group.collapsed .product-comparisons {
    display: none;
}

.advanced-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e5e9;
}

.advanced-history-title {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.history-export-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.history-export-btn:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.advanced-filters {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.advanced-history-filters {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
    font-size: 14px;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.filters-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.filter-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 14px;
}

.filter-btn.apply {
    background: linear-gradient(135deg, #007cba, #0073aa);
    color: white;
}

.filter-btn.apply:hover {
    background: linear-gradient(135deg, #005a87, #007cba);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.filter-btn.reset {
    background: #6c757d;
    color: white;
}

.filter-btn.reset:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.history-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border-left: 4px solid #007cba;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #007cba;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-results {
    min-height: 200px;
}

.history-item {
    background: white;
    border: none;
    border-bottom: 1px solid #e1e5e9;
    border-radius: 0;
    padding: 20px;
    margin-bottom: 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.product-comparisons .history-item {
    border-left: 3px solid transparent;
    padding-left: 25px;
}

.product-comparisons .history-item:hover {
    background-color: #f8f9fa;
    border-left-color: #007cba;
}
.history-date {
	background: #666;
	padding: 2px 5px;
	color: #fff;
	border-radius: 10px; font-size:14px;
}
.history-item:hover {
    border-color: #007cba;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.1);
    transform: translateY(-2px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0;
}
.audit-modal-header h4 { margin:0} 
.history-item-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    margin: 0;
}

.history-item-date {
    color: #6c757d;
    font-size: 14px;
}

.history-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.detail-value {
    font-weight: 500;
    color: #495057;
}

.history-item-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.history-item-actions [type="button"], .history-item-actions button {
	background-color: transparent;
	border: 1px solid #c36;
	border-radius: 6px;
	color: #c36;
	display: inline-block;
	font-size: 14px;
	font-weight: 400;
	padding: 3px 6px;
	text-align: center;
	transition: all .3s;
	-webkit-user-select: none;
	-moz-user-select: none;
	user-select: none;
	white-space: nowrap;
}
.history-item-actions a.button {background-color:  #17a2b8;
  border: 1px solid  #17a2b8;
  border-radius: 6px;
  color: #fff;
  display: inline-block;
  font-size: 14px;
  font-weight: 400;
  padding: 6px 6px;
  text-align: center;
  transition: all .3s;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  white-space: nowrap;}
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.action-btn.view {
    background: #17a2b8;
    color: white;
}

.action-btn.view:hover {
    background: #138496;
}

.action-btn.audit {
    background: #ffc107;
    color: #212529;
}

.action-btn.audit:hover {
    background: #e0a800;
}

.action-btn.download {
    background: #28a745;
    color: white;
}

.action-btn.download:hover {
    background: #218838;
}

/* Stile per il bottone Genera Certificato di Analisi */
.generate-certificate {
    background-color: #6f42c1 !important;
    border-color: #6f42c1 !important;
    color: white !important;
}

.generate-certificate:hover {
    background-color: #5a32a3 !important;
    border-color: #5a32a3 !important;
    color: white !important;
}

.action-btn.certificate {
    background: #218838;
}

.history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.pagination-info {
    color: #6c757d;
    font-size: 14px;
    margin: 0 15px;
}

/* Modal Styles */
.audit-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.audit-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}
button#export-audit-history-xlsx{ background:#0073aa; color:#fff;}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.audit-modal-header {
    background: linear-gradient(135deg, #007cba, #0073aa);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center; position:relative;
}

.audit-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.audit-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    position:absolute;
    top:-5px;
    right:-5px;
}

.audit-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.audit-modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.audit-entry {
    border-left: 4px solid #007cba;
    padding: 15px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
}

.audit-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.audit-action {
    font-weight: 600;
    color: #007cba;
}

.audit-timestamp {
    color: #6c757d;
    font-size: 14px;
}

.audit-details {
    color: #495057;
    line-height: 1.5;
}

/* Timeline Styles for Audit History */
.audit-timeline {
    position: relative;
    padding: 20px 0;
    margin: 20px 0;
}

.audit-timeline::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #007cba, #17a2b8);
    border-radius: 1px;
}

.audit-record {
	position: relative;
	margin-bottom: 30px;
	padding-left: 60px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	border: 1px solid #e9ecef;
	transition: all 0.3s ease;
	padding-top: 30px;
    padding-bottom: 20px;
}

.audit-record:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 124, 186, 0.15);
    border-color: #007cba;
}

.audit-record::before {
    content: '';
    position: absolute;
    left: -39px;
    top: 20px;
    width: 16px;
    height: 16px;
    background: #007cba;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #007cba;
    z-index: 2;
}

.audit-record.created::before {
    background: #28a745;
    box-shadow: 0 0 0 3px #28a745;
}

.audit-record.updated::before {
    background: #ffc107;
    box-shadow: 0 0 0 3px #ffc107;
}

.audit-record.deleted::before {
    background: #dc3545;
    box-shadow: 0 0 0 3px #dc3545;
}

.audit-timestamp {
	font-size: 14px;
	color: #fff;
	font-weight: 500;
	margin-bottom: 8px;
	display: flex;
	align-items: center;
	position: absolute;
	top: -10px;
	background: green;
	padding: 2px 5px;
	border-radius: 10px;
}

.audit-timestamp::before {
    content: '🕒';
    margin-right: 6px;
    font-size: 12px;
}

.audit-action {
    font-size: 16px;
    font-weight: 600;
    color: #007cba;
    margin-bottom: 10px;
    text-transform: capitalize;
    display: flex;
    align-items: center;
}

.audit-action.created {
    color: #28a745;
}

.audit-action.updated {
    color: #ffc107;
}

.audit-action.deleted {
    color: #dc3545;
}

.audit-action::before {
    margin-right: 8px;
    font-size: 14px;
}

.audit-action.created::before {
    content: '✅';
}

.audit-action.updated::before {
    content: '✏️';
}

.audit-action.deleted::before {
    content: '🗑️';
}

.audit-field {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #495057;
    margin-bottom: 10px;
    border-left: 3px solid #007cba;
    font-weight: 500;
}

.audit-changes {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}
.audit-changes br { display:none !important}
.old-value, .new-value {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
}

.old-value {
    background: #fff5f5;
    border-left: 3px solid #dc3545;
    color: #721c24;
}

.new-value {
    background: #f0fff4;
    border-left: 3px solid #28a745;
    color: #155724;
}

.old-value strong, .new-value strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.audit-user {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #495057;
    margin-bottom: 8px;
    font-weight: 500;
}

.audit-user::before {
    content: '👤';
    margin-right: 6px;
    font-size: 12px;
}

.audit-notes {
    background: #e7f3ff;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #0c5460;
    border-left: 3px solid #17a2b8;
    font-style: italic;
    margin-top: 10px;
}

.audit-notes::before {
    content: '📝 ';
    font-style: normal;
}

.audit-value-json {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #495057;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 100px;
    overflow-y: auto;
}

/* Stili per valori formattati */
.empty-value {
    color: #6c757d;
    font-style: italic;
    font-size: 13px;
}

.object-placeholder {
    background: #e3f2fd;
    color: #1565c0;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: inline-block;
}

.simple-value {
    color: #495057;
    font-weight: 500;
}

.long-value {
    color: #495057;
    cursor: help;
    border-bottom: 1px dotted #007cba;
}

.long-value small {
    color: #6c757d;
    font-style: italic;
}

/* Stili per oggetti JSON */
.json-object {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
}

.json-array {
    background: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #ffc107;
    font-weight: 500;
}

.note-object {
    background: #e7f3ff;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid #17a2b8;
}

.note-text {
    display: block;
    font-size: 14px;
    color: #0c5460;
    margin-bottom: 6px;
    font-weight: 500;
}

.note-pdf-flag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.note-pdf-flag.included {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.note-pdf-flag.excluded {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.object-summary {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 14px;
}

.object-properties {
    list-style: none;
    padding: 0;
    margin: 0;
}

.object-properties li {
    padding: 4px 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 13px;
    color: #495057;
}

.object-properties li:last-child {
    border-bottom: none;
}

.object-properties strong {
    color: #007cba;
    font-weight: 600;
}

/* Responsive timeline */
@media (max-width: 768px) {
    .audit-timeline::before {
        left: 15px;
    }
    
    .audit-record {
        padding-left: 45px;
        margin-bottom: 20px;
    }
    
    .audit-record::before {
        left: -24px;
        width: 12px;
        height: 12px;
    }
}

.loading-spinner {
    display: inline-block;
    /*justify-content: center;
    align-items: center;*/
    padding: 40px;
    color: #6c757d;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
button.button{ } 
/*button.button.view-comparison{ background: green; border:1px solid green}*/
.no-results {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

/* Modal per valori completi */
.value-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.value-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 80%;
    max-height: 80%;
    width: 600px;
    animation: slideIn 0.3s ease;
}

.value-modal-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.value-modal-header h3 {
    margin: 0;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
}

.value-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.value-modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.value-modal-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.value-modal-body pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #495057;
    white-space: pre-wrap;
    word-wrap: break-word;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .advanced-history-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-actions {
        justify-content: stretch;
    }
    
    .filter-btn {
        flex: 1;
    }
    
    .history-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .history-item-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .history-item-details {
        grid-template-columns: 1fr;
    }
    
    .history-item-actions {
        justify-content: stretch;
    }
    
    .action-btn {
        flex: 1;
    }
    
    .audit-modal-content {
        width: 95%;
        margin: 2% auto;
    }
    
    .pagination-info {
        margin: 10px 0;
        text-align: center;
    }
    
    .history-pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .value-modal {
        width: 95%;
        max-width: 95%;
    }
    
    .value-modal-body {
        max-height: 300px;
    }
}

/* Responsive per filtri avanzati */
@media (max-width: 768px) {
    .filter-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Modal Certificato di Analisi */
.certificate-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.certificate-modal-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90%;
    width: 800px;
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

.certificate-modal-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.certificate-modal-header h3 {
    margin: 0;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
}

.certificate-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.certificate-modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.certificate-modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.certificate-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

.certificate-config {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.certificate-section {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    background: #f8f9fa;
}

.certificate-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #007cba;
    padding-bottom: 8px;
}

.certificate-fields-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
}

.certificate-field-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    transition: all 0.2s ease;
}

.certificate-field-item:hover {
    border-color: #007cba;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.1);
}

.certificate-field-item label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
}

.certificate-field-checkbox {
    margin: 0;
    flex-shrink: 0;
    margin-top: 2px;
}

.certificate-company-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.certificate-company-values .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.certificate-company-values label {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.certificate-company-values input,
.certificate-company-values textarea {
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.certificate-company-values input:focus,
.certificate-company-values textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.certificate-company-values textarea {
    resize: vertical;
    min-height: 80px;
}

.certificate-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.certificate-actions .btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.certificate-actions .btn-secondary:hover {
    background: #5a6268;
}

.certificate-actions .btn-primary {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.certificate-actions .btn-primary:hover {
    background: #0056b3;
}

.certificate-actions .btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.certificate-modal .error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    text-align: center;
}

/* Stili per la tabella del certificato */
.certificate-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.certificate-table th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

.certificate-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.certificate-table tr:hover {
    background-color: #f8f9fa;
}

.certificate-table .field-label-input,
.certificate-table .field-value-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.certificate-table .field-label-input:focus,
.certificate-table .field-value-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.certificate-table .field-label-input.editing,
.certificate-table .field-value-input.editing {
    background-color: #fff3cd;
    border-color: #ffc107;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.2);
}

.certificate-table .field-label-input[readonly],
.certificate-table .field-value-input[readonly] {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.certificate-table .edit-field-btn {
    background: #007cba;
    color: white;
    border: 1px solid #007cba;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.certificate-table .edit-field-btn:hover {
    background: #005a87;
    border-color: #005a87;
}

.certificate-table .certificate-field-checkbox {
    transform: scale(1.2);
    margin: 0;
}

.certificate-fields-table {
    margin-bottom: 20px;
}

/* Responsive per modal certificato */
@media (max-width: 768px) {
    .certificate-modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 95%;
    }
    
    .certificate-modal-body {
        max-height: 60vh;
        padding: 15px;
    }
    
    .certificate-fields-list {
        grid-template-columns: 1fr;
    }
    
    .certificate-company-values {
        grid-template-columns: 1fr;
    }
    
    .certificate-actions {
        flex-direction: column;
    }
    
    .certificate-actions .btn-secondary,
     .certificate-actions .btn-primary {
         width: 100%;
     }
     
    .certificate-table th,
    .certificate-table td {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .certificate-table .field-label-input,
    .certificate-table .field-value-input {
        font-size: 12px;
        padding: 4px 6px;
    }
 }

/* Drag and Drop Styles */
.drag-handle {
    display: inline-block;
    cursor: grab;
    color: #666;
    font-size: 16px;
    margin-right: 8px;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    user-select: none;
    vertical-align: middle;
}

.drag-handle:hover {
    background-color: #f0f0f0;
    color: #333;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Sortable states */
.sortable-ghost {
    opacity: 0.4;
    background-color: #f8f9fa !important;
}

.sortable-chosen {
    background-color: #e3f2fd !important;
}

.sortable-drag {
    opacity: 0.8;
    transform: rotate(5deg);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Table row hover effect for draggable rows */
#pdf-comparator-result tbody tr.comparison-row {
    transition: background-color 0.2s ease;
}

#pdf-comparator-result tbody tr.comparison-row:hover {
    background-color: #f8f9fa;
}

/* Ensure drag handle is visible in table cells */
#pdf-comparator-result tbody tr.comparison-row td:first-child {
    position: relative;
}

/* Mobile responsiveness for drag handles */
@media (max-width: 768px) {
    .drag-handle {
        font-size: 14px;
        margin-right: 4px;
        padding: 2px;
    }
}

/* Tooltip styles */
.pdf-comparator-tooltip {
    position: relative;
    display: inline-block;
}

.pdf-comparator-tooltip .tooltiptext {
    visibility: hidden;
    width: 350px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -175px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.pdf-comparator-tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.pdf-comparator-tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* PDF History specific styles */
.pdf-history-header {
    font-weight: bold;
    margin-bottom: 8px;
    color: #fff;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

.pdf-history-info {
    font-size: 11px;
    color: #ccc;
    margin-bottom: 8px;
    font-style: italic;
}

.pdf-history-list {
    max-height: 200px;
    overflow-y: auto;
}

.pdf-record {
    margin-bottom: 8px;
    padding: 5px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 3px;
}

.pdf-date {
    font-size: 10px;
    color: #aaa;
    margin-bottom: 2px;
}

.pdf-filename {
    font-size: 11px;
    color: #fff;
    margin-bottom: 3px;
    word-break: break-all;
}

.pdf-link a {
    color: #4CAF50;
    text-decoration: none;
    font-size: 10px;
}

.pdf-link a:hover {
    text-decoration: underline;
}

.pdf-separator {
    border: none;
    border-top: 1px solid #555;
    margin: 5px 0;
}

.pdf-history-loading {
    color: #ccc;
    font-style: italic;
    font-size: 11px;
}

.pdf-history-empty {
    color: #ccc;
    font-style: italic;
    font-size: 11px;
}

/* PDF History Toggle Expandable Styles */
.pdf-history-toggle {
    cursor: pointer;
    color: #667eea;
    text-decoration: underline;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

.pdf-history-toggle:hover {
    color: #5a67d8;
    text-decoration: none;
}

.pdf-history-toggle .toggle-icon {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.pdf-history-toggle.expanded .toggle-icon {
    transform: rotate(90deg);
}

.pdf-history-expanded {
    display: none;
    margin-top: 8px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 12px;
}

.pdf-history-expanded.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 300px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

.pdf-history-info {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

.pdf-history-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pdf-history-info-label {
    font-weight: 600;
    color: #495057;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pdf-history-info-value {
    color: #212529;
    font-size: 12px;
}

.pdf-history-records h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

.pdf-record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f1f3f4;
}

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

.pdf-record-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.pdf-record-date {
    font-size: 11px;
    color: #6c757d;
    font-weight: 500;
}

.pdf-record-filename {
    font-size: 12px;
    color: #212529;
    font-weight: 500;
    word-break: break-all;
}

.pdf-record-link {
    font-size: 11px;
    color: #007bff;
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid #007bff;
    border-radius: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pdf-record-link:hover {
    background-color: #007bff;
    color: white;
    text-decoration: none;
}

.pdf-history-empty {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 16px;
}

.pdf-history-loading {
    text-align: center;
    color: #6c757d;
    padding: 16px;
}

.pdf-history-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dropdown Toggle Arrow Rotation */
.pdf-dropdown-toggle,
.cert-dropdown-toggle {
    transition: transform 0.2s ease;
}

.pdf-dropdown-toggle.dropdown-open,
.cert-dropdown-toggle.dropdown-open {
    transform: rotate(180deg);
}