/**
 * ISA vs 일반계좌 세후수익 비교 계산기
 * @package Zipper
 */

.isatx-hidden {
    display: none !important;
}

.isatx-main-layout {
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.isatx-input-col {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.isatx-result-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.isatx-section,
.isatx-result-summary,
.isatx-chart-section,
.isatx-table-section {
    border: 1px solid #e8e3d9;
    border-radius: 12px;
    background: #fff;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.isatx-input-section {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.isatx-section-title {
    margin: 0 0 12px;
    color: #2d2a26;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    display: flex;
    align-items: center;
    gap: 6px;
}

.isatx-section-title i {
    color: #d4af37;
}

.isatx-input-group {
    margin-bottom: 12px;
    min-width: 0;
    box-sizing: border-box;
}

.isatx-input-group:last-child {
    margin-bottom: 0;
}

.isatx-input-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px !important;
    min-width: 0;
}

.isatx-input-label {
    display: block;
    margin-bottom: 6px;
    color: #5f5a56;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.isatx-input-wrap {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch !important;
    justify-content: stretch !important;
    width: 100%;
    min-width: 0;
    gap: 0 !important;
    border: 1px solid #ddd7cb;
    border-radius: 8px;
    overflow: hidden;
    background: #fbfaf8;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.isatx-input-wrap:hover {
    border-color: #d4c67a;
}

.isatx-input-wrap:focus-within {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    background: #fff;
}

.isatx-amount-input,
.isatx-number-input,
.isatx-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #2d2a26;
    font-size: 13px;
    line-height: 1.3;
    padding: 10px 12px;
    box-sizing: border-box;
}

.isatx-amount-input,
.isatx-number-input {
    text-align: right;
    font-weight: 600;
}

.isatx-select {
    text-align: left;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.isatx-amount-input:focus,
.isatx-number-input:focus,
.isatx-select:focus {
    outline: none;
}

.isatx-amount-input::placeholder {
    color: #c4c0bc;
    font-weight: 400;
}

.isatx-number-input[type="number"] {
    -moz-appearance: textfield;
}

.isatx-number-input[type="number"]::-webkit-inner-spin-button,
.isatx-number-input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
}

.isatx-unit {
    min-width: 56px;
    padding: 0 10px;
    border-left: 1px solid #e4ddd0;
    background: linear-gradient(180deg, #fcfbf8 0%, #f3efe8 100%);
    color: #7b7467;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    box-sizing: border-box;
    white-space: nowrap;
}

.isatx-korean-amount {
    margin: 6px 0 0;
    min-height: 16px;
    color: #d4af37;
    font-size: 11px;
    line-height: 1.4;
    text-align: right;
}

.isatx-input-hint {
    margin: 8px 0 0;
    color: #8f887d;
    font-size: 11px;
    line-height: 1.45;
}

.isatx-btn-group {
    display: flex;
    gap: 8px;
    width: 100%;
}

.isatx-btn {
    border: none;
    border-radius: 10px;
    padding: 12px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    min-height: 44px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.isatx-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.isatx-btn-primary {
    flex: 1;
    color: #fff;
    background: linear-gradient(135deg, #d4af37 0%, #c69a23 100%);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
}

.isatx-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
}

.isatx-btn-ghost {
    color: #5f5a56;
    background: #f5f3f0;
    border: 1px solid #e8e4dc;
}

.isatx-btn-ghost:hover {
    border-color: #d4c67a;
    color: #2d2a26;
}

.isatx-waiting {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b645a;
    font-size: 13px;
    line-height: 1.5;
}

.isatx-waiting i {
    color: #d4af37;
}

.isatx-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 0;
}

.isatx-summary-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 10px;
    background: #f8f2df;
    color: #8d6a12;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.isatx-result-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.isatx-core-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.isatx-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.isatx-kpi-card {
    border: 1px solid #eee6d9;
    border-radius: 10px;
    background: #fcfbf8;
    padding: 12px;
    min-width: 0;
    box-sizing: border-box;
}

.isatx-kpi-card.is-core {
    background: linear-gradient(180deg, #fffcf6 0%, #fcf7eb 100%);
    border-color: #ebdfc9;
}

.isatx-kpi-card.is-hero {
    padding: 14px;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.12);
}

