/* UrbanPass - Stili Base */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo img {
    height: 40px;
    display: block;
}

@media (max-width: 768px) {
    .logo img {
        height: 32px;
    }
    
    .logo span {
        font-size: 1.25rem;
    }
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-info .separator {
    opacity: 0.5;
}

.comuni-assignati {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge-comune {
    background-color: #3498db;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-comune-more {
    background-color: #95a5a6;
    cursor: help;
}

.btn-logout {
    background-color: #e74c3c;
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #c0392b;
}

/* Navigation */
nav {
    background-color: #34495e;
    padding: 0.5rem 0;
    position: relative;
}

nav .container {
    display: flex;
    gap: 2rem;
    align-items: center;
    position: relative;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-links {
    display: flex;
    gap: 2rem;
    flex: 1;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

nav a.active {
    background-color: #2980b9;
    color: white;
    font-weight: 600;
    border-bottom: 3px solid #1f5f8b;
    position: relative;
    transition: background-color 0.3s;
    white-space: nowrap;
}

nav a:hover {
    background-color: #2c3e50;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 700px;
}

.login-box h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

/* Dashboard */
.dashboard {
    margin-top: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
}

/* Tables */
.data-table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.data-table thead {
    background-color: #34495e;
    color: white;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    vertical-align: top;
}

.data-table td:last-child {
    white-space: nowrap;
    min-width: 160px;
}

.data-table tbody tr {
    border-bottom: 1px solid #eee;
}

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-richiesta {
    background-color: #f39c12;
    color: white;
}

.badge-istruttoria {
    background-color: #3498db;
    color: white;
}

.badge-approvato {
    background-color: #27ae60;
    color: white;
}

.badge-respinto {
    background-color: #e74c3c;
    color: white;
}

.badge-archiviato {
    background-color: #95a5a6;
    color: white;
}

/* Filters */
.filters {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
}

.filter-group {
    display: inline-block;
    margin-right: 1rem;
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.filter-group input,
.filter-group select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0;
}

.admin-page .page-header {
    margin-bottom: 1.5rem;
    padding: 0;
}

/* Custom Dialog */
.custom-dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.custom-dialog-overlay.show {
    display: flex;
}

.custom-dialog {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 550px;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.custom-dialog-content {
    padding: 1.5rem;
    overflow: visible;
    flex: 1;
    line-height: 1.6;
    color: #333;
    max-height: none;
}

.custom-dialog-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.custom-dialog-message {
    font-size: 1rem;
    white-space: pre-line;
    word-wrap: break-word;
    margin-bottom: 1rem;
}

.custom-dialog-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    background-color: #f8f9fa;
}

.custom-dialog-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    font-weight: 500;
}

.custom-dialog-btn:hover {
    transform: translateY(-1px);
}

.custom-dialog-btn:active {
    transform: translateY(0);
}

.custom-dialog-btn-primary {
    background-color: #3498db;
    color: white;
}

.custom-dialog-btn-primary:hover {
    background-color: #2980b9;
}

.custom-dialog-btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.custom-dialog-btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Multi-step Form */
.multi-step-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-step {
    display: none;
}

.form-step.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 400px;
}

.form-step h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Practice Detail */
.practice-detail {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.detail-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #eee;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab:hover {
    color: #3498db;
}

.tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none;
    padding: 1.5rem 0;
    min-height: 300px;
    width: 100%;
}

.tab-content.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    animation: fadeIn 0.3s ease-in;
    position: relative !important;
    z-index: 1 !important;
}

/* Forza la visualizzazione per il tab documenti quando è attivo */
#tab-documenti.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#tab-documenti.active .documenti-section {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#tab-documenti.active .section-header {
    display: flex !important;
    visibility: visible !important;
}

#tab-documenti.active #lista-documenti-pratica {
    display: block !important;
    visibility: visible !important;
}

#tab-documenti.active .btn {
    display: inline-block !important;
    visibility: visible !important;
}

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

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.documenti-section {
    margin-bottom: 2rem;
    padding: 1rem 0;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 200px;
    background-color: transparent;
}

