
/**
 * Table Styles - CSS dedicato al styling delle tabelle
 */

/* Stili per le tabelle dati */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.data-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    font-weight: 600;
    color: #1f2937;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td {
    color: #374151;
    font-size: 0.9rem;
    line-height: 1.4;
}

.data-table tr:hover {
    background: #f8fafc;
    transition: background-color 0.2s ease;
}

.data-table tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

.data-table tr:nth-child(even):hover {
    background: #f1f5f9;
}

/* Stili per DataTables */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse;
    margin: 0;
}

.dataTables_wrapper {
    padding: 0;
    margin: 20px 0;
}

.dataTables_wrapper .dataTables_top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dataTables_wrapper .dataTables_length {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dataTables_wrapper .dataTables_length label {
    font-weight: 500;
    color: #374151;
    margin: 0;
}

.dataTables_wrapper .dataTables_length select {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 0.9rem;
    min-width: 80px;
}

.dataTables_wrapper .dataTables_filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dataTables_wrapper .dataTables_filter label {
    font-weight: 500;
    color: #374151;
    margin: 0;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 0.9rem;
    min-width: 200px;
    transition: border-color 0.2s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dataTables_wrapper .dataTables_info {
    color: #6b7280;
    font-size: 0.9rem;
    padding: 12px 0;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 12px 0;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 8px 12px;
    margin: 0 2px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    background: #f9fafb;
    color: #9ca3af;
    border-color: #f3f4f6;
    cursor: not-allowed;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #f9fafb;
    transform: none;
}

/* Pulsanti di export DataTables */
.dt-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
}

.dt-button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #3b82f6;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dt-button:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.dt-button.buttons-csv {
    background: #059669;
}

.dt-button.buttons-csv:hover {
    background: #047857;
}

.dt-button.buttons-excel {
    background: #dc2626;
}

.dt-button.buttons-excel:hover {
    background: #b91c1c;
}

/* Tabella responsiva */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Stili per celle specifiche - Sistema universale */
.data-table .numeric-cell {
    text-align: right;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    color: #1f2937;
}

.data-table .date-cell {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    color: #6b7280;
    white-space: nowrap;
}

.data-table .boolean-cell {
    text-align: center;
    font-size: 0.9rem;
}

.data-table .boolean-cell i {
    margin-right: 4px;
}

.data-table .text-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.data-table .text-cell:hover {
    overflow: visible;
    white-space: normal;
    word-wrap: break-word;
    z-index: 10;
    position: relative;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 8px;
    border-radius: 4px;
}

/* Stili per header specifici */
.data-table .numeric-header {
    text-align: right;
}

.data-table .boolean-header {
    text-align: center;
}

.data-table .date-header {
    min-width: 120px;
}

/* Stili per tipi di contenuto specifici */
.data-table a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s ease;
}

.data-table a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Indicatori visivi per tipi di dato */
.data-table .numeric-cell::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 3px;
    background: #10b981;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.data-table .date-cell::before {
    content: '📅';
    margin-right: 4px;
    font-size: 0.8rem;
}

/* Stili per stati di caricamento migliorati */
.table-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 8px;
    margin: 2rem 0;
}

.table-loading i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #3b82f6;
}

.table-loading p {
    font-size: 1.1rem;
    margin: 0;
}

/* Stili per tabelle vuote migliorati */
.table-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: #9ca3af;
    background: #f9fafb;
    border-radius: 8px;
    margin: 2rem 0;
    border: 2px dashed #d1d5db;
}

