/**
 * India Financial Calculators - Clean, High-Conversion, Attractive UI
 * Primary Theme Color: #1F4941
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700;800&display=swap');

:root {
    --fci-primary: #1F4941;
    --fci-dark: #111827;
    --fci-dark-subtle: #1f2937;
    --fci-accent-amber: #D97706;
    --fci-radius: 16px;
    --fci-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --fci-font-mono: 'JetBrains Mono', monospace;
    --fci-bg-card: #FFFFFF;
    --fci-text-main: #111827;
    --fci-text-muted: #4B5563;
    --fci-border: #E5E7EB;
    --fci-border-light: #F3F4F6;
    --fci-track: #F3F4F6;
    --fci-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.06), 0 2px 8px -2px rgba(0, 0, 0, 0.03);
    --fci-shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Reset & Scope */
.fci-calc-wrapper,
.fci-combined-container,
.fci-calc-wrapper *,
.fci-combined-container * {
    box-sizing: border-box;
    font-family: var(--fci-font);
    -webkit-font-smoothing: antialiased;
}

/* Master Wrapper */
.fci-calc-wrapper {
    background: var(--fci-bg-card);
    border: 1px solid var(--fci-border);
    border-radius: var(--fci-radius);
    padding: clamp(16px, 3vw, 28px);
    margin: 16px auto;
    width: 100%;
    max-width: 1000px;
    box-shadow: var(--fci-shadow);
    color: var(--fci-text-main);
    transition: all 0.25s ease;
    container-type: inline-size;
}

/* Dark Theme */
.fci-calc-wrapper.fci-theme-dark,
.fci-combined-container.fci-theme-dark .fci-calc-wrapper {
    --fci-bg-card: #111827;
    --fci-text-main: #F9FAFB;
    --fci-text-muted: #9CA3AF;
    --fci-border: #374151;
    --fci-track: #1F2937;
    --fci-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.6);
    background: #111827;
    color: #F9FAFB;
}

/* Header Section */
.fci-calc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--fci-border);
}

.fci-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 240px;
}

