/* File: frontend/html/css/pulizie.css */
/* Stili specifici per la pagina Pulizie - LAYOUT SISTEMATO */

.pulizie-card {
    margin-bottom: 1.5rem;
}

/* Form di aggiunta record - NUOVO LAYOUT */
.pulizie-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e1e8ed;
    margin-bottom: 2rem;
}

.pulizie-form h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-weight: 400;
}

.pulizie-form-row {
    display: grid;
    grid-template-columns: 200px 120px 140px 140px 140px 140px;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.pulizie-form-column {
    display: flex;
    flex-direction: column;
}

.pulizie-form-column label {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.4rem;
    font-weight: 500;
    white-space: nowrap;
}

.pulizie-form-input {
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    height: 40px;
    background: white;
    box-sizing: border-box;
}

.pulizie-form-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Tutti i bottoni della form hanno la stessa altezza e larghezza */
.btn-add-standard,
.quick-action-btn-blue,
.quick-action-btn-purple,
.quick-action-btn-green {
    height: 40px;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    padding: 0 1rem;
    width: 100%;
    box-sizing: border-box;
}

.btn-add-standard {
    background: #3498db;
    color: white;
}

.btn-add-standard:hover {
    background: #2980b9;
}

.quick-action-btn-blue {
    background: #3498db;
    color: white;
}

.quick-action-btn-blue:hover {
    background: #2980b9;
}

.quick-action-btn-purple {
    background: #9b59b6;
    color: white;
}

.quick-action-btn-purple:hover {
    background: #8e44ad;
}

.quick-action-btn-green {
    background: #27ae60;
    color: white;
}

.quick-action-btn-green:hover {
    background: #229954;
}

/* Statistiche - LAYOUT A TABELLA 2x3 */
.pulizie-statistics {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
    min-height: 120px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e1e8ed;
    text-align: center;
}

.stat-label {
    font-weight: 500;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.stat-value.paid {
    color: #27ae60;
}

.stat-value.unpaid {
    color: #e74c3c;
}

/* Bottone gestisci tariffe dentro la griglia */
.manage-tariffe-btn {
    background: #9b59b6;
    color: white;
    border: none;
    padding: 0.8rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manage-tariffe-btn:hover {
    background: #8e44ad;
}

/* Posizionamento specifico degli elementi nella griglia statistiche */
.stat-item:nth-child(1) { /* Totale ore */
    grid-column: 1;
    grid-row: 1;
}

.stat-item:nth-child(2) { /* Importo totale */
    grid-column: 1;
    grid-row: 2;
}

.stat-item:nth-child(3) { /* Da pagare */
    grid-column: 2;
    grid-row: 1;
}

.stat-item:nth-child(4) { /* Già pagato */
    grid-column: 2;
    grid-row: 2;
}

.stat-item:nth-child(5) { /* Tariffa attuale */
    grid-column: 3;
    grid-row: 1;
}

.stat-item:nth-child(6) { /* Bottone gestisci tariffe */
    grid-column: 3;
    grid-row: 2;
    background: transparent;
    border: none;
    padding: 0;
}

/* Modal tariffe */
.tariffe-list {
    padding: 1rem 0;
}

.tariffe-list h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.tariffe-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.tariffe-table th,
.tariffe-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
}

.tariffe-table th {
    background: #f8f9fa;
    font-weight: 500;
    color: #555;
}

.tariffe-table .active-rate {
    background-color: #d5f4e6;
}

.tariffe-table .historic-rate {
    background-color: #f8f9fa;
    opacity: 0.8;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active-rate {
    background-color: #27ae60;
    color: white;
}

.status-badge.historic-rate {
    background-color: #95a5a6;
    color: white;
}

/* Form nuova tariffa */
.add-tariffa-form {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    border-top: 2px solid #3498db;
}

.add-tariffa-form h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.tariffa-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.add-tariffa-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    height: 40px;
}

.add-tariffa-btn:hover {
    background: #2980b9;
}

/* Tabella pulizie */
#pulizieTable {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

#pulizieTable thead {
    background: #2c3e50;
}

#pulizieTable th,
#pulizieTable td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
}

#pulizieTable th {
    font-weight: 500;
    color: white;
}

#pulizieTable .date-cell {
    width: 15%;
}

