/* ================================
   Compound Interest Calculator
   ================================ */

.compound-calculator-wrapper {
    direction: rtl;
    max-width: 980px;
    margin: 2rem auto;
    /*padding: 1rem;*/
    font-family: inherit;
}

.compound-calculator-container {
    background:
        radial-gradient(circle at top right, rgba(20, 127, 151, 0.12), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    /*border: 1px solid #e5edf2;*/
    border-radius: 28px;
    padding: 2rem 0.5rem;
    /*box-shadow: 0 22px 60px rgba(15, 23, 42, 0.08);*/
}

.compound-calculator-container h2 {
    margin: 0 0 1.75rem;
    color: #0f172a;
    font-size: clamp(24px, 4vw, 34px);
    font-weight: 900;
    line-height: 1.5;
    text-align: center;
}

.compound-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.compound-form label {
    display: block;
    margin-bottom: 0.45rem;
    color: #0f172a;
    font-size: 15px;
    line-height: 1.8;
}

.compound-form label strong {
    font-weight: 800;
}

.compound-form input,
.compound-form select {
    width: 100%;
    height: 52px;
    padding: 0 1rem;
    color: #0f172a;
    background: #ffffff;
    border: 1.5px solid #d8e3ea;
    border-radius: 16px;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    line-height: 52px;
    box-sizing: border-box;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease,
        background-color 0.2s ease;
}

.compound-form input::placeholder {
    color: #9aa8b5;
}

.compound-form input:hover,
.compound-form select:hover {
    border-color: #a8c4cf;
}

.compound-form input:focus,
.compound-form select:focus {
    background-color: #ffffff;
    border-color: #147f97;
    box-shadow: 0 0 0 4px rgba(20, 127, 151, 0.13);
}

.compound-form select {
    cursor: pointer;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #147f97 50%),
        linear-gradient(135deg, #147f97 50%, transparent 50%);
    background-position:
        left 18px center,
        left 12px center;
    background-size:
        7px 7px,
        7px 7px;
    background-repeat: no-repeat;
    padding-left: 2.5rem;
}

.compound-form p {
    margin: 0.45rem 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.9;
}

.compound-form .asterisk {
    color: #ef4444;
    margin-right: 0.25rem;
}

.compound-form > label,
.compound-form > input,
.compound-form > select,
.compound-form > p {
    grid-column: auto;
}

/* هر فیلد را مثل یک کارت کوچک گروه‌بندی می‌کنیم */
.compound-form label[for="initial-amount"],
.compound-form label[for="annual-rate"],
.compound-form label[for="compounding-frequency"],
.compound-form label[for="investment-duration"],
.compound-form label[for="additional-contribution"],
.compound-form label[for="contribution-frequency"],
.compound-form label[for="inflation-rate"] {
    margin: 0;
}

/* ساختار جدید با CSS فقط */
.compound-form label[for="initial-amount"],
#initial-amount,
#initial-amount + p,
.compound-form label[for="annual-rate"],
#annual-rate,
#annual-rate + p,
.compound-form label[for="compounding-frequency"],
#compounding-frequency,
#compounding-frequency + p,
.compound-form label[for="investment-duration"],
#investment-duration,
#investment-duration + p,
.compound-form label[for="additional-contribution"],
#additional-contribution,
#additional-contribution + p,
.compound-form label[for="contribution-frequency"],
#contribution-frequency,
#contribution-frequency + p,
.compound-form label[for="inflation-rate"],
#inflation-rate,
#inflation-rate + p {
    width: 100%;
}

.compound-form button {
    grid-column: 1 / -1;
    justify-self: center;
    min-width: 220px;
    min-height: 54px;
    margin-top: 0.75rem;
    padding: 0.85rem 2rem;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    background: linear-gradient(135deg, #147f97 0%, #0f766e 100%);
    box-shadow: 0 14px 32px rgba(20, 127, 151, 0.28);
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}

.compound-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(20, 127, 151, 0.34);
    filter: brightness(1.04);
}

.compound-form button:active {
    transform: translateY(0);
    box-shadow: 0 10px 24px rgba(20, 127, 151, 0.25);
}

/* ================================
   Result Area
   ================================ */

.compound-result {
    margin-top: 2rem;
}

.compound-result h3 {
    margin: 0 0 1rem;
    color: #0f172a;
    font-size: 24px;
    font-weight: 900;
}

.compound-error {
    background: #fff5f5;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 18px;
    padding: 1rem 1.25rem;
    line-height: 1.9;
    font-weight: 700;
}

.compound-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.25rem 0;
}

