/* app.css - Rubrica DLG Multi-Utente
 * @version     3.1.0
 * @description Sistema ottimizzato per monitor 27" (1920x1080)
 *              con supporto multi-utente e 250 record per pagina
 * @lastmod     09.09.2025 15:56
 * @credits     Giampo @ Bangherangstudio.it
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    font-size: 14px;
}

/* ===========================
   LOGIN STYLES
   =========================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #333;
}

.login-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 13px;
}

.login-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 12px;
    line-height: 1.6;
}

.login-info strong {
    color: #4a5568;
    display: block;
    margin-bottom: 5px;
}

.login-info code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background: #5a67d8;
}

/* ===========================
   MAIN CONTAINER
   =========================== */
.main-container {
    display: none;
    width: 100%;
    max-width: 100vw;
    padding: 10px;
    margin: 0 auto;
}

/* ===========================
   HEADER
   =========================== */
.header {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 15px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.user-info-bar {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.user-badge.admin {
    background: linear-gradient(135deg, #f56565, #ed8936);
}

.user-badge.op1 {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.user-badge.op2 {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.user-badge.op3 {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
}

#saveIndicator {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-success {
    background: #48bb78;
    color: white;
}

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

.btn-split {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #e5e7eb;
    color: #6b7280;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.3;
    transition: all 0.2s;
    min-width: 30px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

tr:hover .btn-split {
    opacity: 0.8;
}

.btn-split:hover {
    background: #fbbf24;
    color: #78350f;
    transform: translateY(-50%) scale(1.1);
    opacity: 1;
}

.btn-bookmark {
    background: transparent;
    border: 1px solid #e2e8f0;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-bookmark:hover {
    background: #f7fafc;
}

.btn-bookmark.active {
    background: #fef3c7;
    border-color: #f59e0b;
}

/* ===========================
   STATS BAR
   =========================== */
.stats-bar {
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #f7fafc;
    border-radius: 5px;
    font-size: 13px;
}

.stat-item strong {
    color: #2d3748;
}

/* ===========================
   TABLE CONTAINER
   =========================== */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    width: 100%;
    height: calc(100vh - 280px);
    margin-bottom: 60px;
}

.table-wrapper {
    overflow: auto;
    width: 100%;
    height: 100%;
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

/* ===========================
   TABLE STYLES
   =========================== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
}

th {
    background: #f7fafc;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th:hover {
    background: #e2e8f0;
}

/* Nascondi colonne inutili */
th[data-column="position"],
td.position-cell,
th[data-column="referente"],
td[data-column="referente"] {
    display: none !important;
}

/* Larghezze colonne ottimizzate */
th[data-column="nomeCompleto"] { width: 400px !important; min-width: 400px !important; max-width: 400px !important; }
th[data-column="regione"] { width: 70px !important; min-width: 70px !important; }
th[data-column="ente"] { width: 130px !important; min-width: 130px !important; }
th[data-column="cognome"] { width: 90px !important; min-width: 90px !important; }
th[data-column="nome"] { width: 90px !important; min-width: 90px !important; }
th[data-column="email"] { width: 120px !important; min-width: 120px !important; }
th[data-column="telefono"] { width: 90px !important; min-width: 90px !important; }
th[data-column="memoA"] { width: 40px !important; min-width: 40px !important; }
th[data-column="memoB"] { width: 40px !important; min-width: 40px !important; }
th[data-column="memoC"] { width: 40px !important; min-width: 40px !important; }
th[data-column="memoD"] { width: 50px !important; min-width: 50px !important; }
th[data-column="memoE"] { width: 60px !important; min-width: 60px !important; }
th[data-column="bookmark"] { width: 45px !important; min-width: 45px !important; }

/* Headers MEMO */
th[data-column^="memo"] {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

td {
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

tr:hover {
    background: #f7fafc;
}

tr.needs-cleaning {
    background: #fef5e7;
}

tr.needs-cleaning:hover {
    background: #fef3c7;
}

/* ===========================
   NOME COMPLETO STYLES
   =========================== */
.nome-completo-cell {
    font-weight: 500;
}

.compact-nome {
    max-width: 400px !important;
    overflow: visible !important;
}

.nome-completo-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    position: relative;
}

.btn-split-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.nome-completo-wrapper span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    max-width: calc(100% - 35px);
    cursor: default;
    position: relative;
}

/* Scroll orizzontale al hover/focus */
.nome-completo-wrapper span:hover,
.nome-completo-wrapper span:focus {
    overflow-x: auto;
    text-overflow: initial;
    background: #f7fafc;
    padding: 2px 4px;
    border-radius: 3px;
    outline: none;
}

/* Scrollbar sottile per il nome */
.nome-completo-wrapper span::-webkit-scrollbar {
    height: 4px;
}

.nome-completo-wrapper span::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 2px;
}

.nome-completo-wrapper span::-webkit-scrollbar-thumb {
    background: #a0aec0;
    border-radius: 2px;
}

/* Rendi il campo nome selezionabile e scrollabile */
.nome-completo-wrapper span {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    tabindex: 0;
}

.nome-completo-wrapper > span[style*="background: #fee"] {
    font-size: 9px !important;
    padding: 1px 4px !important;
    margin-left: 5px !important;
}

/* ===========================
   INPUT FIELDS
   =========================== */
.editable {
    width: 100%;
    border: 1px dashed #cbd5e0;
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 12px;
    background: transparent;
    transition: none;
}

.editable.compact {
    padding: 3px 5px;
    font-size: 12px;
}

.editable.memo {
    text-align: center;
    font-weight: 600;
    font-size: 11px;
}

.editable.memo::placeholder {
    font-size: 10px;
    opacity: 0.5;
}

.editable:hover {
    border-color: #a0aec0;
    background: #f7fafc;
}

.editable:focus {
    border: 1px solid #667eea;
    border-style: solid;
    background: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
    transition: box-shadow 0.2s;
}

.editable.highlight-empty {
    background: #fee2e2;
    border-color: #fca5a5;
}

.select-referente.compact {
    width: 100%;
    padding: 3px 5px;
    font-size: 12px;
    border: 1px dashed #cbd5e0;
    border-radius: 3px;
    background: white;
    cursor: pointer;
}

.select-referente.compact:hover {
    border-color: #a0aec0;
    background: #f7fafc;
}

.select-referente.compact:focus {
    border: 1px solid #667eea;
    outline: none;
}

/* ===========================
   PROVINCIA DROPDOWN
   =========================== */
.provincia-cell {
    position: relative;
}

.provincia-input {
    width: 100%;
    padding: 3px 5px;
    border: 1px dashed #cbd5e0;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    background: white;
}

.provincia-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 2px;
    min-width: 150px;
}

.provincia-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.provincia-dropdown-header button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.provincia-dropdown-header button:hover {
    background: #e5e7eb;
    border-radius: 4px;
}

.provincia-option {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.provincia-option:hover {
    background: #e0f2fe;
}

.provincia-option.selected {
    background: #dbeafe;
    font-weight: 600;
}

.provincia-header {
    background: #f0f0f0;
    padding: 8px 12px;
    font-weight: bold;
    font-size: 11px;
    color: #666;
    cursor: default;
    position: sticky;
    top: 40px;
    z-index: 1;
}

.provincia-clear {
    background: #fee;
    color: #c00;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
}

.provincia-option[style*="display: none"] ~ .provincia-header {
    display: none !important;
}

/* ===========================
   BOOKMARK
   =========================== */
.bookmark-cell {
    text-align: center;
}

/* ===========================
   PAGINATION
   =========================== */
.pagination {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #e2e8f0;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.page-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    min-width: 100px;
}

.page-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.page-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #cbd5e0;
}

.page-info {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    background: #f7fafc;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #48bb78;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    animation: slideIn 0.3s ease-out;
    font-size: 13px;
    z-index: 9999;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===========================
   LOADING OVERLAY
   =========================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===========================
   SAVED INDICATOR
   =========================== */
@keyframes savedFlash {
    0% { background-color: #c6f6d5; }
    100% { background-color: transparent; }
}

.saved-indicator {
    animation: savedFlash 1s ease-out;
}

/* ===========================
   MODAL SPLIT
   =========================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.closing {
    animation: fadeOut 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.split-modal-content {
    max-width: 700px !important;
}

.modal-overlay.closing .modal-content {
    animation: slideDown 0.3s ease-out;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

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

.current-values {
    background: #fee2e2;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.current-values h4 {
    margin: 0 0 10px 0;
    color: #991b1b;
    font-size: 14px;
}

.current-value-item {
    display: flex;
    padding: 5px 0;
    font-size: 13px;
}

.current-value-item label {
    font-weight: 600;
    width: 100px;
    color: #7f1d1d;
}

.current-value-item span {
    color: #991b1b;
}

.empty-value {
    color: #dc2626;
    font-style: italic;
}

.split-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: start;
}

.comparison-before,
.comparison-after {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.comparison-before {
    border: 2px solid #dc2626;
}

.comparison-after {
    border: 2px solid #16a34a;
}

.comparison-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #6b7280;
    padding-top: 50px;
}

.original-name {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.original-name label {
    display: block;
    font-size: 12px;
    color: #718096;
    margin-bottom: 5px;
    font-weight: 600;
}

.original-value {
    font-size: 16px;
    color: #2d3748;
    font-weight: 500;
}

.arrow-down {
    text-align: center;
    font-size: 24px;
    margin: 10px 0;
    animation: bounce 2s infinite;
}

.split-preview {
    background: #f0f7ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 20px;
}

.split-type {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.type-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.type-persona {
    background: #e6fffa;
    color: #047481;
}

.type-azienda {
    background: #fef5e7;
    color: #7c2d12;
}

.confidence-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.confidence-badge.high {
    background: #c6f6d5;
    color: #22543d;
}

.confidence-badge.medium {
    background: #fed7aa;
    color: #7c2d12;
}

.confidence-badge.low {
    background: #fed7d7;
    color: #742a2a;
}

.split-fields {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.field-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.field-group label {
    width: 120px;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
}

.modal-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.modal-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-input:hover {
    border-color: #cbd5e0;
}

.modal-info {
    margin-top: 20px;
    padding: 12px 15px;
    background: #fef5e7;
    border-left: 4px solid #f6ad55;
    border-radius: 4px;
    font-size: 13px;
    color: #744210;
}

.modal-info strong {
    color: #5a3f0f;
}

.modal-footer {
    background: #f8f9fa;
    padding: 20px 25px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #e2e8f0;
}

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

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

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

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* ===========================
   ADMIN FILTERS
   =========================== */
.admin-filters {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    padding: 8px 15px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #3b82f6;
    border-radius: 8px;
    margin-right: 15px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
}

.filter-select {
    padding: 6px 10px;
    border: 1px solid #3b82f6;
    border-radius: 5px;
    background: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    min-width: 180px;
}

.filter-select:hover {
    background: #f0f9ff;
}

.filter-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.filter-count {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    background: white;
    border-radius: 4px;
    white-space: nowrap;
}

.utile-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    margin-right: 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
}

.utile-badge:hover {
    transform: scale(1.2);
}

.utile-badge.utile-si {
    background: #dcfce7;
}

.utile-badge.utile-no {
    background: #fee2e2;
}

tr.non-utile {
    background: #fef2f2 !important;
}

tr.non-utile:hover {
    background: #fee2e2 !important;
}

.pdf-info {
    display: inline-block;
    padding: 4px 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    border-radius: 4px;
    margin-left: 5px;
}

/* ===========================
   SCROLLBAR STYLES
   =========================== */
.table-wrapper::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 5px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ===========================
   PERFORMANCE OPTIMIZATIONS
   =========================== */
* {
    animation-duration: 0.2s !important;
    transition-duration: 0.2s !important;
}

.editable {
    transition: none !important;
}

.editable:focus {
    transition: box-shadow 0.2s !important;
}

tr:hover {
    transition: none;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1920px) {
    .main-container {
        padding: 8px;
    }

    table {
        font-size: 12px;
    }

    .editable.compact {
        font-size: 11px;
        padding: 2px 4px;
    }
}

@media (min-width: 2560px) {
    body {
        font-size: 16px;
    }

    table {
        font-size: 14px;
    }

    .editable.compact {
        font-size: 13px;
        padding: 4px 6px;
    }

    th {
        font-size: 13px;
        padding: 12px 10px;
    }
}

@media (max-width: 1200px) {
    .admin-filters {
        margin-bottom: 10px;
        width: 100%;
    }

    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .field-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .field-group label {
        width: 100%;
        margin-bottom: 5px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ===========================
   PRINT STYLES
   =========================== */
@media print {
    .header,
    .stats-bar,
    .pagination,
    .btn-split,
    .btn-bookmark {
        display: none !important;
    }

    .table-container {
        box-shadow: none;
        height: auto;
    }

    table {
        font-size: 10px;
    }

    tr.needs-cleaning {
        background: #f0f0f0 !important;
    }
}

/* Aggiungi questi stili nel file app.css dopo gli stili dei pulsanti esistenti */

/* ===========================
   DELETE BUTTON STYLES
   =========================== */
.delete-cell {
    text-align: center;
    width: 45px !important;
    min-width: 45px !important;
}

th[data-column="delete"] {
    width: 45px !important;
    min-width: 45px !important;
    text-align: center;
    cursor: default;
}

.btn-delete {
    background: transparent;
    border: 1px solid #e2e8f0;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    opacity: 0.3;
}

tr:hover .btn-delete {
    opacity: 0.7;
}

.btn-delete:hover {
    background: #fee2e2;
    border-color: #f87171;
    opacity: 1;
    transform: scale(1.1);
}

.btn-delete:active {
    transform: scale(0.95);
}

/* Per admin - pulsante delete più visibile */
.user-badge.admin ~ * .btn-delete {
    opacity: 0.5;
}

/* Animazione di conferma eliminazione */
@keyframes deleteRow {
    0% {
        background: #fee2e2;
        opacity: 1;
    }
    100% {
        background: #ef4444;
        opacity: 0;
        transform: translateX(-100%);
    }
}

tr.deleting {
    animation: deleteRow 0.5s ease-out forwards;
}

/* ===========================
   CONTEXT MENU STYLES
   =========================== */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 10000;
    overflow: hidden;
}

.context-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.context-menu-item:hover {
    background: #f7fafc;
}

.context-menu-item.make-utile {
    color: #48bb78;
}

.context-menu-item.make-utile:hover {
    background: #e8f5e9;
}

.context-menu-item.make-non-utile {
    color: #f56565;
}

.context-menu-item.make-non-utile:hover {
    background: #fee2e2;
}