.documenti-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
}

.section-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 1rem;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 50px;
}

.section-header h3 {
    margin-bottom: 0;
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
}

.lista-documenti-container {
    min-height: 100px;
    padding: 1rem 0;
}

.lista-documenti-container p {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.lista-documenti-container .loading-message {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 2rem 0;
}

.lista-documenti-container .error {
    color: #e74c3c;
    padding: 1rem;
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    margin: 1rem 0;
}

.lista-documenti-container .empty-message {
    color: #666;
    text-align: center;
    padding: 2rem;
    background-color: #f8f9fa;
    border: 1px dashed #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.lista-documenti-container .data-table {
    margin-top: 1rem;
}

.lista-documenti-container .data-table th {
    background-color: #34495e;
    color: white;
    font-weight: 600;
    padding: 1rem;
}

.lista-documenti-container .data-table td {
    padding: 1rem;
    vertical-align: middle;
}

.lista-documenti-container .data-table .btn-sm {
    margin-right: 0.5rem;
}

.form-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    border: 1px solid #e0e0e0;
}

.form-container h4 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.form-container .form-group {
    margin-bottom: 1.25rem;
}

.form-container .form-group label {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.form-container .form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.875rem;
}

.form-container input[type="file"] {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.form-container input[type="file"]:hover {
    border-color: #3498db;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th,
.detail-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.detail-table th {
    font-weight: 600;
    color: #666;
    width: 200px;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #3498db;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #3498db;
}

.timeline-content {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
}

.timeline-content h4 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.timeline-content p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: #666;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    text-align: center;
    margin-top: 2rem;
}

/* Responsive - Smartphone Piccoli (< 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    header {
        padding: 0.75rem 0;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .user-info {
        font-size: 0.75rem;
    }
    
    .admin-page,
    .config-page,
    .richiedenti-page {
        padding: 0.75rem;
        margin-top: 0.5rem;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-content {
        width: 98%;
        padding: 1rem;
        max-height: 90vh;
    }
    
    .data-table {
        min-width: 500px;
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .config-card {
        padding: 1rem;
    }
    
    .config-card-icon {
        font-size: 2rem;
    }
    
    .config-card h3 {
        font-size: 1.1rem;
    }
    
    #map {
        height: 300px !important;
    }
    
    .street-view-container {
        height: 300px !important;
    }
}

/* Responsive - Mobile e Tablet Portrait (max-width: 768px) */
@media (max-width: 768px) {
    /* Header responsive */
    header .container {
        flex-wrap: wrap;
    }
    
    .user-info {
        width: 100%;
        margin-top: 0.5rem;
        font-size: 0.875rem;
        flex-wrap: wrap;
    }
    
    .user-info .separator {
        display: none;
    }
    
    .user-info > span {
        display: block;
        margin-bottom: 0.25rem;
    }
    
    .comuni-assignati {
        width: 100%;
        margin-top: 0.5rem;
        flex-wrap: wrap;
    }
    
    .btn-logout {
        margin-top: 0.5rem;
        width: 100%;
        text-align: center;
    }
    
    /* Navigation mobile */
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #34495e;
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        z-index: 1000;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    .nav-links.active {
        max-height: 500px;
    }
    
    .nav-links a {
        display: block;
        padding: 0.75rem 1.5rem;
        border-radius: 0;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        transition: background-color 0.2s, color 0.2s;
    }
    
    .nav-links a.active {
        background-color: #2980b9;
        color: white;
        font-weight: 600;
        border-left: 4px solid #1f5f8b;
    }
    
    .nav-links a:last-child {
        border-bottom: none;
    }
    
    /* Stats grid */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-header .btn {
        width: 100%;
    }
    
    /* Detail header */
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    /* Tables responsive */
    .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -20px;
        padding: 0 20px;
    }
    
    .data-table {
        min-width: 600px;
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .data-table td:last-child {
        min-width: 120px;
    }
    
    /* Lista documenti container */
    .lista-documenti-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .lista-documenti-container .data-table {
        min-width: 700px;
    }
    
    /* Config page tables */
    .config-page .data-table {
        min-width: 600px;
    }
    
    .config-page > div {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    /* Filters */
    .filters {
        padding: 1rem;
    }
    
    .filter-group {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .filter-group:last-child {
        margin-bottom: 0;
    }
    
    /* Forms */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Previene zoom su iOS */
    }
    
    /* Form step indicators più visibili */
    .form-step-indicator {
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    
    /* Labels più chiare */
    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
        font-weight: 600;
    }
    
    /* Spaziatura tra form groups */
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    /* Input focus più visibile */
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: 2px solid #3498db;
        outline-offset: 2px;
        border-color: #3498db;
    }
    
    /* Placeholder più leggibile */
    ::placeholder {
        font-size: 0.9rem;
        opacity: 0.7;
    }
    
    /* Bottoni form step più grandi */
    .multi-step-form .btn {
        min-height: 48px;
        font-size: 1.1rem;
        font-weight: 600;
    }
    
    /* Touch targets più grandi */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 0.5rem 1rem;
    }
    
    nav a {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
        display: flex;
        align-items: center;
    }
    
    .mobile-menu-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Checkbox e radio più grandi */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 0.5rem;
    }
    
    /* Select più grandi */
    select {
        min-height: 44px;
        padding: 0.75rem;
    }
    
    /* Input più grandi */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    textarea {
        min-height: 44px;
        padding: 0.75rem;
    }
    
    /* Mappa più alta su mobile */
    #map {
        height: 350px !important;
    }
    
    /* Street View ottimizzato */
    .street-view-container {
        height: 350px !important;
    }
    
    /* Controlli mappa più grandi */
    .map-controls {
        padding: 0.75rem;
    }
    
    .map-controls button {
        min-height: 44px;
        min-width: 44px;
        font-size: 1.1rem;
    }
    
    /* Modal */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
    }
    
    /* Admin pages */
    .admin-page,
    .config-page,
    .richiedenti-page {
        padding: 1rem;
        margin-top: 0.5rem;
    }
    
    /* Container padding */
    .container {
        padding: 0 15px;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Button groups */
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group .btn {
        margin-bottom: 0;
    }
    
    /* Action buttons in tables */
    .data-table td:last-child {
        white-space: normal;
    }
    
    .data-table td:last-child > div {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .data-table td:last-child .btn {
        width: 100%;
        min-width: auto;
        margin-bottom: 0;
    }
    
    /* Form page responsive */
    .form-page {
        padding: 1rem 0;
    }
    
    .multi-step-form {
        padding: 1rem;
    }
    
    /* Map responsive */
    #map {
        height: 400px !important;
    }
    
    /* Street View modal responsive */
    .street-view-container {
        height: 400px !important;
    }
    
    /* Config cards grid */
    .config-cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .config-card {
        padding: 1.5rem;
    }
    
    /* Stats cards */
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Detail table */
    .detail-table {
        font-size: 0.875rem;
    }
    
    .detail-table th,
    .detail-table td {
        padding: 0.5rem;
    }
    
    /* Radio groups */
    .radio-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Comuni checkbox grid */
    #comuni-checkbox {
        grid-template-columns: 1fr;
    }
    
    /* Modal form adjustments */
    .modal-body {
        padding: 1rem !important;
    }
    
    /* Timeline */
    .timeline {
        padding-left: 1rem;
    }
    
    .timeline-marker {
        left: -1.5rem;
    }
    
    /* Login */
    .login-box {
        margin: 1rem;
        padding: 1.5rem;
    }
}

