/* style.css */
* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    margin: 0;
    padding: 10px;
    background-color: #f5f5f5;
}

h1 {
    text-align: center;
    color: #333;
    font-size: 1.5rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

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

input, select, textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

textarea {
    height: 80px;
    resize: vertical;
}

.buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 150px; /* Larghezza minima per tutti i pulsanti */
}

/* Stili specifici per pulsanti desktop */
@media (min-width: 769px) {
    .buttons button {
        flex-grow: 0;
        flex-basis: 0;
        width: auto;
    }
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
}

.btn-secondary {
    background-color: #2196F3;
    color: white;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

.edit-btn, .delete-btn {
    padding: 5px 10px;
    margin: 2px;
}

@media print {
    .no-print {
        display: none;
    }
    body {
        background-color: white;
        padding: 0;
    }
    .container {
        box-shadow: none;
        padding: 0;
    }
}

.loading {
    text-align: center;
    padding: 20px;
}

.error {
    color: #f44336;
    padding: 10px;
    background-color: #ffebee;
    border-radius: 4px;
    margin-bottom: 15px;
}

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

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

.loading-spinner {
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: #333;
    border-radius: 50%;
    width: 20px;
    height: 20px;
}

.success-message {
    background-color: #4CAF50;
    color: white;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    animation: fadeIn 0.5s ease-in;
    display: none;
}

.saving-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.saving-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

/* Pulsanti con stato di caricamento */
button.is-loading {
    position: relative;
    color: transparent !important;
}

button.is-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    border: 3px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Stile per i filtri */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filters input, .filters select {
    flex: 1;
    min-width: 150px;
}

/* Stile per errori di validazione */
.has-error label {
    color: #f44336;
}

.has-error input, 
.has-error select, 
.has-error textarea {
    border-color: #f44336;
}

@media (max-width: 768px) {
    #rapportini-table thead {
        display: none;
    }
  
    #rapportini-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 5px;
        padding: 10px;
        position: relative;
    }
  
    #rapportini-table tbody td {
        display: flex;
        justify-content: space-between;
        border: none;
        padding: 5px;
        text-align: right;
    }
  
    #rapportini-table tbody td::before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        padding-right: 10px;
    }
  
    #rapportini-table tbody td:last-child {
        display: flex;
        justify-content: flex-end;
        gap: 5px;
        padding-top: 10px;
        border-top: 1px dashed #eee;
        margin-top: 5px;
    }
  
    #rapportini-table tbody td:last-child::before {
        display: none;
    }
  
    .container {
        padding: 10px;
    }
  
    .buttons button, .filters input, .filters select {
        flex-grow: 1;
        min-width: 120px;
        margin-bottom: 5px;
    }

    .edit-btn, .delete-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .buttons, .filters {
        flex-direction: column;
    }
  
    .form-group {
        margin-bottom: 12px;
    }
  
    input, select, textarea {
        padding: 10px;
    }
  
    h1 {
        font-size: 1.3rem;
    }
}

@media print {
    #rapportini-table tbody td {
        display: table-cell !important;
    }
  
    #rapportini-table tbody td::before {
        display: none !important;
    }
}

/* Stile per il pulsante Home */
.home-btn-container {
    text-align: center;
    margin: 20px auto;
    max-width: 800px;
}

.home-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.home-btn:hover {
    background-color: #5a6268;
}

.home-btn i {
    margin-right: 8px;
}