/* ===== COMPONENTE CONDIVISO: Spesa Card ===== */
/* Usato da: Spese Previste (elenco-spese-new.html) e Spese Extra (spese-extra.html) */

/* --- Base Card --- */
.spesa-card {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    min-height: 80px;
    background-color: white;
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 2px;
}

.spesa-card:hover {
    background-color: #fff8f0;
    box-shadow: inset 4px 0 0 #ff7a00, 0 2px 8px rgba(0, 0, 0, 0.08);
}

.spesa-card .spesa-actions {
    position: relative;
    z-index: 10;
}

.spesa-card:last-child {
    border-bottom: none;
}

/* --- Stato terminato (Spese Previste) --- */
.spesa-card.terminated {
    opacity: 0.7;
    background-color: #fafafa;
}

.spesa-card.spesa-terminata:hover {
    background-color: #fff3e0;
    box-shadow: inset 4px 0 0 #ff9800, 0 2px 8px rgba(255, 152, 0, 0.2);
}

/* --- Sezione Sinistra --- */
.spesa-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

/* Indicatore di stato - nascosto */
.status-indicator {
    display: none;
}

/* Icona categoria (emoji - Spese Extra) */
.spesa-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 16px;
    flex-shrink: 0;
}

/* --- Info --- */
.spesa-info {
    flex: 1;
    min-width: 0;
}

/* --- Sezione Destra --- */
.spesa-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

/* --- Titolo e Sottotitolo --- */
.spesa-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spesa-subtitle {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.4;
}

/* --- Importo --- */
.spesa-amount {
    text-align: right;
}

.amount-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
}

.amount-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.amount-mensile {
    font-size: 10px;
    color: #9ca3af;
    font-weight: 400;
    margin-top: 1px;
}

/* --- Azioni (Pulsanti) --- */
.spesa-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.spesa-actions button {
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-storico {
    background-color: #f3f4f6;
    color: #374151;
}

.btn-storico:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
}

.btn-allegati {
    background-color: #10b981;
    color: white;
}

.btn-allegati:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-edit-spesa {
    background-color: #f59e0b;
    color: white;
}

.btn-edit-spesa:hover {
    background-color: #d97706;
    transform: translateY(-1px);
}

.btn-elimina-spesa {
    background-color: #ef4444;
    color: white;
}

.btn-elimina-spesa:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

/* ===== RESPONSIVE - Mobile (max 768px) ===== */
@media (max-width: 768px) {
    .spesa-card {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 12px;
    }

    .spesa-left {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .spesa-info {
        flex: 1;
    }

    .spesa-title {
        font-size: 16px;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.4;
    }

    .spesa-subtitle {
        white-space: normal;
        overflow: visible;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.5;
    }

    .spesa-right {
        flex-direction: row;
        justify-content: space-between;
        border-top: 1px solid #e5e7eb;
        padding-top: 12px;
    }

    .spesa-amount {
        text-align: left;
    }

    .amount-value {
        font-size: 18px;
    }
}

/* ===== RESPONSIVE - Tablet (769px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .spesa-title {
        font-size: 17px;
    }

    .spesa-subtitle {
        font-size: 13px;
    }

    .amount-value {
        font-size: 19px;
    }
}

/* ===== RESPONSIVE - Smartphone piccoli (max 480px) ===== */
@media (max-width: 480px) {
    .spesa-card {
        padding: 12px;
    }

    .spesa-title {
        font-size: 15px;
    }

    .spesa-subtitle {
        font-size: 13px;
    }

    .amount-value {
        font-size: 17px;
    }

    .spesa-actions button {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

/* ===== RESPONSIVE - Desktop (min 768px) ===== */
@media (min-width: 768px) {
    .spesa-card {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 24px;
        align-items: center;
    }

    .spesa-left {
        grid-column: 1;
        min-width: auto;
    }

    .spesa-info {
        grid-column: 2;
        min-width: 0;
    }

    .spesa-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        max-width: 100%;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .spesa-right {
        grid-column: 3;
        min-width: fit-content;
    }
}