.fci-icon-bubble {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #F3F4F6;
    border: 1px solid var(--fci-border);
    color: var(--fci-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fci-theme-dark .fci-icon-bubble {
    background: #1F2937;
    border-color: #374151;
    color: #F9FAFB;
}

/* User Defined: Title 24px */
h2.fci-title {
    font-size: 24px !important;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--fci-text-main);
    line-height: 1.25;
    margin: 0;
}

.fci-subtitle {
    margin: 3px 0 0;
    font-size: 0.82rem;
    color: var(--fci-text-muted);
    line-height: 1.35;
}

/* User Defined: Mode Tab (SIP / Lumpsum) */
button.fci-mode-tab {
    background: #f7f7f7 !important;
    color: #000000 !important;
    border: 1px solid var(--fci-border);
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

button.fci-mode-tab:hover,
button.fci-mode-tab.active {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

/* User Defined: Chips (Home Loan, Car Loan, etc.) */
button.fci-chip {
    background: #f7f7f7 !important;
    color: #000000 !important;
    border: 1px solid var(--fci-border);
    padding: 7px 13px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

button.fci-chip.active,
button.fci-chip:hover {
    background: #1f4941 !important;
    color: #ffffff !important;
    border-color: #1f4941 !important;
    box-shadow: 0 2px 6px rgba(31, 73, 65, 0.25);
}

.fci-type-chips,
.fci-mode-switch {
    display: flex;
    flex-wrap: wrap;
    background: #F3F4F6;
    border: 1px solid var(--fci-border);
    padding: 3px;
    border-radius: 10px;
    gap: 4px;
    max-width: 100%;
}

.fci-theme-dark .fci-type-chips,
.fci-theme-dark .fci-mode-switch {
    background: #1F2937;
    border-color: #374151;
}

/* User Defined: Quick Pills */
button.fci-pill {
    background: #cdcdcd !important;
    color: #000000 !important;
    border: 1px solid #bfbfbf;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

button.fci-pill:hover {
    background: #1f4941 !important;
    color: #ffffff !important;
    border-color: #1f4941 !important;
}

/* User Defined: Schedule Toggle Button */
button.fci-schedule-toggle {
    background: #000000 !important;
    color: #ffffff !important;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

button.fci-schedule-toggle:hover {
    background: #1f4941 !important;
}

button.fci-schedule-toggle svg {
    stroke: #ffffff;
}

/* User Defined: Combined Main Tab Buttons */
button.fci-main-tab-btn {
    background: #ffffff !important;
    flex: 1 1 220px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1.5px solid var(--fci-border);
    border-radius: 12px;
    padding: 14px 18px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

button.fci-main-tab-btn .fci-tab-icon {
    font-size: 1.7rem;
}

button.fci-main-tab-btn .fci-tab-text strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    color: #000000;
}

button.fci-main-tab-btn .fci-tab-text small {
    display: block;
    font-size: 0.78rem;
    color: #6B7280;
}

button.fci-main-tab-btn.active {
    border-color: #1f4941 !important;
    box-shadow: 0 4px 14px rgba(31, 73, 65, 0.12);
}

button.fci-main-tab-btn.active .fci-tab-text strong {
    color: #1f4941;
}

/* Main Grid */
.fci-calc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: clamp(16px, 2.5vw, 28px);
    align-items: stretch;
}

/* Left Controls Column */
.fci-controls-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fci-control-group {
    background: #FAFAFA;
    border: 1px solid var(--fci-border);
    border-radius: 12px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

.fci-theme-dark .fci-control-group {
    background: #182234;
}

.fci-control-group:hover,
.fci-control-group:focus-within {
    border-color: #1f4941;
    background: #FFFFFF;
}

.fci-control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.fci-control-header label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--fci-text-main);
}

.fci-input-with-symbol {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 2px 8px;
    transition: all 0.2s;
}

.fci-input-with-symbol:focus-within {
    border-color: #1f4941;
    box-shadow: 0 0 0 2px rgba(31, 73, 65, 0.15);
}

.fci-symbol,
.fci-symbol-right,
.fci-tenure-unit-label {
    font-weight: 800;
    color: #1f4941;
    font-size: 0.92rem;
}

.fci-num-input {
    border: none;
    background: transparent;
    font-size: 1.05rem;
    font-weight: 800;
    font-family: var(--fci-font-mono);
    color: var(--fci-text-main);
    padding: 4px 6px;
    width: 120px;
    max-width: 100%;
    text-align: right;
    outline: none;
}

.fci-num-input::-webkit-outer-spin-button,
.fci-num-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Range Slider */
.fci-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 4px;
    background: linear-gradient(to right, #1f4941 0%, #1f4941 50%, #E5E7EB 50%, #E5E7EB 100%);
    outline: none;
    margin: 10px 0 8px;
    cursor: pointer;
}

.fci-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 3.5px solid #1f4941;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.12s ease;
}

.fci-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.fci-range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 3.5px solid #1f4941;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

.fci-slider-limits {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.74rem;
    color: var(--fci-text-muted);
    font-weight: 600;
}

.fci-quick-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Tenure Unit Switch */
.fci-tenure-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fci-unit-switch {
    display: inline-flex;
    background: #F3F4F6;
    border: 1px solid var(--fci-border);
    padding: 2px;
    border-radius: 6px;
}

.fci-switch-btn {
    border: none;
    background: transparent;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--fci-text-muted);
    border-radius: 5px;
    cursor: pointer;
}

.fci-switch-btn.active {
    background: #1f4941;
    color: #FFFFFF !important;
}

/* Step-Up Box */
.fci-stepup-box {
    background: #F9FAFB;
    border: 1px dashed #D1D5DB;
    border-radius: 10px;
    padding: 12px 14px;
}

.fci-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--fci-text-main);
}

.fci-stepup-controls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #E5E7EB;
}

/* Right Results Card */
.fci-results-col {
    display: flex;
}

.fci-results-card {
    background: #FFFFFF;
    border: 1px solid var(--fci-border);
    border-radius: var(--fci-radius);
    padding: clamp(16px, 2.2vw, 22px);
    box-shadow: var(--fci-shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    gap: 14px;
}

.fci-theme-dark .fci-results-card {
    background: #182234;
    border-color: #374151;
}

/* Monthly EMI Box */
.fci-monthly-box {
    text-align: center;
    background: #F9FAFB;
    border: 1px solid var(--fci-border);
    border-radius: 12px;
    padding: 14px 12px;
}

.fci-theme-dark .fci-monthly-box {
    background: #111827;
    border-color: #374151;
}

.fci-monthly-label {
    display: block;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
    color: var(--fci-text-muted);
}

.fci-monthly-amount {
    font-size: clamp(1.6rem, 2.6vw, 2.1rem);
    font-weight: 800;
    font-family: var(--fci-font-mono);
    color: #1f4941;
    margin: 4px 0 2px;
    line-height: 1.15;
    word-break: break-word;
}

.fci-val-currency {
    font-size: 1.25rem;
    font-weight: 800;
    margin-right: 2px;
}

.fci-val-period {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--fci-text-muted);
}

.fci-wealth-badge {
    display: inline-block;
    background: #F3F4F6;
    color: #1f4941;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 0.76rem;
    font-weight: 800;
    margin-top: 4px;
    border: 1px solid #E5E7EB;
}

/* Donut Chart Visual */
.fci-chart-box {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    margin: 2px 0;
}

