/* Financial Calculators Plugin Styles - Enhanced Comprehensive Version */

/* Import Google Fonts for better typography */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,600;0,700;1,400&family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap');

/* Base font family for all calculator elements */
.financial-calc-grid,
.financial-calc-grid *,
.calc-modal,
.calc-modal *,
.calculator,
.calculator * {
    font-family: 'Open Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
}

.financial-calc-grid {
    max-width: 1200px;
    margin: 20px auto;
    padding: 15px;
}

.financial-calc-grid h3 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    font-family: 'Roboto', 'Open Sans', sans-serif !important;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

/* Calculator card: white background for clean UI */
.calc-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 6px 18px rgba(20,30,50,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: visible;
    text-align: center;
    color: #1f2933;
}

.calc-card h4 {
    color: #1f2933;
    margin: 12px 0 8px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Roboto', 'Open Sans', sans-serif !important;
}

.calc-card p {
    color: #6c757d;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 12px;
    font-family: 'Open Sans', 'Roboto', sans-serif !important;
}

.calc-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: inherit;
    box-shadow: 0 4px 12px rgba(15,23,42,0.06);
}

.icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
}

/* Remove any decorative pseudo-element some themes may inject */
.icon-circle:before,
.icon-circle::before {
    content: none !important;
    display: none !important;
}

.calc-icon img.custom-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Stylized gradient action buttons driven by theme variables */
.financial-calc-btn,
.calc-card .financial-calc-btn,
.financial-calc-single .financial-calc-btn {
    background: linear-gradient(135deg, var(--fc-primary-color, #2c5aa0), var(--fc-secondary-color, #1e3a6f));
    color: #ffffff;
    font-weight: 700;
    padding: 10px 16px;
    margin-top: 8px;
    border-radius: 10px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    border: none;
    box-shadow: 0 6px 18px rgba(44,90,160,0.12);
    font-family: 'Roboto', 'Open Sans', sans-serif !important;
}

.financial-calc-btn:hover,
.calc-card .financial-calc-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(44,90,160,0.14);
    opacity: 0.98;
}

/* removed decorative accent bar to simplify card visuals */

.calc-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 34px rgba(20,30,50,0.08);
}

/* Smooth transitions for icon container background and color */
.calc-icon {
    transition: background-color .18s ease, color .18s ease, transform .12s ease;
}
.calc-icon:hover { transform: translateY(-3px); }

.calc-icon img.custom-icon { max-width: 48px; max-height: 48px; }

.financial-calc-single {
    text-align: center;
    margin: 15px 0;
}

.financial-calc-single .financial-calc-btn {
    width: auto;
    min-width: 180px;
    padding: 10px 20px;
    font-size: 14px;
}

/* Modal overlay and centered content */
.calc-modal {
    display: none;
    position: fixed;
    z-index: 99999; /* sit above top header/navigation */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.22s ease;
}

.calc-modal-content {
    background-color: #ffffff;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 12px;
    width: 94%;
    max-width: 1000px;
    max-height: 88vh;
    overflow-y: auto;
    z-index: 100000; /* ensure content sits above overlay and page header */
    animation: slideIn 0.26s cubic-bezier(.2,.9,.3,1);
    box-shadow: 0 18px 50px rgba(10,20,40,0.28);
}

.calc-modal-close {
    color: #55606a;
    font-size: 22px;
    font-weight: 700;
    position: absolute;
    right: 14px;
    top: 12px;
    z-index: 100001;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease;
}

.calc-modal-close:hover {
    background: #f1f5f9;
    color: #111827;
}

/* Enhanced Calculator Styles */
.calculator {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.calculator h3 {
    grid-column: 1 / -1;
    color: #2c5aa0;
    margin-bottom: 15px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    font-family: 'Roboto', 'Open Sans', sans-serif !important;
}

.calc-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold !important;
    color: #495057;
    font-size: 11px !important;
    line-height: 1.1 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Roboto', 'Open Sans', sans-serif !important;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: #fff;
    font-family: 'Open Sans', 'Roboto', sans-serif !important;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

.calc-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
    font-family: 'Roboto', 'Open Sans', sans-serif !important;
}