.isatx-kpi-card.is-compare,
.isatx-kpi-card.is-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.isatx-kpi-label {
    display: block;
    margin-bottom: 6px;
    color: #7b7467;
    font-size: 12px;
    line-height: 1.4;
}

.isatx-kpi-value {
    display: block;
    color: #2d2a26;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    word-break: keep-all;
}

.isatx-kpi-card.is-core .isatx-kpi-value {
    font-size: 22px;
}

.isatx-core-note {
    margin: 6px 0 0;
    color: #847d71;
    font-size: 11px;
    line-height: 1.45;
}

.isatx-compare-title {
    color: #5f5a56;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

.isatx-compare-values {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.isatx-compare-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid #f0ece4;
}

.isatx-compare-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.isatx-compare-label {
    color: #7b7467;
    font-size: 12px;
    line-height: 1.4;
}

.isatx-compare-value {
    color: #2d2a26;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
    text-align: right;
}

.isatx-detail-toggle {
    border: 1px solid #e6dfd1;
    border-radius: 10px;
    background: #fcfbf8;
}

.isatx-detail-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: #5f5a56;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
    list-style: none;
}

.isatx-detail-summary::-webkit-details-marker {
    display: none;
}

.isatx-detail-summary::before {
    content: '+';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f3ecda;
    color: #8d6a12;
    font-size: 12px;
    font-weight: 700;
}

.isatx-detail-toggle[open] .isatx-detail-summary {
    border-bottom: 1px solid #ece4d5;
}

.isatx-detail-toggle[open] .isatx-detail-summary::before {
    content: '−';
}

.isatx-detail-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 12px 12px;
}

.isatx-kpi-card.is-detail {
    padding: 10px;
    background: #fff;
}

.isatx-kpi-card.is-detail .isatx-kpi-label {
    margin-bottom: 4px;
}

.isatx-kpi-card.is-detail .isatx-kpi-value {
    font-size: 16px;
}

#isatxAnnualSaving,
#isatxCumulativeSaving,
#isatxAnnualNetIsa,
#isatxCumulativeNetIsa {
    color: #1f7f4d;
}

.isatx-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.isatx-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    white-space: nowrap;
}

