/* File: frontend/html/css/pivot.css */
/* Stili specifici per la pagina pivot */

.pivot-card {
    margin-bottom: 1.5rem;
}

.pivot-table-card {
    margin-bottom: 2rem;
}

.pivot-table-card h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-weight: 500;
    font-size: 1.2rem;
}

/* NUOVO: Stili per la card di drill down */
.pivot-drilldown-card {
    display: none; /* Nascosta di default */
    position: relative;
    border: 2px solid #3498db;
}

.pivot-drilldown-card .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    font-weight: bold;
    color: #95a5a6;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.pivot-drilldown-card .close-btn:hover {
    color: #2c3e50;
}

#drilldown-title {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-weight: 500;
    font-size: 1.2rem;
}

/* Filtri pivot */
.pivot-filters {
    display: flex;
    gap: 2rem;
    align-items: end;
    margin-bottom: 1rem;
}

.date-filters {
    display: flex;
    gap: 1rem;
    align-items: end;
}

.income-filter {
    display: flex;
    align-items: end;
}

/* Tabelle pivot - STESSI STILI DELLA PAGINA PRINCIPALE */
.pivot-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.pivot-table thead {
    background: #2c3e50;
}

.pivot-table th,
.pivot-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
    position: relative;
}

.pivot-table th {
    font-weight: 500;
    color: white;
    background: #2c3e50;
    border-right: 1px solid white; /* Bordo bianco tra le colonne header */
    border-bottom: 1px solid white; /* Bordo bianco sotto gli header */
}

.pivot-table th:last-child {
    border-right: none; /* Rimuove il bordo dall'ultima colonna */
}

/* Sortable header styling - STESSO STILE DELLA PAGINA PRINCIPALE */
.pivot-table .sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
}

.pivot-table .sortable-header:hover {
    background: #34495e;
}

.pivot-table .sortable-header.sort-active-asc,
.pivot-table .sortable-header.sort-active-desc {
    background: #34495e;
}

.pivot-table .sort-arrows {
    float: right;
    margin-left: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pivot-table .sort-arrow {
    font-size: 0.7rem;
    color: #95a5a6;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.pivot-table .sort-arrow:hover {
    color: white;
}

.pivot-table .sortable-header.sort-active-asc .sort-arrow.up {
    color: #3498db;
    font-weight: bold;
}

.pivot-table .sortable-header.sort-active-desc .sort-arrow.down {
    color: #3498db;
    font-weight: bold;
}

.pivot-table .amount-cell {
    text-align: right;
}

/* NUOVO: Stile per le celle cliccabili */
.pivot-table .amount-cell.clickable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: #3498db;
}

.pivot-table .amount-cell.clickable:hover {
    background-color: #e3f2fd;
    font-weight: 600;
}


.pivot-table .total-cell {
    font-weight: 600;
    color: #2c3e50;
}

/* Righe di subtotale e totale generale */
.pivot-table .subtotal-row {
    background-color: #f8f9fa;
    border-top: 2px solid #dee2e6;
}

.pivot-table .grand-total-row {
    background-color: #e3f2fd;
    border-top: 3px solid #2196f3;
    font-weight: 600;
}

/* Account badges nelle tabelle pivot - STESSO STILE DELLA PAGINA PRINCIPALE */
.pivot-table .account-cell {
    vertical-align: middle;
}

.pivot-table .account-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    min-width: 70px;
    background-color: white;
    border: 2px solid;
}

.pivot-table .account-badge-marco {
    border-color: #3498db;
    color: #3498db;
}

.pivot-table .account-badge-cointestato {
    border-color: #27ae60;
    color: #27ae60;
}

/* Loading message */
.loading-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Responsive per pivot - STESSO COMPORTAMENTO DELLA PAGINA PRINCIPALE */
@media (max-width: 768px) {
    .pivot-filters {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .date-filters {
        flex-direction: column;
        gap: 0.5rem;
    }

    .pivot-table {
        font-size: 0.8rem;
        min-width: 600px;
    }

    .pivot-table th,
    .pivot-table td {
        padding: 0.5rem;
    }

    .pivot-table .account-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
        min-width: 60px;
    }

    /* Hide sort arrows on mobile - STESSO COMPORTAMENTO DELLA PAGINA PRINCIPALE */
    .pivot-table .sort-arrows {
        display: none;
    }

    /* Scroll orizzontale per tabelle su mobile */
    .table-container {
        overflow-x: auto;
    }
}
