/* =============================================================================
   calculator.css — Hesaplama aracı
   Sol: açık zeminde form. Sağ: koyu yeşil sonuç paneli (sayfanın odak noktası).
   ========================================================================== */

.calc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    overflow: hidden;
}

/* --- Sol panel: form ----------------------------------------------------- */
.calc-form {
    padding: 22px 24px 24px;
    border-right: 1px solid var(--line);
}

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}
.panel-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.008em;
}
.panel-note {
    font-size: 12.5px;
    color: var(--ink-3);
}

.field { margin-bottom: 18px; }
.field:last-of-type { margin-bottom: 0; }

.field > label,
.field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-2);
}

.input-wrap { position: relative; display: block; }

.input-wrap input {
    width: 100%;
    height: var(--field);
    padding: 0 46px 0 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    transition: border-color .14s ease, box-shadow .14s ease;
    -moz-appearance: textfield;
}
.input-wrap input::-webkit-outer-spin-button,
.input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.input-wrap input:hover { border-color: var(--ink-3); }
.input-wrap input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 81, 58, .10);
}
.input-wrap input[aria-invalid="true"] {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(147, 51, 42, .09);
}

.input-wrap .suffix {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--ink-2);
    pointer-events: none;
}

.input-wrap.prefixed input { padding-left: 30px; padding-right: 14px; }
.input-wrap .prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--ink-2);
    pointer-events: none;
}

.field-hint {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--ink-3);
    line-height: 1.45;
    min-height: 1px;
}
.field-hint.error { color: var(--red); }

/* --- Segmented control (kredi türü) -------------------------------------- */
.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--paper);
}
.segmented button {
    min-height: 44px;
    padding: 0 8px;
    border: 0;
    border-right: 1px solid var(--line);
    background: var(--paper);
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease;
}
.segmented button:last-child { border-right: 0; }
.segmented button:hover { background: var(--paper-2); color: var(--ink); }
.segmented button[aria-pressed="true"] {
    background: var(--deep);
    color: var(--ink-inv);
    font-weight: 600;
}

/* --- Vade: slider + hızlı seçim ------------------------------------------ */
.term-row {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    background: transparent;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
    height: 3px;
    background: var(--line);
    border-radius: 2px;
}
input[type="range"]::-moz-range-track {
    height: 3px;
    background: var(--line);
    border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -7.5px;
    border-radius: 50%;
    background: var(--green);
    border: 3px solid var(--paper);
    box-shadow: 0 0 0 1px var(--green);
}
input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--paper);
    box-shadow: 0 0 0 1px var(--green);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.chip {
    min-height: 32px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-2);
    cursor: pointer;
    transition: border-color .14s ease, background-color .14s ease, color .14s ease;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
    font-weight: 600;
}

/* --- Gelişmiş ayarlar ---------------------------------------------------- */
.advanced {
    margin-top: 18px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}
.advanced > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    list-style: none;
    padding: 4px 0;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--ink-2);
    border-bottom: 1.5px solid var(--ink-2);
    transform: rotate(45deg) translateY(-2px);
    transition: transform .16s ease;
}
.advanced[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }

.advanced-body { padding-top: 14px; }

.checkline {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.45;
}
.checkline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--green);
    flex: 0 0 auto;
}
.checkline label { cursor: pointer; }

/* Bilgi ikonu + tooltip */
.info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    margin-left: 5px;
    border: 1px solid var(--ink-3);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-2);
    cursor: help;
    background: transparent;
    vertical-align: -3px;
    padding: 0;
}
.info:hover { border-color: var(--ink); color: var(--ink); }

