/* ==========================================
   PROFIT MARGIN CALCULATOR
========================================== */

.profit-page{
    max-width:1100px;
    margin:auto;
    padding:60px 20px;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:35px;
}

.profit-card,
.result-card,
.profit-info{
    background:#ffffff;
    color:#1f2937;
    border-radius:24px;
    box-shadow:0 18px 45px rgba(0,0,0,.12);
    padding:35px;
}

.profit-card h1{
    color:#10b981;
    text-align:center;
    margin-bottom:10px;
}

.subtitle{
    text-align:center;
    color:#64748b;
    margin-bottom:25px;
    line-height:1.6;
}

.profit-card label{
    display:block;
    font-weight:700;
    margin-bottom:8px;
}

.profit-card input{
    width:100%;
    padding:14px 15px;
    font-size:16px;
    border-radius:14px;
    border:1px solid #d1d5db;
    outline:none;
    margin-bottom:18px;
}

.profit-card input:focus{
    border-color:#10b981;
    box-shadow:0 0 0 4px rgba(16,185,129,.15);
}

.actions{
    display:flex;
    gap:12px;
}

.actions button{
    flex:1;
    border:none;
    border-radius:14px;
    padding:14px 20px;
    font-size:16px;
    font-weight:700;
    cursor:pointer;
    background:#10b981;
    color:#ffffff;
    transition:.3s;
}

.actions button:hover{
    background:#059669;
    transform:translateY(-2px);
}

.reset-btn{
    background:#334155 !important;
}

.reset-btn:hover{
    background:#475569 !important;
}

.result-card h2,
.profit-info h2{
    color:#10b981;
    text-align:center;
}

.profit-result{
    min-height:220px;
    display:flex;
    justify-content:center;
    align-items:center;
    text-align:center;
    border:2px dashed #d1d5db;
    border-radius:20px;
    padding:25px;
    color:#64748b;
}

.profit-result.active{
    display:block;
    text-align:left;
}

.result-line{
    display:flex;
    justify-content:space-between;
    padding:12px 0;
    border-bottom:1px solid #e5e7eb;
    font-weight:700;
}

.result-line strong{
    color:#10b981;
}

.growth-bars{
    margin-top:25px;
}

.bar-row{
    margin-bottom:18px;
}

.bar-row span{
    display:block;
    margin-bottom:8px;
    font-weight:700;
}

.bar-bg{
    height:16px;
    background:#e5e7eb;
    border-radius:50px;
    overflow:hidden;
}

.bar{
    height:100%;
    width:0%;
    transition:width .8s ease;
}

.investment-bar{
    background:#10b981;
}

.interest-bar{
    background:#f59e0b;
}

.profit-info{
    max-width:1100px;
    margin:0 auto 40px;
    line-height:1.7;
}

/* ---------- DARK MODE ---------- */

body.dark-mode .profit-card,
body.dark-mode .result-card,
body.dark-mode .profit-info{
    background:#1f2937;
    color:#e5e7eb;
}

body.dark-mode .subtitle,
body.dark-mode .profit-result{
    color:#cbd5e1;
}

body.dark-mode .profit-card input{
    background:#111827;
    color:#e5e7eb;
    border-color:#374151;
}

body.dark-mode .profit-result{
    border-color:#374151;
}

body.dark-mode .result-line{
    border-bottom-color:#374151;
}

body.dark-mode .bar-bg{
    background:#374151;
}

@media(max-width:768px){

    .profit-page{
        grid-template-columns:1fr;
        padding:35px 15px;
    }

    .actions{
        flex-direction:column;
    }

}
.profit-card .form-group {
    margin-bottom: 18px;
}

.profit-card .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.profit-card .form-group input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #ffffff;
    font-size: 16px;
    outline: none;
}

.profit-card .form-group input:focus {
    border-color: #10b981;
}
.profit-form .form-group {
    margin-bottom: 18px;
}

.profit-form label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

.profit-form input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 15px;
    font-size: 16px;
    border-radius: 14px;
    border: 1px solid #374151;
    outline: none;
    margin-bottom: 18px;
    background: #111827;
    color: #e5e7eb;
}
/* ======================================
   PROFIT MARGIN NUMBER WORDS
   ====================================== */

.profit-result-item{
    display:grid;
    grid-template-columns:
        minmax(0,1fr)
        auto;

    gap:4px 12px;
    align-items:center;
}

.profit-result-item strong{
    font-variant-numeric:
        tabular-nums;

    text-align:right;
}

.profit-number-words{
    grid-column:1 / -1;

    display:block;
    margin-top:4px;
    padding:8px 10px;

    border:
        1px solid
        var(--tool-words-border);

    border-radius:8px;

    background:
        var(--tool-words-bg);

    color:
        var(--tool-words-text);

    font-size:.76rem;
    font-weight:600;
    line-height:1.45;
    text-align:center;

    overflow-wrap:anywhere;
}

