/* ========================================
   LISTA DELLA SPESA
   ======================================== */

/* LAYOUT PRINCIPALE */
#lista-spesa-content {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* HEADER PAGINA */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 10px;
}

/* FILTRI */
.filters-bar {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

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

.filter-group label {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

/* GRIGLIA INGREDIENTI */
.lista-ingredienti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

/* CARD INGREDIENTE */
.ingrediente-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.ingrediente-card:hover {
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
}

.ingrediente-card.selezionato {
    border-color: #4CAF50;
    background: #f1f8f4;
}

.ingrediente-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ingrediente-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.ingrediente-nome {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
}

.ingrediente-categoria {
    font-size: 12px;
    color: #7f8c8d;
    padding: 4px 8px;
    background: #ecf0f1;
    border-radius: 4px;
    margin-bottom: 8px;
    display: inline-block;
}

.ingrediente-quantita {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.ingrediente-quantita input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.ingrediente-unita {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    min-width: 30px;
}

/* RIEPILOGO */
.riepilogo-spesa {
    background: white;
    border: 2px solid #4CAF50;
    border-radius: 10px;
    padding: 20px;
    position: sticky;
    bottom: 20px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}

.riepilogo-spesa h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 20px;
}

#riepilogo-content {
    max-height: 300px;
    overflow-y: auto;
}

.riepilogo-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
}

.riepilogo-item:last-child {
    border-bottom: none;
}

.riepilogo-item-nome {
    font-weight: 600;
    color: #2c3e50;
}

.riepilogo-item-qta {
    color: #4CAF50;
    font-weight: 600;
}

/* CATEGORIA HEADERS */
.categoria-header {
    grid-column: 1 / -1;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    padding: 10px 0;
    border-bottom: 2px solid #4CAF50;
    margin-top: 10px;
}

/* TESTO MUTED */
.text-muted {
    color: #95a5a6;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* STAMPA */
@media print {
    .page-header .page-actions,
    .filters-bar,
    .ingrediente-card:not(.selezionato) {
        display: none !important;
    }

    .ingrediente-card.selezionato {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .riepilogo-spesa {
        position: static;
        box-shadow: none;
    }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .lista-ingredienti-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

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