/**
 * Housing Pension Calculator Styles
 * 주택연금(역모기지) 계산기
 */

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

.hpgc-main-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}

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

.hpgc-result-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hpgc-section,
.hpgc-result-summary,
.hpgc-warning-box,
.hpgc-chart-section,
.hpgc-table-section,
.hpgc-disclaimer {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
    transition: box-shadow 0.2s ease;
}

.hpgc-section:hover,
.hpgc-result-summary:hover,
.hpgc-warning-box:hover,
.hpgc-chart-section:hover,
.hpgc-table-section:hover,
.hpgc-disclaimer:hover {
    box-shadow: 0 2px 8px rgba(45, 42, 38, 0.1);
}

.hpgc-section-title,
.hpgc-block-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    color: #2d2a26;
    font-size: 14px;
    font-weight: 700;
}

.hpgc-section-title i,
.hpgc-block-title i {
    color: #d4af37;
    font-size: 15px;
}


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

.hpgc-input-group {
    margin-bottom: 12px;
    max-width: 100%;
    box-sizing: border-box;
}

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

.hpgc-input-label {
    display: block;
    margin-bottom: 6px;
    color: #5f5a56;
    font-size: 12px;
    font-weight: 500;
}

.hpgc-number-input,
.hpgc-amount-input,
.hpgc-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    color: #2d2a26;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.hpgc-number-input,
.hpgc-amount-input {
    padding: 10px 12px;
    font-size: 14px;
}

.hpgc-amount-input {
    text-align: right;
    font-weight: 600;
}

.hpgc-select {
    padding: 10px 32px 10px 12px;
    font-size: 13px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%235f5a56' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.hpgc-number-input:hover,
.hpgc-amount-input:hover,
.hpgc-select:hover {
    border-color: #d4c67a;
}

.hpgc-number-input:focus,
.hpgc-amount-input:focus,
.hpgc-select:focus {
    outline: none;
    border-color: #d4af37;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.hpgc-number-input::placeholder,
.hpgc-amount-input::placeholder {
    color: #c4c0bc;
    font-weight: 400;
}

.hpgc-korean-amount {
    margin-top: 4px;
    min-height: 16px;
    color: #d4af37;
    font-size: 11px;
    text-align: right;
}

.hpgc-hint {
    margin-top: 4px;
    color: #9e9a96;
    font-size: 11px;
    line-height: 1.45;
}

.hpgc-info-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    padding: 4px 10px;
    border: 1px solid #eadfbf;
    border-radius: 999px;
    color: #7b6430;
    background: #fdf7e8;
    font-size: 11px;
    font-weight: 700;
}

.hpgc-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.hpgc-check-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.hpgc-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    color: #5f5a56;
    font-size: 12px;
    line-height: 1.4;
}

.hpgc-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    accent-color: #d4af37;
}

.hpgc-metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.hpgc-mini-card {
    padding: 10px;
    border: 1px solid #efe8d6;
    border-radius: 8px;
    background: #fdfbf5;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hpgc-mini-label {
    color: #8c8578;
    font-size: 11px;
    font-weight: 600;
}

.hpgc-mini-value {
    color: #2d2a26;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.hpgc-btn-group {
    display: flex;
    gap: 8px;
}

.hpgc-calculate-btn {
    flex: 1;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    background: linear-gradient(135deg, #d4af37 0%, #c89f2f 100%);
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.hpgc-reset-btn {
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    padding: 12px 16px;
    background: #f5f3f0;
    color: #5f5a56;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.hpgc-reset-btn:hover {
    background: #ece8e1;
}

.hpgc-waiting {
    text-align: center;
    padding: 40px 20px;
    color: #9e9a96;
}

.hpgc-waiting i {
    display: block;
    margin-bottom: 12px;
    color: #d4af37;
    opacity: 0.4;
    font-size: 32px;
}

.hpgc-waiting p {
    margin: 0;
    font-size: 13px;
}

.hpgc-result-summary {
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    border-color: #eadfbf;
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.12);
}

.hpgc-summary-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f0e6c8;
    color: #7b6430;
    font-size: 11px;
    font-weight: 700;
}

.hpgc-summary-title {
    margin-bottom: 4px;
    color: #7a6f56;
    font-size: 12px;
    font-weight: 600;
}

.hpgc-summary-main {
    color: #2d2a26;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.hpgc-summary-sub {
    margin-top: 6px;
    color: #8a846d;
    font-size: 12px;
    line-height: 1.45;
}

.hpgc-summary-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.hpgc-summary-item {
    padding: 10px 12px;
    border: 1px solid #ede6d2;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.75);
}

.hpgc-summary-item.is-kpi {
    border-color: #e6d6a5;
    background: #fffdf5;
}

.hpgc-summary-label {
    color: #7a7362;
    font-size: 12px;
    font-weight: 600;
}