.table-empty::before {
    content: '📊';
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Tooltips per celle troncate */
.text-cell[title] {
    cursor: help;
}

/* Miglioramenti responsive per il sistema universale */
@media (max-width: 768px) {
    .data-table .text-cell {
        max-width: 150px;
    }
    
    .data-table .numeric-cell::before,
    .data-table .date-cell::before {
        display: none;
    }
    
    .table-loading,
    .table-empty {
        padding: 2rem 1rem;
    }
}

@media (max-width: 480px) {
    .data-table .text-cell {
        max-width: 100px;
    }
    
    .data-table .boolean-cell {
        font-size: 0.8rem;
    }
}

/* Loading state */
.table-loading {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.table-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
}

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

/* Empty state */
.table-empty {
    text-align: center;
    padding: 3rem;
    color: #9ca3af;
}

.table-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #d1d5db;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .data-table {
        background: #1f2937;
        color: #f9fafb;
    }

    .data-table th {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
        color: #f9fafb;
    }

    .data-table td {
        color: #e5e7eb;
        border-bottom-color: #4b5563;
    }

    .data-table tr:hover {
        background: #374151;
    }

    .data-table tr:nth-child(even) {
        background: rgba(55, 65, 81, 0.5);
    }

    .data-table tr:nth-child(even):hover {
        background: #4b5563;
    }

    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .dataTables_wrapper .dataTables_length label,
    .dataTables_wrapper .dataTables_filter label {
        color: #e5e7eb;
    }

    .dataTables_wrapper .dataTables_info {
        color: #9ca3af;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
}

/* Stili per query parameters */
.field_label {
    color: #1f2937 !important;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group label {
    color: #1f2937 !important;
    font-weight: 500;
    margin-bottom: 8px;
}

.swagger-field-label {
    color: #1f2937 !important;
    font-weight: 600;
    font-size: 0.9rem;
}

.scheduler-border legend {
    color: #1A2A36 !important;
    font-weight: 600;
}



/* Stili per i contenuti dei modal e form */
.modal-content {
    color: #1f2937 !important;
}

.modal-content .alert-light {
    background-color: #f8f9fa !important;
    color: #1f2937 !important;
    border: 1px solid #dee2e6;
}

.modal-content .alert-light p {
    color: #1f2937 !important;
}

/* Stili per URL display */
.url-display {
    background: #f8f9fa !important;
    color: #1f2937 !important;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    margin-bottom: 1rem;
    line-height: 1.4;
}

/* Stili per tutti i testi nei fieldset */
fieldset {
    color: #1f2937 !important;
}

fieldset legend {
    color: #1A2A36 !important;
    font-weight: 600;
}

fieldset p,
fieldset span,
fieldset div {
    color: #1f2937 !important;
}

/* Stili per i pulsanti nei modal */
.modal-content .btn {
    color: white !important;
    font-weight: 500;
    text-decoration: none;
}

/* Modal styles */
.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);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #3b82f6 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.close:hover {
    opacity: 1;
}

.modal-body {
    padding: 2rem;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

/* Overlay styles */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    backdrop-filter: blur(3px);
}

.overlay-content {
    margin-right: auto;
    margin-left: auto;
    position: relative;
    background-color: #fff;
    padding: 20px;
    border-radius: 15px;
    animation: modalFadeIn 0.3s ease-in-out;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    overflow-x: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

@keyframes modalFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.close-btn:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: scale(1.1);
}

/* Dark mode support for modals */
@media (prefers-color-scheme: dark) {
    .modal-content,
    .overlay-content {
        background: #1f2937;
        color: #f9fafb;
    }

    .modal-header {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    }

    .modal-body {
        color: #e5e7eb;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .data-table th,
    .data-table td {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .dataTables_wrapper .dataTables_top {
        flex-direction: column;
        align-items: stretch;
    }

    .dataTables_wrapper .dataTables_filter input {
        min-width: 100%;
    }

    .dt-buttons {
        flex-wrap: wrap;
    }

    .dt-button {
        flex: 1;
        min-width: 120px;
    }

    .modal-content,
    .overlay-content {
        width: 95%;
        margin: 5% auto;
        border-radius: 10px;
    }

    .modal-header {
        padding: 1rem 1.5rem;
        border-radius: 10px 10px 0 0;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }

    .table-responsive {
        border-radius: 4px;
    }
}

.dataTables_filter > label {
  color: #000000; /* sostituisci con il colore desiderato */
}