.compound-summary-card {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e6edf2;
    border-radius: 22px;
    padding: 1.1rem;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.07);
}

.compound-summary-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background: #147f97;
}

.compound-summary-card span {
    display: block;
    margin-bottom: 0.45rem;
    color: #64748b;
    font-size: 13px;
    line-height: 1.8;
}

.compound-summary-card strong {
    display: block;
    color: #0f172a;
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 900;
    line-height: 1.7;
}

.compound-summary-card.profit-card::before {
    background: #10b981;
}

.compound-summary-card.profit-card strong {
    color: #0f766e;
}

/* ================================
   Chart
   ================================ */

.compound-chart-card {
    background: #ffffff;
    border: 1px solid #e6edf2;
    border-radius: 26px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.compound-chart-header {
    margin-bottom: 1rem;
}

.compound-chart-header h4 {
    margin: 0 0 0.45rem;
    color: #0f172a;
    font-size: 20px;
    font-weight: 900;
    line-height: 1.6;
}

.compound-chart-header p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.9;
}

.compound-chart-box {
    position: relative;
    width: 100%;
    height: 390px;
    margin-top: 1rem;
}

.compound-insight {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    color: #115e59;
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 100%);
    border: 1px solid #99f6e4;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.9;
}

/* ================================
   Table
   ================================ */

.compound-table-details {
    margin-top: 1.5rem;
    background: #ffffff;
    border: 1px solid #e6edf2;
    border-radius: 22px;
    padding: 1rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.compound-table-details summary {
    cursor: pointer;
    color: #0f172a;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.9;
}

.compound-table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
    border: 1px solid #e6edf2;
    border-radius: 18px;
}

.compound-table {
    width: 100%;
    min-width: 920px;
    text-align: center;
    border-collapse: collapse;
    background: #ffffff;
}

.compound-table th,
.compound-table td {
    border-bottom: 1px solid #edf2f7;
    padding: 0.85rem;
    white-space: nowrap;
    font-size: 14px;
}

.compound-table th {
    color: #0f172a;
    background: #f8fafc;
    font-weight: 900;
}

.compound-table td {
    color: #334155;
}

.compound-table tbody tr:hover {
    background: #f8fafc;
}

.compound-table tfoot td {
    color: #0f172a;
    background: #f9fafb;
    font-weight: 900;
}




.compound-field {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid #edf2f7;
    border-radius: 20px;
    padding: 1rem;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.compound-field:hover {
    border-color: #cfe0e8;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
    transform: translateY(-1px);
}
.compound-field-full,
.compound-actions {
    grid-column: 1 / -1;
}

.compound-actions {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
}


/* ================================
   Responsive
   ================================ */

@media (max-width: 900px) {
    .compound-calculator-container {
        padding: 0;
        border-radius: 24px;
    }

    .compound-form {
        grid-template-columns: 1fr;
    }

    .compound-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .compound-calculator-wrapper {
        padding: 0;
        margin: 1rem auto;
    }

    .compound-calculator-container {
        padding: 0.5rem;
        border-radius: 20px;
        margin-left: -1rem;
        margin-right: -1rem;
    }

    .compound-summary-grid {
        grid-template-columns: 1fr;
    }

    .compound-form input,
    .compound-form select {
        height: 50px;
        font-size: 14px;
    }

    .compound-form button {
        width: 100%;
        min-width: unset;
    }

    .compound-chart-card,
    .compound-table-details {
        border-radius: 20px;
        padding: 1rem;
    }

    .compound-chart-box {
        height: 320px;
    }

    .compound-summary-card strong {
        font-size: 18px;
    }
}