.hpgc-summary-value {
    margin-top: 4px;
    color: #2d2a26;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}

.hpgc-summary-item.is-kpi .hpgc-summary-value {
    color: #b58913;
    font-size: 22px;
}

.hpgc-summary-desc {
    margin-top: 3px;
    color: #9b9383;
    font-size: 11px;
    line-height: 1.4;
}

.hpgc-warning-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-color: #f5d8ad;
    background: #fff9f0;
    color: #9f5e0b;
    font-size: 12px;
    line-height: 1.5;
}

.hpgc-warning-box i {
    color: #d98b1d;
    flex-shrink: 0;
    margin-top: 2px;
}

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

.hpgc-chart-card {
    border: 1px solid #ece6d8;
    border-radius: 10px;
    padding: 12px;
    background: #fcfbf8;
}

.hpgc-chart-title {
    color: #5f5a56;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.hpgc-chart-canvas-wrap {
    position: relative;
    width: 100%;
    min-height: 240px;
}

.hpgc-chart-canvas-wrap canvas {
    width: 100% !important;
    height: 240px !important;
}

.hpgc-chart-fallback {
    margin-top: 10px;
    border: 1px dashed #dfd8c8;
    border-radius: 8px;
    padding: 10px;
    color: #7b756a;
    font-size: 12px;
    line-height: 1.55;
    background: #fffdf8;
}

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

.hpgc-download-btn {
    border: 1px solid #3f9962;
    border-radius: 8px;
    padding: 8px 11px;
    background: linear-gradient(135deg, #4ea870 0%, #3f9962 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(63, 153, 98, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hpgc-download-btn:hover {
    background: linear-gradient(135deg, #459f68 0%, #368956 100%);
    box-shadow: 0 4px 12px rgba(54, 137, 86, 0.34);
    transform: translateY(-1px);
}

.hpgc-table-wrap {
    overflow-x: auto;
}

.hpgc-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 12px;
}

.hpgc-table th,
.hpgc-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #f0ece3;
    text-align: right;
    white-space: nowrap;
}

.hpgc-table th:first-child,
.hpgc-table td:first-child,
.hpgc-table th:last-child,
.hpgc-table td:last-child {
    text-align: left;
}

.hpgc-table thead th {
    color: #5f5a56;
    font-size: 11px;
    font-weight: 700;
    background: #f9f6ee;
}

.hpgc-table tbody tr:nth-child(even) {
    background: #fcfbf8;
}

.hpgc-table tbody tr.is-focus {
    background: #fff8e8;
}

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

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

@media (max-width: 1100px) {
    .hpgc-main-layout {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 900px) {
    .hpgc-input-col,
    .hpgc-result-col,
    .hpgc-section,
    .hpgc-result-summary,
    .hpgc-warning-box,
    .hpgc-chart-section,
    .hpgc-table-section,
    .hpgc-disclaimer {
        max-width: 100%;
        box-sizing: border-box;
    }

    .hpgc-number-input:not([type="radio"]):not([type="checkbox"]),
    .hpgc-amount-input:not([type="radio"]):not([type="checkbox"]),
    .hpgc-select {
        width: 100% !important;
        max-width: 100% !important;
    }

    .hpgc-input-grid,
    .hpgc-check-grid,
    .hpgc-chart-grid,
    .hpgc-summary-grid {
        grid-template-columns: 1fr;
    }

    .hpgc-chart-canvas-wrap,
    .hpgc-chart-canvas-wrap canvas {
        min-height: 220px;
        height: 220px !important;
    }
}

@media (max-width: 480px) {
    .hpgc-main-layout,
    .hpgc-input-col,
    .hpgc-result-col,
    .hpgc-section,
    .hpgc-result-summary,
    .hpgc-warning-box,
    .hpgc-chart-section,
    .hpgc-table-section,
    .hpgc-disclaimer {
        max-width: 100%;
        overflow-x: hidden;
    }

    .hpgc-section,
    .hpgc-result-summary,
    .hpgc-warning-box,
    .hpgc-chart-section,
    .hpgc-table-section,
    .hpgc-disclaimer {
        padding: 14px;
    }

    .hpgc-summary-main {
        font-size: 28px;
    }

    .hpgc-summary-value {
        font-size: 16px;
    }

    .hpgc-summary-item.is-kpi .hpgc-summary-value {
        font-size: 19px;
    }

    .hpgc-btn-group {
        flex-direction: column;
        gap: 8px;
    }

    .hpgc-reset-btn,
    .hpgc-calculate-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hpgc-section,
    .hpgc-result-summary,
    .hpgc-warning-box,
    .hpgc-chart-section,
    .hpgc-table-section,
    .hpgc-disclaimer,
    .hpgc-number-input,
    .hpgc-amount-input,
    .hpgc-select,
    .hpgc-calculate-btn,
    .hpgc-download-btn,
    .hpgc-reset-btn {
        transition: none !important;
    }

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

/* Excel button guard */
.tool-btn-excel {
  background: #59ab79;
  border-color: #59ab79;
}

.tool-btn-excel:hover,
.tool-btn-excel:focus-visible {
  background: #4f9f70;
  border-color: #4f9f70;
}

