/* ============================================================
   PREMIUM LOAN CALCULATOR — CoopHispánica
   A modern, sleek, and high-conversion calculator interface.
   ============================================================ */

.loan-calculator-modern {
    background: #000;
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

/* Subtle background glow effect */
.loan-calculator-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1000px;
    height: 1000px;
    background: radial-gradient(circle, rgba(76, 175, 80, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

.calculator-container {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.calculator-header {
    margin-bottom: 60px;
}

.calculator-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 900;
    color: #fff;
    margin-bottom: 15px;
    letter-spacing: -2px;
}

.calculator-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

/* --- Layout Grid --- */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 430px;
    gap: 30px;
    align-items: start;
}

@media (max-width: 991px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Form Side --- */
.calculator-inputs {
    background: rgba(15, 15, 15, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 32px;
    padding: 50px;
    backdrop-filter: blur(20px);
}

.input-group-modern {
    margin-bottom: 30px;
}

.input-label-modern {
    display: block;
    margin-bottom: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
}

/* Modern Pill Inputs */
.input-modern,
.select-modern {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 16px 24px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none !important;
}

.input-modern:focus,
.select-modern:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary-green);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.15);
    /* Removed translate to prevent jitter */
}

.select-modern option {
    background: #111;
    color: #fff;
}

/* --- Summary Side --- */
.calculator-results {
    background: #ffffff;
    border-radius: 32px;
    padding: 35px;
    color: #000;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
    position: sticky;
    top: 100px;
    height: auto;
    min-width: 320px;
    /* Reduced to be more safe */
}

@media (min-width: 992px) {
    .calculator-results {
        min-width: 430px;
    }
}

.results-header {
    margin-bottom: 30px;
}

.results-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(0, 0, 0, 0.4);
}

.main-payment {
    padding-bottom: 20px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
    /* Better alignment */
}

.payment-label {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: rgba(0, 0, 0, 0.6);
}

.payment-amount {
    font-size: 2.8rem;
    /* Reduced from 3.5rem */
    font-weight: 900;
    color: #000;
    letter-spacing: -1px;
    line-height: 1.1;
    word-break: break-all;
}

/* Info Mini Cards */
.info-cards {
    margin-bottom: 30px;
}

.info-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 16px;
    border: 1px solid #f1f3f5;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-card-label {
    font-size: 0.65rem;
    /* Slightly smaller */
    font-weight: 800;
    color: rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: normal;
}

.info-card-value {
    font-size: 0.95rem;
    /* Reduced to fit long numbers */
    font-weight: 800;
    color: #000;
    letter-spacing: -0.5px;
}

/* Distribution Bar High-End */
.distribution-chart {
    margin-top: 30px;
}

.chart-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    color: rgba(0, 0, 0, 0.4);
}

.chart-bar {
    height: 12px;
    width: 100%;
    background: #f1f3f5;
    border-radius: 100px;
    display: flex;
    overflow: hidden;
    margin-bottom: 15px;
}

.chart-segment {
    height: 100%;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0;
    /* Hide text inside bar for cleaner look */
}

.chart-segment.capital {
    background: #000;
}

.chart-segment.interest {
    background: var(--primary-green);
}

.chart-legend {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    /* Added wrap */
    justify-content: flex-start;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    /* Slightly smaller legend */
    font-weight: 700;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-color.capital {
    background: #000;
}

.legend-color.interest {
    background: var(--primary-green);
}

/* Premium CTA Button */
.action-button {
    width: 100%;
    background: var(--primary-green);
    color: #000;
    border: none;
    padding: 20px;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 800;
    margin-top: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.action-button:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 40px rgba(76, 175, 80, 0.2);
}

/* --- Amortization Table --- */
.amortization-section {
    margin-top: 40px;
}

.amortization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.amortization-title {
    color: var(--color-carbon-black) !important;
    font-size: 1.25rem;
    font-weight: 700;
}

.toggle-table-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 10px 20px;
    border-radius: 100px;
    color: var(--color-carbon-black) !important;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-table-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: var(--primary-green);
}

.table-modern {
    width: 100%;
    border-collapse: collapse;
}

.table-modern th {
    text-align: left;
    padding: 15px 10px;
    font-size: 0.75rem;
    color: var(--color-polar-white) !important;
    text-transform: uppercase;
    font-weight: 800;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.table-modern td {
    padding: 18px 10px;
    color: var(--color-carbon-black) !important;
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.table-modern tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Animations & Mobile */
@media (max-width: 768px) {
    .calculator-inputs {
        padding: 30px 20px;
    }

    .calculator-results {
        padding: 30px 20px;
        position: static;
        margin-top: 20px;
    }

    .payment-amount {
        font-size: 2.5rem;
    }
}