/* Smooth scrolling e touch improvements per tablet e mobile */
@media (max-width: 1024px) {
    html {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    body {
        -webkit-tap-highlight-color: rgba(52, 152, 219, 0.2);
    }
    
    /* Prevenzione selezione testo accidentale */
    .btn,
    nav a,
    .mobile-menu-toggle {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
    
    /* Miglioramento scrollbar su mobile */
    .data-table-wrapper::-webkit-scrollbar,
    .lista-documenti-container::-webkit-scrollbar,
    .admin-page .utenti-list::-webkit-scrollbar,
    .admin-page .comuni-list::-webkit-scrollbar,
    .admin-page .qualita-list::-webkit-scrollbar {
        height: 8px;
    }
    
    .data-table-wrapper::-webkit-scrollbar-thumb,
    .lista-documenti-container::-webkit-scrollbar-thumb,
    .admin-page .utenti-list::-webkit-scrollbar-thumb,
    .admin-page .comuni-list::-webkit-scrollbar-thumb,
    .admin-page .qualita-list::-webkit-scrollbar-thumb {
        background: #3498db;
        border-radius: 4px;
    }
    
    .data-table-wrapper::-webkit-scrollbar-track,
    .lista-documenti-container::-webkit-scrollbar-track,
    .admin-page .utenti-list::-webkit-scrollbar-track,
    .admin-page .comuni-list::-webkit-scrollbar-track,
    .admin-page .qualita-list::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
}

/* Ottimizzazioni per orientamento landscape su mobile */
@media (max-width: 768px) and (orientation: landscape) {
    header {
        padding: 0.5rem 0;
    }
    
    .user-info {
        font-size: 0.8rem;
    }
    
    #map {
        height: 300px !important;
    }
    
    .street-view-container {
        height: 300px !important;
    }
    
    .modal-content {
        max-height: 80vh;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ridurre animazioni su dispositivi con preferenza reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Nascondere colonne meno importanti su tablet */
@media (min-width: 481px) and (max-width: 1024px) {
    .data-table .col-hidden-tablet {
        display: none;
    }
}

/* Config Hub Page */
.config-hub-page {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 1rem;
}

.config-hub-page .page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #eee;
}

.config-hub-page .page-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 2rem;
}

.config-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.config-card {
    display: block;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.config-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2980b9);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.config-card:hover {
    border-color: #3498db;
    box-shadow: 0 8px 16px rgba(52, 152, 219, 0.15);
    transform: translateY(-4px);
}

.config-card:hover::before {
    transform: scaleX(1);
}

.config-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.config-card h3 {
    margin: 0 0 0.75rem 0;
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
}

.config-card p {
    margin: 0 0 1rem 0;
    color: #666;
    line-height: 1.6;
    font-size: 0.95rem;
}

.config-card-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: #e8f4f8;
    color: #3498db;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.config-card-badge-super {
    background: #fff3cd;
    color: #856404;
}

