/* ==================== 10/Yr Annualized Calculator Styles ==================== */

/* Summary Cards at Top of Results */
.calc-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.calc-summary-box {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.calc-summary-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.calc-summary-box-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.calc-summary-box-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #212529;
}

.calc-summary-box-value.positive {
    color: #28a745;
}

.calc-summary-box-value.negative {
    color: #dc3545;
}

/* Results Table Styling */
.calc-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.calc-results-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.calc-results-table thead th {
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    text-align: right;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #764ba2;
}

.calc-results-table thead th:first-child {
    text-align: center;
}

.calc-results-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.15s ease;
}

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

.calc-results-table tbody tr:hover {
    background-color: #e7f3ff;
}

.calc-results-table tbody tr:last-child {
    background-color: #e5feea;
    font-weight: 700;
    border-top: 2px solid #28a745;
}

.calc-results-table tbody tr:last-child:hover {
    background-color: #d4f7dc;
}

.calc-results-table tbody td {
    padding: 0.625rem 0.5rem;
    text-align: right;
    color: #495057;
}

.calc-results-table tbody td:first-child {
    text-align: center;
    font-weight: 600;
    color: #212529;
}

.calc-results-table tbody tr:last-child td {
    color: #155724;
}

/* Currency Formatting */
.calc-currency {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
}

/* Gains Column - Green Text */
.calc-gains-value {
    color: #28a745;
    font-weight: 600;
}

/* Year Column */
.calc-year-cell {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    display: inline-block;
    min-width: 60px;
}

/* Responsive Table */
@media (max-width: 992px) {
    .calc-results-table {
        font-size: 0.75rem;
    }

    .calc-results-table thead th,
    .calc-results-table tbody td {
        padding: 0.5rem 0.25rem;
    }

    .calc-summary-box-value {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .calc-summary-cards {
        grid-template-columns: 1fr;
    }

    .calc-results-table {
        font-size: 0.7rem;
    }

    .calc-results-table thead th,
    .calc-results-table tbody td {
        padding: 0.375rem 0.125rem;
    }
}

/* Table Container with Scroll */
.calc-table-container {
    max-height: 700px;
    overflow-y: auto;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

/* Custom Scrollbar for Table Container */
.calc-table-container::-webkit-scrollbar {
    width: 8px;
}

.calc-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.calc-table-container::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.calc-table-container::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* ==================== Expandable Year Rows ==================== */

/* Year Row - Clickable to expand */
.calc-year-row {
    transition: background-color 0.15s ease;
}

.calc-year-row:hover {
    background-color: #e7f3ff !important;
}

/* Expand/Collapse Icon */
.calc-expand-icon {
    width: 30px;
    text-align: center;
    color: #667eea;
    font-weight: bold;
}

.calc-expand-icon i {
    transition: transform 0.2s ease;
}

/* Month Detail Row */
.calc-month-detail-row {
    background: #f8f9fa;
}

.calc-month-detail-cell {
    padding: 0 !important;
    border: none !important;
}

.calc-month-detail-content {
    padding: 0;
    background: #f8f9fa;
}

/* Monthly Table Styles */
.calc-monthly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-radius: 0.25rem;
    overflow: hidden;
}

.calc-monthly-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.calc-monthly-table thead th {
    padding: 0.625rem 0.5rem;
    font-weight: 600;
    text-align: right;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: purple;
}

.calc-monthly-table thead th:first-child {
    text-align: center;
}

.calc-monthly-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.15s ease;
}

.calc-monthly-table tbody tr:nth-child(even):not(.calc-year-end-row) {
    background-color: #f8f9fa;
}

.calc-monthly-table tbody tr:hover:not(.calc-year-end-row) {
    background-color: #e7f3ff;
}

.calc-monthly-table tbody td {
    padding: 0.5rem 0.5rem;
    text-align: right;
    color: #495057;
}

.calc-monthly-table tbody td:first-child {
    text-align: center;
    font-weight: 600;
    color: #212529;
}

/* Month Cell Badge */
.calc-month-cell {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    font-weight: 600;
    border-radius: 0.25rem;
    padding: 0.2rem 0.5rem;
    display: inline-block;
    font-size: 0.75rem;
}

/* Contribution Value */
.calc-contribution-value {
    color: #17a2b8;
    font-weight: 600;
}

/* Start Balance Value - Green Text */
.calc-monthly-table tbody td.calc-start-balance-value {
    color: #28a745 !important;
    font-weight: 600;
}

/* Payment Value - Red Text */
.calc-monthly-table tbody td.calc-payment-value {
    color: #dc3545 !important;
    font-weight: 600;
}

/* Month-End Balance Value - Blue Text */
.calc-monthly-table tbody td.calc-end-balance-value {
    color: #007bff !important;
    font-weight: 600;
}

/* Year-End Row Highlight */
.calc-year-end-row {
    background: #28a745;
    font-weight: 700;
    border-top: 2px solid #1e7e34;
}

.calc-year-end-row td {
    color: #ffffff;
    padding: 0.75rem 0.5rem;
}

.calc-year-end-row:hover {
    background: #218838;
}

/* Responsive */
@media (max-width: 992px) {
    .calc-monthly-table {
        font-size: 0.7rem;
    }

    .calc-monthly-table thead th,
    .calc-monthly-table tbody td {
        padding: 0.4rem 0.25rem;
    }
}

@media (max-width: 576px) {
    .calc-monthly-table {
        font-size: 0.65rem;
    }

    .calc-monthly-table thead th,
    .calc-monthly-table tbody td {
        padding: 0.3rem 0.15rem;
    }

    .calc-month-cell {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
    }
}

/* ==================== flatpickr Month Picker Customization ==================== */

/* Ensure the hidden input maintains the correct value format */
#paymentStartDate {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Style the alternate (visible) input */
.flatpickr-input.form-control {
    background-color: white;
    cursor: pointer;
    min-width: 180px;  /* Accommodate "December 2026" and similar long month names */
    flex: 1;
}

/* Calendar dropdown positioning */
.flatpickr-calendar {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Month select grid styling */
.flatpickr-monthSelect-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 1rem;
    min-width: 87px !important;
}

/* Individual month buttons */
.flatpickr-monthSelect-month {
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 88px !important;
}

.flatpickr-monthSelect-month:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.flatpickr-monthSelect-month.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.flatpickr-monthSelect-month:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.flatpickr-monthSelect-month:focus:not(.selected) {
    background: white;
    color: #495057;
    border-color: #667eea;
}

/* Year navigation in header */
.flatpickr-months {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0.75rem;
}

.flatpickr-current-month {
    color: #7FFFD4 !important;  /* Aquamarine */
    font-weight: 700 !important;
}

.flatpickr-prev-month,
.flatpickr-next-month {
    color: white;
    fill: white;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .flatpickr-monthSelect-months {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.25rem;
        padding: 0.5rem;
    }

    .flatpickr-monthSelect-month {
        padding: 0.5rem;
        font-size: 0.875rem;
        min-width: 187px !important;
    }
}