#pulizieTable .hours-cell {
    width: 12%;
    text-align: center;
}

#pulizieTable .amount-cell {
    width: 15%;
    text-align: right;
}

#pulizieTable .payment-status-cell {
    width: 15%;
    text-align: center;
}

#pulizieTable .payment-date-cell {
    width: 15%;
}

#pulizieTable .action-cell {
    width: 12%;
    text-align: center;
}

/* Alternating row colors */
#pulizieTable tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

#pulizieTable tbody tr:nth-child(odd) {
    background-color: white;
}

/* Hover effect */
#pulizieTable tbody tr:hover {
    background-color: #e3f2fd !important;
}

/* Editing row */
#pulizieTable .editing-row {
    background-color: #fff3e0 !important;
}

/* Payment status indicators */
.payment-status {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
    text-align: center;
}

.status-paid {
    background-color: #d5f4e6;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-paid:hover {
    background-color: #c3e6cb;
}

.status-unpaid {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f1c2c7;
}

.status-unpaid:hover {
    background-color: #f1c2c7;
}

/* Action buttons - riutilizza da components.css */
.pulizie-card .action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding: 0;
    transition: all 0.2s ease;
    margin: 0 2px;
}

.pulizie-card .edit-btn {
    background-color: #2196f3;
    color: white;
}

.pulizie-card .edit-btn:hover {
    background-color: #1976d2;
}

.pulizie-card .save-btn {
    background-color: #4caf50;
    color: white;
}

.pulizie-card .save-btn:hover {
    background-color: #388e3c;
}

.pulizie-card .delete-btn {
    background-color: #f44336;
    color: white;
}

.pulizie-card .delete-btn:hover {
    background-color: #d32f2f;
}

/* Inline editing */
.pulizie-card .inline-edit-input {
    border: 1px solid #2196f3;
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.9rem;
    width: 100%;
    background: white;
    box-sizing: border-box;
}

.pulizie-card .inline-edit-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    .pulizie-form-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .pulizie-form-column:nth-child(1) { /* Data */
        grid-column: 1;
    }
    
    .pulizie-form-column:nth-child(2) { /* Ore */
        grid-column: 2;
    }
    
    .pulizie-form-column:nth-child(3) { /* Aggiungi */
        grid-column: 1;
    }
    
    .pulizie-form-column:nth-child(4) { /* Aggiungi 3h */
        grid-column: 2;
    }
    
    .pulizie-form-column:nth-child(5) { /* Aggiungi 4h */
        grid-column: 1;
    }
    
    .pulizie-form-column:nth-child(6) { /* Segna pagate */
        grid-column: 2;
    }
    
    .pulizie-form-column {
        margin-bottom: 1rem;
    }
    
    .pulizie-statistics {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(6, auto);
        gap: 0.5rem;
    }
    
    .stat-item:nth-child(1), 
    .stat-item:nth-child(2), 
    .stat-item:nth-child(3), 
    .stat-item:nth-child(4), 
    .stat-item:nth-child(5), 
    .stat-item:nth-child(6) {
        grid-column: 1;
        grid-row: auto;
    }
    
    .tariffa-form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    #pulizieTable {
        font-size: 0.85rem;
        min-width: 600px;
    }
    
    #pulizieTable th,
    #pulizieTable td {
        padding: 0.5rem;
    }
    
    .payment-status {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
        min-width: 60px;
    }
    
    /* Scroll orizzontale per tabelle su mobile */
    .table-container {
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .pulizie-form {
        padding: 1rem;
    }
    
    .pulizie-form-row {
        grid-template-columns: 1fr;
    }
    
    .pulizie-form-column {
        grid-column: 1 !important;
    }
    
    .pulizie-statistics {
        margin-bottom: 1rem;
    }
}

/* Stili per l'ordinamento (aggiungere alla fine del file) */
#pulizieTable .sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
}

#pulizieTable .sortable:hover {
    background: #34495e;
}

#pulizieTable .sortable.active {
    background: #34495e;
}

#pulizieTable .sort-arrows {
    float: right;
    margin-left: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#pulizieTable .sort-arrow {
    font-size: 0.7rem;
    color: #95a5a6;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

#pulizieTable .sort-arrow:hover {
    color: white;
}

#pulizieTable .sort-arrow.active {
    color: #3498db;
    font-weight: bold;
}