@media (max-width: 768px) {
    .config-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .config-card {
        padding: 1.5rem;
    }
    
    .config-card-icon {
        font-size: 2.5rem;
    }
    
    .config-card h3 {
        font-size: 1.25rem;
    }
}

/* Tablet Portrait (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .config-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .data-table {
        min-width: 500px;
        font-size: 0.9rem;
    }
    
    .page-header {
        flex-direction: row;
        align-items: center;
    }
    
    .page-header .btn {
        width: auto;
        min-width: 150px;
    }
    
    .filters {
        display: flex;
        gap: 1rem;
    }
    
    .filter-group {
        flex: 1;
        margin-bottom: 0;
    }
    
    /* Azioni in riga su tablet */
    .data-table td:last-child > div {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .data-table td:last-child .btn {
        width: auto;
        flex: 1;
        min-width: 100px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .config-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .admin-page,
    .config-page,
    .richiedenti-page {
        padding: 1.5rem;
    }
    
    .modal-content {
        max-width: 700px;
    }
    
    /* Tabelle con colonne più compatte */
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Azioni in riga su tablet */
    .data-table td:last-child > div {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .data-table td:last-child .btn {
        width: auto;
        flex: 1;
        min-width: 100px;
    }
}

/* Admin Pages and Config Pages */
.admin-page,
.config-page,
.richiedenti-page {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.admin-page .page-header h2,
.config-page .page-header h2,
.richiedenti-page .page-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.75rem;
}

.admin-page .page-header {
    margin-bottom: 1.5rem;
    padding: 0;
    align-items: center;
    width: 100%;
}

.admin-page .page-header h2 {
    flex: 1;
    margin: 0;
}

.admin-page .page-header button {
    margin: 0;
    flex-shrink: 0;
    align-self: center;
}

.admin-page .filters {
    margin-bottom: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.admin-page .utenti-list,
.admin-page .comuni-list,
.admin-page .qualita-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Rimuovi overflow-x per utenti-list su desktop per evitare scroll orizzontale */
@media (min-width: 1025px) {
    .admin-page .utenti-list {
        overflow-x: visible;
    }
    
    /* Permetti al container di espandersi per la pagina utenti */
    .admin-utenti-page {
        max-width: 1700px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Container principale più largo per pagina utenti */
    main .container:has(.admin-utenti-page) {
        max-width: 1700px;
    }
}

.admin-page .utenti-list .data-table,
.admin-page .comuni-list .data-table,
.admin-page .qualita-list .data-table {
    min-width: 800px;
}

/* Tabella utenti: ottimizzazione per evitare scroll orizzontale */
.admin-page .utenti-list .data-table {
    min-width: auto;
    width: 100%;
    table-layout: fixed;
}

.admin-page .utenti-list .data-table th,
.admin-page .utenti-list .data-table td {
    padding: 0.85rem 0.75rem;
    font-size: 0.9rem;
}

.admin-page .utenti-list .data-table th:nth-child(1),
.admin-page .utenti-list .data-table td:nth-child(1) {
    width: 13%; /* Username */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.admin-page .utenti-list .data-table th:nth-child(2),
.admin-page .utenti-list .data-table td:nth-child(2) {
    width: 10%; /* Nome */
}

.admin-page .utenti-list .data-table th:nth-child(3),
.admin-page .utenti-list .data-table td:nth-child(3) {
    width: 12%; /* Cognome */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.admin-page .utenti-list .data-table th:nth-child(4),
.admin-page .utenti-list .data-table td:nth-child(4) {
    width: 19%; /* Email */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.admin-page .utenti-list .data-table th:nth-child(5),
.admin-page .utenti-list .data-table td:nth-child(5) {
    width: 9%; /* Ruolo */
}

.admin-page .utenti-list .data-table th:nth-child(6),
.admin-page .utenti-list .data-table td:nth-child(6) {
    width: 17%; /* Comuni */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 0; /* Permette al testo di andare a capo */
}

.admin-page .utenti-list .data-table th:nth-child(7),
.admin-page .utenti-list .data-table td:nth-child(7) {
    width: 6%; /* Stato */
}

.admin-page .utenti-list .data-table th:nth-child(8),
.admin-page .utenti-list .data-table td:nth-child(8) {
    width: 12%; /* Azioni */
    min-width: 200px;
    white-space: normal;
}

/* Bottoni azioni in orizzontale su schermi grandi */
@media (min-width: 1200px) {
    .admin-page .utenti-list .data-table td:nth-child(8) > div {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    
    .admin-page .utenti-list .data-table td:nth-child(8) .btn {
        width: auto;
        min-width: 110px;
        flex: 1;
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Su schermi più piccoli, assicura che i bottoni siano completamente visibili */
@media (min-width: 1025px) and (max-width: 1199px) {
    .admin-page .utenti-list .data-table th:nth-child(8),
    .admin-page .utenti-list .data-table td:nth-child(8) {
        min-width: 220px;
    }
    
    .admin-page .utenti-list .data-table td:nth-child(8) .btn {
        width: 100%;
        min-width: 200px;
    }
}

/* Assicura che i bottoni non vengano tagliati */
.admin-page .utenti-list .data-table td:nth-child(8) {
    overflow: visible;
}

.admin-page .utenti-list .data-table td:nth-child(8) .btn {
    white-space: nowrap;
    overflow: visible;
}

@media (max-width: 768px) {
    .admin-page .utenti-list,
    .admin-page .comuni-list,
    .admin-page .qualita-list {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
}

.admin-page .utenti-list,
.admin-page .comuni-list {
    margin: 0;
    padding: 0;
    width: 100%;
}

.admin-page .data-table {
    margin: 0;
    width: 100%;
    table-layout: auto;
}

.config-page .tab-content {
    padding: 1.5rem 0;
}

.config-page .tab-content h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-size: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #eee;
}

.config-page .form-group {
    margin-bottom: 1.5rem;
}

.config-page .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.config-page .form-group input[type="text"],
.config-page .form-group input[type="number"],
.config-page .form-group select,
.config-page .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.config-page .form-group input[type="text"]:focus,
.config-page .form-group input[type="number"]:focus,
.config-page .form-group select:focus,
.config-page .form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.config-page .form-group input[disabled] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.config-page .form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.875rem;
}

.config-page .form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.config-page p {
    margin: 1rem 0;
    color: #666;
    line-height: 1.6;
}

.config-page p em {
    font-style: italic;
}

.config-page p a {
    color: #3498db;
    text-decoration: none;
}

.config-page p a:hover {
    text-decoration: underline;
}

/* PWA Styles */
.pwa-install-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.3s;
    margin-left: 0.5rem;
}

.pwa-install-btn:hover {
    background-color: #2980b9;
}

.offline-banner {
    background-color: #f39c12;
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.pwa-update-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    max-width: 300px;
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.pwa-update-content span {
    color: #2c3e50;
    font-weight: 500;
}

@media (max-width: 768px) {
    .pwa-install-btn {
        width: 100%;
        margin: 0.5rem 0 0 0;
        padding: 0.75rem;
    }
    
    .pwa-update-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Lazy Loading Styles */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s;
}

img.lazy-loading {
    opacity: 0.5;
    filter: blur(5px);
}

img.lazy-loaded {
    opacity: 1;
    filter: none;
}

img.lazy-error {
    opacity: 0.3;
    background-color: #f0f0f0;
}

iframe[data-src],
.lazy-load[data-src] {
    min-height: 200px;
    background-color: #f5f5f5;
    display: block;
}

iframe.lazy-loading,
.lazy-load.lazy-loading {
    position: relative;
}

iframe.lazy-loading::before,
.lazy-load.lazy-loading::before {
    content: 'Caricamento...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 0.875rem;
}

iframe.lazy-loaded,
.lazy-load.lazy-loaded {
    background-color: transparent;
}

[data-bg] {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

[data-bg].lazy-loading {
    background-color: #f0f0f0;
}

[data-bg].lazy-loaded {
    transition: opacity 0.3s;
}

/* Table Card View for Mobile */
.table-cards-wrapper {
    display: none;
}

.table-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.table-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.table-card-field {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.table-card-field:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.table-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.table-card-value {
    font-size: 0.95rem;
    color: #2c3e50;
    line-height: 1.5;
    word-wrap: break-word;
}

.table-card-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.table-card-actions .btn {
    width: 100%;
    text-align: center;
    margin: 0;
}

.table-card-actions .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Mostra card view solo su mobile piccolo */
@media (min-width: 481px) {
    .table-cards-wrapper {
        display: none !important;
    }
    
    .data-table[data-converted="cards"] {
        display: table !important;
    }
}

/* Nascondi tabella e mostra card su mobile piccolo */
@media (max-width: 480px) {
    .data-table[data-converted="cards"] {
        display: none !important;
    }
    
    .table-cards-wrapper {
        display: block !important;
    }
    
    /* Migliora stile card su mobile molto piccolo */
    .table-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .table-card-field {
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .table-card-label {
        font-size: 0.7rem;
    }
    
    .table-card-value {
        font-size: 0.875rem;
    }
}

/* Form Mobile UX Improvements */
.field-error-mobile {
    color: #e74c3c;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: block;
    font-weight: 500;
}

.field-invalid {
    border-color: #e74c3c !important;
    background-color: #fff5f5;
}

.field-valid {
    border-color: #27ae60 !important;
    background-color: #f0fff4;
}

.form-progress-indicator {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
}

/* Miglioramenti input mobile */
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Focus migliorato per mobile */
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Date picker mobile */
input[type="date"] {
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Autocomplete migliorato */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: #2c3e50;
    transition: background-color 5000s ease-in-out 0s;
}

@media (max-width: 768px) {
    .form-progress-indicator {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .progress-bar {
        height: 6px;
    }
    
    .progress-text {
        font-size: 0.8rem;
    }
    
    /* Input più grandi su mobile */
    input,
    select,
    textarea {
        font-size: 16px !important; /* Previene zoom su iOS */
    }
}

/* Pull-to-Refresh */
.pull-to-refresh-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    transition: transform 0.2s ease;
    pointer-events: none;
}

.pull-to-refresh-icon {
    font-size: 1.5rem;
    color: #3498db;
    transition: transform 0.3s ease;
}

.pull-to-refresh-indicator.ready .pull-to-refresh-icon {
    transform: rotate(180deg);
}

.pull-to-refresh-indicator.refreshing .pull-to-refresh-icon {
    animation: spin 1s linear infinite;
}

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

.pull-to-refresh-text {
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
}

.pull-to-refresh-indicator.ready .pull-to-refresh-text {
    color: #3498db;
}

/* Posizionamento relativo per elementi scrollabili */
.practices-list,
.recent-practices,
.dashboard,
[data-pull-to-refresh] {
    position: relative;
}

/* Skeleton Screens */
.skeleton-table,
.skeleton-cards,
.skeleton-list {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-loading {
    position: relative;
    min-height: 200px;
}

.skeleton-table-header,
.skeleton-table-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.skeleton-table-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0e0e0;
}

.skeleton-cell {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-header-cell {
    height: 24px;
    background: linear-gradient(90deg, #d0d0d0 25%, #c0c0c0 50%, #d0d0d0 75%);
    background-size: 200% 100%;
}

.skeleton-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.skeleton-line {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-list-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    flex-shrink: 0;
}

.skeleton-content {
    flex: 1;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Nascondi skeleton quando caricato */
.skeleton-loading > *:not(.skeleton-table):not(.skeleton-cards):not(.skeleton-list) {
    opacity: 0.3;
    pointer-events: none;
}

/* Accessibilità Mobile */
/* Focus visibile migliorato */
*:focus-visible {
    outline: 3px solid #3498db;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Skip link per accessibilità */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2c3e50;
    color: white;
    padding: 0.75rem 1rem;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

/* Contrasto migliorato per accessibilità */
.btn,
.btn-primary,
.btn-secondary {
    min-height: 44px;
    min-width: 44px;
}

/* ARIA live regions */
[role="alert"],
[aria-live] {
    position: relative;
}

/* Miglioramenti contrasto testo */
@media (prefers-contrast: high) {
    body {
        color: #000;
        background-color: #fff;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .data-table th {
        background-color: #000;
        color: #fff;
    }
}

/* Supporto font size sistema */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus trap per modali */
.modal:focus-within,
.custom-dialog:focus-within {
    outline: none;
}

/* Miglioramenti screen reader */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Miglioramenti touch target per accessibilità */
@media (max-width: 768px) {
    a,
    button,
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    select {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Focus più visibile su mobile */
    *:focus {
        outline: 3px solid #3498db;
        outline-offset: 3px;
    }
}

/* PWA Install Section nelle Configurazioni */
.pwa-install-section {
    animation: fadeIn 0.3s ease-in;
}

.pwa-install-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

.pwa-install-section ul li {
    margin-bottom: 0.5rem;
}

.pwa-install-section code {
    background: #f0f0f0;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
    font-family: 'Courier New', monospace;
}

@media (max-width: 768px) {
    .pwa-install-section {
        padding: 1.5rem !important;
    }
    
    .pwa-install-section > div {
        flex-direction: column !important;
    }
    
    .pwa-install-section > div > div:last-child {
        flex: 1 !important;
        margin-top: 1.5rem;
    }
}

/* Sezione Permessi Operatore - Allineamento migliorato */
#sezione-permessi-operatore > div > div[style*="grid-template-columns"] {
    display: grid !important;
}

@media (max-width: 768px) {
    #sezione-permessi-operatore > div > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    #sezione-permessi-operatore > div > div[style*="grid-template-columns"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}