.profit-negative-value{
    color:#ef4444 !important;
}

.profit-negative-words{
    background:#fef2f2;
    border-color:#fecaca;
    color:#991b1b;
}

body.dark-mode .profit-negative-words{
    background:#3f1d1d;
    border-color:#7f1d1d;
    color:#fecaca;
}

/* =========================================
   PROFIT MARGIN EDUCATIONAL GUIDE
   ========================================= */

.profit-guide {
    max-width: 1100px;
    margin: 40px auto;
    padding: 36px 40px;

    background: var(--card-bg, #ffffff);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 22px;

    box-shadow:
        0 10px 30px rgba(15, 23, 42, 0.06),
        0 2px 8px rgba(15, 23, 42, 0.04);
}


/* =========================================
   MAIN GUIDE HEADING
   ========================================= */

.profit-guide > h2 {
    margin: 0 0 18px;

    font-size: clamp(1.65rem, 3vw, 2.15rem);
    line-height: 1.25;
    font-weight: 800;

    color: var(--text-primary, #0f172a);
}


/* =========================================
   SECTION HEADINGS
   ========================================= */

.profit-guide h3 {
    margin: 32px 0 12px;

    font-size: 1.2rem;
    line-height: 1.4;
    font-weight: 700;

    color: var(--text-primary, #0f172a);
}


/* =========================================
   PARAGRAPHS
   ========================================= */

.profit-guide p {
    margin: 0 0 16px;

    font-size: 1rem;
    line-height: 1.8;

    color: var(--text-secondary, #475569);
}

.profit-guide p:last-child {
    margin-bottom: 0;
}


/* =========================================
   FORMULA CARDS
   ========================================= */

.profit-formula {
    position: relative;

    margin: 18px 0 22px;
    padding: 20px 24px;

    background:
        linear-gradient(
            135deg,
            rgba(37, 99, 235, 0.07),
            rgba(14, 165, 233, 0.04)
        );

    border: 1px solid rgba(37, 99, 235, 0.16);
    border-left: 4px solid #2563eb;

    border-radius: 14px;

    overflow-x: auto;
}

.profit-formula strong {
    display: block;

    font-size: 1.03rem;
    line-height: 1.6;
    font-weight: 750;

    color: var(--text-primary, #0f172a);

    white-space: normal;
}


/* =========================================
   INTERNAL TOOL LINKS
   ========================================= */

.profit-guide a {
    color: var(--primary, #2563eb);
    font-weight: 700;
    text-decoration: none;

    border-bottom: 1px solid transparent;

    transition:
        color 0.2s ease,
        border-color 0.2s ease;
}

.profit-guide a:hover {
    border-bottom-color: currentColor;
}

.profit-guide a:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 3px;
    border-radius: 4px;
}


/* =========================================
   DARK THEME
   ========================================= */

[data-theme="dark"] .profit-guide {
    background: #111827;
    border-color: rgba(148, 163, 184, 0.16);

    box-shadow:
        0 12px 34px rgba(0, 0, 0, 0.22),
        0 2px 8px rgba(0, 0, 0, 0.14);
}

[data-theme="dark"] .profit-guide > h2,
[data-theme="dark"] .profit-guide h3 {
    color: #f8fafc;
}

[data-theme="dark"] .profit-guide p {
    color: #cbd5e1;
}

[data-theme="dark"] .profit-guide a {
    color: #60a5fa;
}


/* Dark formula cards */

[data-theme="dark"] .profit-formula {
    background:
        linear-gradient(
            135deg,
            rgba(59, 130, 246, 0.13),
            rgba(14, 165, 233, 0.07)
        );

    border-color: rgba(96, 165, 250, 0.20);
    border-left-color: #60a5fa;
}

[data-theme="dark"] .profit-formula strong {
    color: #f8fafc;
}


/* =========================================
   TABLET / MOBILE
   ========================================= */

@media (max-width: 768px) {

    .profit-guide {
        margin: 28px 16px;
        padding: 26px 22px;

        border-radius: 18px;
    }

    .profit-guide > h2 {
        font-size: 1.55rem;
    }

    .profit-guide h3 {
        margin-top: 26px;
        font-size: 1.1rem;
    }

    .profit-guide p {
        font-size: 0.97rem;
        line-height: 1.75;
    }

    .profit-formula {
        margin: 16px 0 20px;
        padding: 18px 20px;
    }

    .profit-formula strong {
        font-size: 0.98rem;
    }
}


/* =========================================
   SMALL MOBILE
   ========================================= */

@media (max-width: 480px) {

    .profit-guide {
        margin: 24px 12px;
        padding: 22px 18px;

        border-radius: 16px;
    }

    .profit-formula {
        padding: 16px 17px;

        border-radius: 12px;
    }

    .profit-formula strong {
        font-size: 0.94rem;
        line-height: 1.55;
    }
}