.fci-canvas-holder {
    width: 125px;
    height: 125px;
    max-width: 100%;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fci-canvas-holder canvas {
    max-width: 100% !important;
    max-height: 100% !important;
}

.fci-chart-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 130px;
}

.fci-legend-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.fci-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 3px;
    flex-shrink: 0;
}

.fci-legend-principal .fci-dot,
.fci-legend-invested .fci-dot {
    background: #1f4941;
}

.fci-legend-interest .fci-dot,
.fci-legend-returns .fci-dot {
    background: #D97706;
}

.fci-legend-name {
    display: block;
    font-size: 0.74rem;
    color: var(--fci-text-muted);
    font-weight: 700;
}

.fci-legend-val {
    display: block;
    font-size: 0.94rem;
    font-weight: 800;
    font-family: var(--fci-font-mono);
    color: var(--fci-text-main);
}

/* Total Repayment Row */
.fci-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    background: #F9FAFB;
    border: 1px solid var(--fci-border);
    border-radius: 10px;
    padding: 10px 14px;
}

.fci-total-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--fci-text-main);
}

.fci-total-val {
    font-size: 1.05rem;
    font-weight: 800;
    font-family: var(--fci-font-mono);
    color: #1f4941;
}

/* MF Growth Highlight */
.fci-growth-highlight {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F9FAFB;
    border: 1px solid var(--fci-border);
    border-radius: 10px;
    padding: 10px 14px;
}

.fci-highlight-item {
    text-align: center;
}

.fci-hl-lbl {
    display: block;
    font-size: 0.72rem;
    color: var(--fci-text-muted);
    font-weight: 700;
}

.fci-hl-val {
    font-size: 0.94rem;
    font-weight: 800;
    font-family: var(--fci-font-mono);
    color: #1f4941;
}

.fci-highlight-arrow {
    color: var(--fci-text-muted);
    font-weight: 800;
}

/* CTA Action Button - #1F4941 */
.fci-btn-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #1f4941 !important;
    color: #FFFFFF !important;
    text-decoration: none !important;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(31, 73, 65, 0.25);
    transition: all 0.2s ease;
    text-align: center;
    border: none;
    cursor: pointer;
}

.fci-btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(31, 73, 65, 0.35);
    filter: brightness(1.08);
}

/* Amortization & Growth Tables */
.fci-schedule-wrapper {
    margin-top: 20px;
    border-top: 1px solid var(--fci-border);
    padding-top: 14px;
}

.fci-chevron {
    transition: transform 0.25s ease;
}

.fci-schedule-toggle.open .fci-chevron {
    transform: rotate(180deg);
}

.fci-schedule-content {
    margin-top: 12px;
}

.fci-table-responsive {
    overflow-x: auto;
    max-height: 380px;
    border: 1px solid var(--fci-border);
    border-radius: 10px;
    background: #FFFFFF;
}

.fci-theme-dark .fci-table-responsive {
    background: #111827;
}

.fci-schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: right;
    min-width: 500px;
}

.fci-schedule-table th,
.fci-schedule-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--fci-border);
}

.fci-schedule-table th {
    background: #F9FAFB;
    font-weight: 800;
    color: #1f4941;
    position: sticky;
    top: 0;
    z-index: 2;
}

.fci-schedule-table th:first-child,
.fci-schedule-table td:first-child {
    text-align: left;
    font-weight: 800;
}

.fci-schedule-table tbody tr:hover {
    background: #F3F4F6;
}

/* Disclaimer */
.fci-disclaimer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--fci-border);
    font-size: 0.75rem;
    color: var(--fci-text-muted);
    line-height: 1.45;
}

.fci-disclaimer p {
    margin: 0;
}

/* Combined Dual Tab Nav */
.fci-combined-container {
    max-width: 1000px;
    margin: 16px auto;
}

.fci-main-tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

/* Container & Responsive Rules */
@container (max-width: 760px) {
    .fci-calc-grid {
        grid-template-columns: 1fr !important;
        gap: 18px !important;
    }
}

@media (max-width: 820px) {
    .fci-calc-wrapper {
        padding: 16px;
    }

    .fci-calc-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .fci-main-tab-nav {
        flex-direction: column;
    }

    .fci-type-chips,
    .fci-mode-switch {
        width: 100%;
        justify-content: flex-start;
    }

    .fci-monthly-amount {
        font-size: 1.65rem;
    }
}

@media (max-width: 480px) {
    .fci-calc-wrapper {
        padding: 12px;
    }

    .fci-control-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .fci-input-with-symbol {
        width: 100%;
        justify-content: space-between;
    }

    .fci-num-input {
        width: 100%;
    }

    button.fci-chip,
    button.fci-mode-tab {
        flex: 1 1 calc(50% - 3px);
        text-align: center;
    }
}
