/* =========================================================
   EMI CALCULATOR STYLES
   - Centralized for use across all pages
========================================================= */

.calculator {
    padding: 4rem 1rem;
    background-color: #f8f9fa;
    /* var(--secondary-color) backup */
    color: #0f172a;
    opacity: 1;
}

.calculator-container {
    max-width: 1200px;
    margin: auto;
    background: #fff;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
}

.calculator .section-title {
    text-align: center;
    margin-bottom: 3rem;
    color: #0c2f6a;
    font-size: 2.5rem;
    font-weight: 700;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 3rem;
    align-items: start;
}

/* -------- Inputs -------- */
.slider-group {
    margin-bottom: 2.5rem;
}

/* Labels */
.calculator .slider-label span,
.calculator .min-max span {
    color: #212f42;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 18px;
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
    gap: 10px;
}

/* Tenure Toggle */
.tenure-toggle {
    display: inline-flex;
    background: #e2e8f0;
    border-radius: 20px;
    padding: 2px;
    margin-left: 10px;
    vertical-align: middle;
}

.toggle-option {
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 15px;
    color: #64748b;
    transition: all 0.3s;
    user-select: none;
}

.toggle-option.active {
    background: #a9e604;
    color: #34103e;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.inline-input {
    display: flex;
    align-items: center;
    background: #f4f7fc;
    border: 1px solid #dbe2ef;
    border-radius: 6px;
    padding: 5px 8px;
}

.inline-input input {
    width: 90px;
    border: none;
    outline: none;
    background: transparent;
    text-align: right;
    font-weight: 600;
    font-size: 15px;
}

input[type=range] {
    width: 100%;
    height: 7px;
    border-radius: 4px;
    background: #a6eb05e0;
    appearance: none;
    margin-top: 10px;
    cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #196cd9;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.min-max {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #6b7280;
    margin-top: 6px;
}

/* -------- EMI Visuals -------- */
.emi-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    /* box-shadow: 0 4px 20px rgba(0,0,0,0.05); */
    /* Optional: Add separate card look */
}

.emi-circle {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: conic-gradient(rgb(8 50 106) 0deg,
            rgb(20 88 177) 180deg,
            #c4dd03 180deg,
            #bed600 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.emi-circle-inner {
    width: 170px;
    height: 170px;
    background: #fff;
    border-radius: 50%;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

.emi-circle-inner p {
    color: #061934;
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 5px;
}

.emi-circle-inner h3 {
    margin-top: .5rem;
    color: #196cd9;
    font-size: 24px;
    font-weight: 700;
}

.emi-summary {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 2rem;
    gap: 15px;
}

.emi-summary div {
    text-align: center;
    flex: 1;
}

.emi-summary div>span {
    color: #6b7280;
    font-size: 16px;
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.emi-summary strong {
    color: #0c2f6a;
    font-size: 1.3rem;
}

/* -------- Repayment Schedule Table -------- */
.repayment-schedule {
    margin-top: 4rem;
    background: #fdfdfd;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.repayment-schedule h3 {
    color: #111;
    border-left: 4px solid #007bff;
    padding-left: 15px;
    margin-bottom: 20px;
    font-size: 24px;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #eee;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* Ensure table doesn't get squashed */
}

th {
    background: linear-gradient(135deg, #196cd9, #0c2f6a);
    color: #fff;
    padding: 12px;
    text-align: right;
    font-weight: 600;
}

td {
    padding: 12px;
    border: 1px solid #e5e7eb;
    text-align: right;
    color: #0f172a;
    font-weight: 500;
}

th:first-child,
td:first-child {
    text-align: center;
}

tr:nth-child(even) {
    background-color: #f8fafc;
}

/* =========================================================
   RESPONSIVE QUERIES
========================================================= */

@media (max-width: 992px) {
    .calculator-grid {
        grid-template-columns: 1fr;
        /* Stack vertically */
        gap: 40px;
    }

    .emi-visual {
        width: 100%;
        /* max-width: 500px; */
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    .calculator-container {
        padding: 1.5rem;
    }

    .slider-label {
        flex-direction: column;
        align-items: flex-start;
    }

    .slider-label .inline-input {
        margin-top: 10px;
        width: 100%;
        justify-content: flex-end;
    }

    .tenure-toggle {
        margin-left: 0;
        margin-top: 5px;
    }

    .emi-circle {
        width: 200px;
        height: 200px;
    }

    .emi-circle-inner {
        width: 140px;
        height: 140px;
    }

    .emi-summary {
        flex-direction: column;
        /* Stack details vertically on very small screens? */
        /* Or maybe wrap row */
        flex-wrap: wrap;
    }

    .emi-summary div {
        min-width: 45%;
        margin-bottom: 15px;
    }
}

/* =========================================================
   REPAYMENT SCHEDULE MODAL
========================================================= */

/* Button to open modal */
.view-schedule-btn {
    margin-top: 1.5rem;
    padding: 12px 24px;
    background: #196cd9;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.view-schedule-btn:hover {
    background: #0c2f6a;
}

/* Modal Overlay */
.repayment-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Modal Content */
.repayment-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s;
    max-height: 90vh;
    overflow-y: auto;
}

/* Close Button */
.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close-modal:hover,
.close-modal:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

/* Repurpose existing repayment schedule styles for modal usage if needed */
.repayment-schedule {
    margin-top: 0 !important; /* Reset margin inside modal */
    box-shadow: none !important; /* Remove shadow inside modal */
    padding: 0 !important;
}

@keyframes modalFadeIn {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}