#isatxDownloadBtn.tool-btn.tool-btn-excel,
.isatx-download-btn.tool-btn.tool-btn-excel {
    color: #fff;
    background: linear-gradient(135deg, #59ab79 0%, #4b9a69 100%);
    border: 1px solid #448e62;
    box-shadow: 0 2px 6px rgba(72, 146, 103, 0.28);
    min-height: 40px;
    padding: 9px 14px;
}

#isatxDownloadBtn.tool-btn.tool-btn-excel:hover,
.isatx-download-btn.tool-btn.tool-btn-excel:hover {
    background: linear-gradient(135deg, #4f9f70 0%, #438f62 100%);
    border-color: #3d845a;
    box-shadow: 0 4px 12px rgba(67, 133, 93, 0.34);
}

.isatx-chart-sub {
    margin: 0 0 10px;
    color: #6b645a;
    font-size: 12px;
    line-height: 1.5;
}

.isatx-chart-wrap {
    position: relative;
    width: 100%;
    height: 320px;
    min-width: 0;
}

.isatx-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.isatx-chart-fallback-text {
    margin: 8px 0 0;
    color: #8a5c00;
    font-size: 12px;
    line-height: 1.45;
}

.isatx-fallback-table-wrap,
.isatx-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.isatx-fallback-table,
.isatx-detail-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.isatx-fallback-table th,
.isatx-fallback-table td,
.isatx-detail-table th,
.isatx-detail-table td {
    border-bottom: 1px solid #f0ece4;
    padding: 10px 8px;
    text-align: right;
    color: #4d473f;
    font-size: 12px;
    line-height: 1.45;
    vertical-align: middle;
    white-space: nowrap;
}

.isatx-fallback-table th:first-child,
.isatx-fallback-table td:first-child,
.isatx-detail-table th:first-child,
.isatx-detail-table td:first-child {
    text-align: left;
}

.isatx-fallback-table thead th,
.isatx-detail-table thead th {
    background: #faf7f0;
    color: #665f53;
    font-weight: 700;
}

.isatx-detail-table td[colspan="5"] {
    text-align: center !important;
    color: #9b9387;
}

.isatx-assumption-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #544f47;
    font-size: 12px;
    line-height: 1.5;
}

.isatx-assumption {
    background: linear-gradient(180deg, #fffdf8 0%, #fcf8ef 100%);
}

.isatx-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    color: #9e9a96;
    font-size: 11px;
    line-height: 1.55;
}

.isatx-disclaimer i {
    color: #d4af37;
    flex-shrink: 0;
    margin-top: 2px;
}

.isatx-date-notice {
    margin: 0 0 12px;
    color: #7a7468;
    font-size: 12px;
    line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    .isatx-section,
    .isatx-result-summary,
    .isatx-chart-section,
    .isatx-table-section,
    .isatx-input-wrap,
    .isatx-btn {
        transition: none !important;
    }

    .isatx-btn:hover {
        transform: none !important;
    }
}

@media (max-width: 1200px) {
    .isatx-detail-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .isatx-main-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .isatx-input-col {
        position: static;
    }

    .isatx-section,
    .isatx-result-summary,
    .isatx-chart-section,
    .isatx-table-section {
        padding: 16px;
    }

    .isatx-core-grid,
    .isatx-compare-grid {
        grid-template-columns: 1fr;
    }

    .isatx-detail-metrics {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    .isatx-detail-summary {
        padding: 11px 12px;
        line-height: 1.45;
        white-space: normal;
        word-break: keep-all;
    }

    .isatx-detail-summary::before {
        flex-shrink: 0;
    }

    .isatx-kpi-card.is-detail {
        padding: 11px;
    }

    .isatx-kpi-card.is-detail .isatx-kpi-label {
        margin-bottom: 3px;
        line-height: 1.45;
        white-space: normal;
        word-break: keep-all;
    }

    .isatx-chart-head {
        flex-direction: column;
        align-items: stretch;
    }

    .isatx-download-btn {
        width: 100%;
        justify-content: center;
    }

    .isatx-chart-wrap {
        height: 280px;
    }
}

@media (max-width: 768px) {
    .isatx-input-row {
        grid-template-columns: 1fr;
    }

    .isatx-btn-group {
        flex-direction: column;
    }

    .isatx-btn {
        width: 100%;
    }

    .isatx-fallback-table,
    .isatx-detail-table {
        min-width: 680px;
    }

    .isatx-chart-wrap {
        height: 250px;
    }

    .isatx-detail-summary {
        align-items: flex-start;
    }

    .isatx-detail-summary::before {
        margin-top: 1px;
    }

    .isatx-kpi-card.is-detail .isatx-kpi-value {
        font-size: 15px;
        line-height: 1.35;
        white-space: normal;
        word-break: keep-all;
    }
}

@media (max-width: 480px) {
    .isatx-section,
    .isatx-result-summary,
    .isatx-chart-section,
    .isatx-table-section {
        padding: 14px;
        border-radius: 10px;
    }

    .isatx-summary-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .isatx-kpi-card.is-core .isatx-kpi-value {
        font-size: 19px;
    }

    .isatx-kpi-value {
        font-size: 16px;
    }

    .isatx-compare-value {
        font-size: 16px;
    }

    .isatx-detail-summary {
        padding: 10px 11px;
        gap: 6px;
        font-size: 12px;
    }

    .isatx-detail-summary::before {
        width: 16px;
        height: 16px;
        font-size: 11px;
    }

    .isatx-detail-metrics {
        padding: 10px 11px 11px;
        gap: 8px;
    }

    .isatx-kpi-card.is-detail {
        padding: 10px;
    }

    .isatx-kpi-card.is-detail .isatx-kpi-label {
        font-size: 11px;
        line-height: 1.45;
    }

    .isatx-kpi-card.is-detail .isatx-kpi-value {
        font-size: 15px;
    }

    .isatx-amount-input,
    .isatx-number-input,
    .isatx-select,
    .isatx-btn {
        font-size: 14px;
    }

    .isatx-unit {
        min-width: 48px;
        padding: 0 8px;
        font-size: 11px;
    }

    .isatx-fallback-table,
    .isatx-detail-table {
        min-width: 620px;
    }

    .isatx-chart-wrap {
        height: 220px;
    }
}
