/**
 * RRBB Calculators Stylesheet
 * Consolidated styles for all calculator custom post types
 *
 * Uses CSS variables defined in theme:
 * --rrbb-primary, --rrbb-secondary, --rrbb-accent
 */

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Chip/Toggle Button Styles
   Unified styles for category toggle chips across all calculators
   ========================================================================== */
   
/* Category Chip Styles */
.rrbb-calc-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 2px solid var(--rrbb-secondary);
    background: white;
    color: var(--rrbb-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    user-select: none;
}

.rrbb-calc-chip:hover {
    border-color: var(--rrbb-accent);
    color: var(--rrbb-accent);
}

.rrbb-calc-chip.active{
    background: var(--rrbb-accent);
    border-color: var(--rrbb-accent);
    color: white;
}

.rrbb-calc-chip i {
    margin-right: 0.5rem;
    font-size: 0.75rem;
}

.rrbb-calc-chip.active i::before {
    content: "\f00c";
}

.rrbb-calc-group {
    display: none;
    animation: fadeIn 0.3s ease;
}

.rrbb-calc-group.active {
    display: block;
}

.no-categories-message {
    text-align: center;
    padding: 2rem;
    color: var(--rrbb-secondary);
    opacity: 0.7;
}

/* Summary Table Styles */

.rrbb-calc-table {
    font-size: 0.875rem;
    width: 100%;
    border-collapse: collapse;
}

.rrbb-calc-table th {
    background-color: var(--rrbb-secondary);
    color: white;
    font-weight: 600;
}

.rrbb-calc-table td {
    background-color: white;
}

.rrbb-calc-table th,
.rrbb-calc-table td {
    padding: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.rrbb-calc-table .total-row {
    font-weight: 700;
    background-color: #e9ecef;
}

.rrbb-calc-table .positive {
    color: #28a745;
}

.rrbb-calc-table .negative {
    color: #dc3545;
}

.rrbb-calc-table .section-header {
    font-weight: 700;
    background-color: #e9ecef;
}

.positive-cashflow {
    color: #28a745;
}

.negative-cashflow {
    color: #dc3545;
}

/* Chart container */
#chart-container {
    min-height: 350px;
}

/* Input Styles */

.rrbb-calc-table input[type="text"],
.rrbb-calc-table input[type="number"] {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    width: 100%;
    font-size: 0.875rem;
}

.rrbb-calc-table input[type="text"]:focus,
.rrbb-calc-table input[type="number"]:focus {
    border-color: var(--rrbb-accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--rrbb-accent-rgb), 0.25);
}

.rrbb-calc-table .description-col {
    width: 60%;
}

.rrbb-calc-table .amount-col {
    width: 35%;
}

.rrbb-calc-table .action-col {
    width: 50px;
    text-align: center;
}