.calc-btn:hover {
    background: linear-gradient(135deg, #20c997, #28a745);
    transform: translateY(-1px);
}

/* Enhanced Results with Charts */
.calc-results {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    display: none;
    min-height: 300px;
}

.calc-results.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.calc-results h4 {
    color: #2c5aa0;
    margin-bottom: 15px;
    font-size: 16px;
    text-align: center;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.result-card {
    background: linear-gradient(135deg, #2c5aa0, #1e3a6f);
    color: white;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

.result-card .label {
    font-size: 10px;
    text-transform: uppercase;
    line-height: 1.1 !important;
    letter-spacing: 0.5px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.result-card .value {
    font-size: 16px;
    font-weight: 700;
}

.chart-container {
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    position: relative;
    min-height: 200px;
}

.chart-title {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Progress Bars */
.progress-bar {
    background: #e9ecef;
    border-radius: 10px;
    height: 8px;
    margin: 8px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 10px;
    transition: width 1s ease;
    position: relative;
}

.progress-label {
    font-size: 11px;
    color: #6c757d;
    margin-bottom: 3px;
    display: flex;
    justify-content: space-between;
}

/* Pie Chart Styles */
.pie-chart {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 10px auto;
    position: relative;
    background: conic-gradient(
        #2c5aa0 0deg 0deg,
        #28a745 0deg 0deg,
        #ffc107 0deg 0deg,
        #dc3545 0deg 360deg
    );
}

.pie-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 11px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 6px;
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: end;
    height: 100px;
    gap: 8px;
    margin: 10px 0;
}

.bar {
    flex: 1;
    background: linear-gradient(to top, #2c5aa0, #4a90e2);
    border-radius: 3px 3px 0 0;
    min-height: 10px;
    position: relative;
    transition: height 1s ease;
}

.bar-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #6c757d;
    text-align: center;
    width: 100%;
}

/* Gauge Chart */
.gauge-chart {
    width: 150px;
    height: 75px;
    margin: 15px auto;
    position: relative;
}

.gauge-bg {
    width: 100%;
    height: 100%;
    border: 8px solid #e9ecef;
    border-bottom: none;
    border-radius: 150px 150px 0 0;
    position: relative;
}

.gauge-fill {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 100%;
    height: 100%;
    border: 8px solid #28a745;
    border-bottom: none;
    border-radius: 150px 150px 0 0;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
    transition: clip-path 1s ease;
}

.gauge-value {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 600;
    color: #2c5aa0;
}

/* Timeline */
.timeline {
    position: relative;
    margin: 15px 0;
}

.timeline-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 12px;
}

.timeline-year {
    width: 60px;
    font-weight: 600;
    color: #2c5aa0;
}

.timeline-bar {
    flex: 1;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    margin: 0 10px;
    position: relative;
}

.timeline-progress {
    height: 100%;
    background: linear-gradient(90deg, #2c5aa0, #28a745);
    border-radius: 3px;
    transition: width 1s ease;
}

.timeline-value {
    width: 80px;
    text-align: right;
    font-weight: 600;
    color: #495057;
}

/* Enhanced Result Details */
.result-recommendations {
    background: #e8f4fd;
    border-left: 4px solid #2c5aa0;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 6px 6px 0;
}

.result-recommendations h5 {
    color: #2c5aa0;
    margin-bottom: 10px;
    font-size: 14px;
}

.result-recommendations ul {
    margin: 0;
    padding-left: 20px;
}

.result-recommendations li {
    margin-bottom: 5px;
    font-size: 12px;
    line-height: 1.4;
}

.tax-details, .rmd-details, .ss-details, .debt-analysis, .investment-scenarios, .withdrawal-analysis, .budget-recommendations {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #dee2e6;
}

.tax-details h5, .rmd-details h5, .ss-details h5, .debt-analysis h5, .investment-scenarios h5, .withdrawal-analysis h5, .budget-recommendations h5 {
    color: #495057;
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 600;
}

.tax-line, .debt-metric, .scenario-item, .success-item {
    font-size: 12px;
    margin: 4px 0;
    color: #6c757d;
}

.budget-ratios {
    display: grid;
    gap: 8px;
}

.ratio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #dee2e6;
}

.rule-comparison {
    font-size: 11px;
    color: #6c757d;
}

.rule-comparison div {
    margin: 4px 0;
    padding: 4px 0;
    border-bottom: 1px dotted #dee2e6;
}

.payment-schedule {
    margin: 15px 0;
    font-size: 11px;
}

.schedule-header, .schedule-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #dee2e6;
}

.schedule-header {
    font-weight: 600;
    background: #f8f9fa;
    padding: 8px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .calc-modal-content {
        width: 98%;
        margin: 1% auto;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .result-summary {
        grid-template-columns: 1fr 1fr;
    }
    
    .pie-legend {
        grid-template-columns: 1fr;
    }
    
    .schedule-header, .schedule-row {
        grid-template-columns: 1fr 1fr 1fr;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }
    
    .calculator {
        padding: 15px;
    }
    
    .result-summary {
        grid-template-columns: 1fr;
    }
    
    .ratio-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Responsive icon sizing */
    .calc-icon {
        transform: scale(0.85);
        margin: 0 auto 8px;
    }
    
    /* Size-specific responsive adjustments */
    .calc-icon-size-48, .calc-icon-size-56, .calc-icon-size-64 {
        transform: scale(0.75);
    }
    .calc-icon-size-72, .calc-icon-size-80, .calc-icon-size-96 {
        transform: scale(0.65);
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-radius: 50%;
    border-top-color: #2c5aa0;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Enhanced Visual Elements */
.highlight-box {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
    font-size: 12px;
    color: #856404;
}

.warning-box {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border: 1px solid #dc3545;
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
    font-size: 12px;
    color: #721c24;
}

.success-box {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 1px solid #28a745;
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
    font-size: 12px;
    color: #155724;
}

/* Calculator Disclaimer Styling */
.calc-disclaimer {
    margin-top: 15px !important;
    padding: 8px 12px;
    font-size: 11px !important;
    color: #6c757d !important;
    text-align: center !important;
    background: transparent;
    border: none;
    border-radius: 4px;
    line-height: 1.2 !important;
    font-style: italic;
    font-family: 'Open Sans', sans-serif !important;
}

.calc-disclaimer em {
    font-style: italic;
    color: inherit;
    font-family: 'Open Sans', sans-serif !important;
    font-size: 11px !important;
}

/* Small button variant used in compact lists (debt rows etc.) */
.small-button,
.debts-list .remove-debt,
.debts-list .add-debt {
    font-size: 12px !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    background: #f1f5f9 !important;
    color: #111827 !important;
    border: 1px solid #d1d5db !important;
    min-width: 60px;
    height: auto;
    line-height: 1.2;
    cursor: pointer;
}

.debts-list .remove-debt.small-button {
    background: transparent !important;
    color: #6c757d !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
}

.debts-headers {
    margin-bottom: 6px;
}