.tooltip {
    display: none;
    margin: 8px 0 0;
    padding: 11px 13px;
    background: var(--paper-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.55;
    color: var(--ink-2);
}
.tooltip.is-open { display: block; }

.exemption-box {
    margin-bottom: 18px;
    padding: 13px 14px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.exemption-box .field-label { margin-bottom: 9px; color: var(--ink); font-weight: 600; font-size: 13.5px; }
.exemption-box .checkline { margin-bottom: 0; }

.calc-actions { margin-top: 20px; }

/* --- Sağ panel: sonuç ---------------------------------------------------- */
.calc-result {
    background: var(--deep);
    color: var(--ink-inv);
    padding: 22px 24px 24px;
    display: flex;
    flex-direction: column;
}

.result-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(242, 239, 231, .14);
}
.result-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-inv);
}
.result-head .panel-note { color: #8E9A91; }

.result-top { padding: 20px 0 18px; }

.result-label {
    margin: 0 0 6px;
    font-size: 13.5px;
    color: var(--gold-2);
    letter-spacing: 0.005em;
}

.result-value {
    margin: 0;
    font-size: clamp(34px, 4.2vw, 46px);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.02;
    font-variant-numeric: tabular-nums;
    transition: opacity .12s ease;
}
.result-value.is-updating { opacity: .45; }

.result-sub {
    margin: 9px 0 0;
    font-size: 13.5px;
    color: #9AA79E;
    font-variant-numeric: tabular-nums;
}

/* KPI ızgarası */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid rgba(242, 239, 231, .14);
    border-left: 1px solid rgba(242, 239, 231, .14);
}
.kpi {
    padding: 14px 16px;
    border-right: 1px solid rgba(242, 239, 231, .14);
    border-bottom: 1px solid rgba(242, 239, 231, .14);
    min-width: 0;
}
.kpi-label {
    margin: 0 0 5px;
    font-size: 12.5px;
    color: #9AA79E;
    line-height: 1.35;
}
.kpi-value {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.kpi.is-muted .kpi-value { color: #8E9A91; }

/* Maliyet dağılımı */
.breakdown { padding: 20px 0 0; }
.breakdown-title {
    margin: 0 0 10px;
    font-size: 13px;
    color: #9AA79E;
}
.bar {
    display: flex;
    width: 100%;
    height: 10px;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(242, 239, 231, .10);
}
.bar span { display: block; height: 100%; transition: width .2s ease; }
.bar .seg-principal { background: var(--green-3); }
.bar .seg-interest  { background: var(--gold-2); }
.bar .seg-tax       { background: var(--bronze); }
.bar .seg-fees      { background: #6E7A72; }

.legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}
.legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #C8CCC5;
}
.legend i {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    flex: 0 0 auto;
}
.legend .val {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    color: var(--ink-inv);
}
.legend .l-principal i { background: var(--green-3); }
.legend .l-interest i  { background: var(--gold-2); }
.legend .l-tax i       { background: var(--bronze); }
.legend .l-fees i      { background: #6E7A72; }

.assumption {
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(242, 239, 231, .14);
    font-size: 12.5px;
    line-height: 1.55;
    color: #9AA79E;
}

.result-empty {
    margin: 0;
    padding: 22px 0;
    color: #9AA79E;
    font-size: 14.5px;
}

/* --- Hesaplama detayları (açık panel) ------------------------------------ */
.detail-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
}
.panel > h2 {
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
    font-weight: 600;
}

/* Muhasebe satırları (noktalı hizalama) */
.ledger { margin: 0; }
.ledger-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px dotted var(--line);
    font-size: 14.5px;
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-row dt { color: var(--ink-2); flex: 0 0 auto; }
.ledger-row dd {
    margin: 0 0 0 auto;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.ledger-row.is-total {
    margin-top: 4px;
    padding-top: 13px;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    font-size: 16px;
}
.ledger-row.is-total dt { color: var(--ink); font-weight: 600; }
.ledger-row.is-total dd { font-weight: 600; }
.ledger-row.is-sub dt { padding-left: 14px; color: var(--ink-3); font-size: 13.5px; }
.ledger-row.is-sub dd { color: var(--ink-2); font-size: 13.5px; }

/* Vergili / vergisiz karşılaştırma */
.tax-compare {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
}
.tax-compare div { background: var(--paper-2); padding: 13px 14px; }
.tax-compare dt { margin: 0 0 5px; font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.tax-compare dd {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.018em;
}
.tax-compare .highlight { background: var(--paper-3); }
.tax-compare .highlight dd { color: var(--green); }

.share-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}
.share-status {
    font-size: 13px;
    color: var(--green);
    align-self: center;
}

/* --- Ödeme planı --------------------------------------------------------- */
.schedule-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.schedule-head h2 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.018em; }
.schedule-head p { margin: 0; font-size: 14px; color: var(--ink-2); }

.schedule-table td:first-child { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.schedule-more { margin-top: 14px; }

.hidden { display: none !important; }

/* --- Hızlı senaryolar ---------------------------------------------------- */
.scenarios {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.scenario {
    padding: 14px 16px;
    background: var(--paper);
    border: 0;
    text-align: left;
    cursor: pointer;
    transition: background-color .14s ease;
}
.scenario:hover { background: var(--paper-2); }
.scenario .s-amount {
    display: block;
    font-size: 15.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.015em;
    margin-bottom: 3px;
}
.scenario .s-meta { display: block; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* --- Araç formu (yapılandırma / erken kapama) ---------------------------- */
.tool-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
}
.tool-form-grid .field-full { grid-column: 1 / -1; }

.compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: rgba(242, 239, 231, .14);
    border: 1px solid rgba(242, 239, 231, .14);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 4px;
}
.compare-col { background: var(--deep); padding: 16px; }
.compare-col h3 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gold-2);
}
.compare-col .ledger-row { border-bottom-color: rgba(242, 239, 231, .12); font-size: 13.5px; }
.compare-col .ledger-row dt { color: #9AA79E; }
.compare-col .ledger-row dd { color: var(--ink-inv); }
.compare-col .ledger-row.is-total { border-top-color: rgba(242, 239, 231, .2); }
.compare-col .ledger-row.is-total dt { color: var(--ink-inv); }

.delta {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid rgba(242, 239, 231, .16);
    border-radius: var(--radius-sm);
}
.delta p { margin: 0; }
.delta .delta-label { font-size: 13px; color: #9AA79E; margin-bottom: 6px; }
.delta .delta-value {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.028em;
    font-variant-numeric: tabular-nums;
}
.delta .delta-note { margin-top: 8px; font-size: 12.5px; color: #9AA79E; line-height: 1.55; }
.delta.is-positive .delta-value { color: #7FBF9B; }
.delta.is-negative .delta-value { color: #E0A98C; }