.btn-remove-row {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-remove-row:hover {
    opacity: 1;
}

.btn-add-expense {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 2px dashed var(--rrbb-secondary);
    border-radius: 8px;
    color: var(--rrbb-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-expense:hover {
    border-color: var(--rrbb-accent);
    color: var(--rrbb-accent);
}

/* Summary Table Styles */

.summary-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.summary-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.summary-item-header {
    font-weight: 600;
    color: var(--rrbb-secondary);
    margin-bottom: 0.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.875rem;
}

.summary-row .label {
    color: var(--rrbb-secondary);
}

.summary-row .value {
    font-weight: 500;
}

.summary-totals {
    background-color: var(--rrbb-secondary);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.summary-totals .summary-row .label,
.summary-totals .summary-row .value {
    color: white;
}

.summary-totals .summary-row .value {
    font-weight: 600;
}

.summary-table .total-row {
    font-weight: 700;
    background-color: #f8f9fa;
}

/* Year Select Styles */
.year-select {
    max-width: 150px;
}

/* Results highlight */

.result-highlight {
    font-size: 1.25rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--rrbb-secondary) 0%, #2a5a7a 100%);
    color: white;
    border-radius: 10px;
    text-align: center;
}

.result-highlight .amount {
    font-size: 2rem;
    font-weight: 700;
    display: block;
    margin: 0.5rem 0;
}

.result-highlight .recommendation {
    font-size: 1.125rem;
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.result-highlight .duration {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Itemize toggle */

.itemize-section {
    display: none;
}

.itemize-section.active {
    display: block;
}

/* Detailed table */

.detailed-table {
    font-size: 0.8rem;
}

.detailed-table th {
    background-color: var(--rrbb-secondary);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.detailed-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.table-scroll {
    max-height: 400px;
    overflow-y: auto;
}

/* Net Worth Highlight */

.net-worth-highlight {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.net-worth-highlight .label {
    font-size: 1rem;
    color: var(--rrbb-secondary);
    margin-bottom: 0.5rem;
}

.net-worth-highlight .value {
    font-size: 2.5rem;
    font-weight: 700;
}

.net-worth-highlight .value.positive {
    color: var(--rrbb-accent);
}

.net-worth-highlight .value.negative {
    color: #dc3545;
}

/* Summary Table Enhancements */
#summary-table .category-header {
    background: var(--rrbb-primary);
    color: white;
}

#summary-table .item-row td:first-child {
    padding-left: 1.5rem;
}

#summary-table .subtotal-row {
    background: #f8f9fa;
}

#summary-table .total-row {
    background: #e9ecef;
    font-weight: 600;
}

#summary-table .net-worth-row {
    background: var(--rrbb-accent);
    color: white;
    font-weight: 700;
}

#summary-table .net-worth-row.negative {
    background: #dc3545;
}

/* Net Worth Highlight */

.net-worth-highlight {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.net-worth-highlight .label {
    font-size: 1rem;
    color: var(--rrbb-secondary);
    margin-bottom: 0.5rem;
}

.net-worth-highlight .value {
    font-size: 2.5rem;
    font-weight: 700;
}

.net-worth-highlight .value.positive {
    color: var(--rrbb-accent);
}

.net-worth-highlight .value.negative {
    color: #dc3545;
}

.net-worth-highlight .sub-label {
    font-size: 0.875rem;
    color: var(--rrbb-secondary);
    margin-top: 0.25rem;
}

/* Summary Table Enhancements */

#projected-summary-table .category-header {
    background: var(--rrbb-primary);
    color: white;
}

#projected-summary-table .item-row td:first-child {
    padding-left: 1.5rem;
}

#projected-summary-table .subtotal-row {
    background: #f8f9fa;
    font-weight: 600;
}

#projected-summary-table .total-row {
    background: #e9ecef;
    font-weight: 600;
}

#projected-summary-table .net-worth-row {
    background: var(--rrbb-accent);
    color: white;
    font-weight: 700;
}

#projected-summary-table .net-worth-row.negative {
    background: #dc3545;
}

#projected-summary-table th {
    background: var(--rrbb-primary);
    color: white;
    text-align: center;
    font-weight: 600;
}

#projected-summary-table td {
    text-align: right;
}

#projected-summary-table td:first-child {
    text-align: left;
}

/* Cash Flow Highlight */

.cashflow-highlight {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.cashflow-highlight .label {
    font-size: 1rem;
    color: var(--rrbb-secondary);
    margin-bottom: 0.5rem;
}

.cashflow-highlight .value {
    font-size: 2rem;
    font-weight: 700;
}

.cashflow-highlight .value.positive {
    color: var(--rrbb-accent);
}

.cashflow-highlight .value.negative {
    color: #dc3545;
}

.cashflow-highlight .sub-label {
    font-size: 0.875rem;
    color: var(--rrbb-secondary);
    margin-top: 0.25rem;
}

/* Summary Table Enhancements */

#cashflow12-summary-table .category-header {
    background: var(--rrbb-primary);
    color: white;
}

#cashflow12-summary-table .item-row td:first-child {
    padding-left: 1.5rem;
}

#cashflow12-summary-table .subtotal-row {
    background: #f8f9fa;
    font-weight: 600;
}

#cashflow12-summary-table .total-row {
    background: #e9ecef;
    font-weight: 600;
}

#cashflow12-summary-table .net-row {
    font-weight: 700;
}

#cashflow12-summary-table .net-row.surplus {
    background: var(--rrbb-accent);
    color: white;
}

#cashflow12-summary-table .net-row.deficit {
    background: #dc3545;
    color: white;
}