/**
 * Capital Gains Tax Calculator Styles
 * 양도소득세 계산기 전용 스타일
 * HTML 구조: tool-layout-split > tool-input-panel + tool-result-panel
 *
 * 2026년 1월 기준 세법 적용
 * - 기본세율: 6%~45% 누진세율
 * - 장기보유특별공제: 최대 80% (1세대 1주택)
 * - 1세대 1주택 비과세: 12억원 초과분만 과세
 * - 다주택 중과: 2026.5.9까지 유예
 *
 * @package Zipper
 */

/* ===== 자산 유형 탭 (4개 → 2x2 Grid) ===== */
.cgt-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: #f5f3f0;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
}

.cgt-tab-btn {
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #7a756d;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
}

.cgt-tab-btn:hover {
    color: #2d2a26;
    background: rgba(255, 255, 255, 0.5);
}

.cgt-tab-btn.active {
    color: #fff;
    background: #d4af37;
    box-shadow: 0 2px 4px rgba(212, 175, 55, 0.3);
}

/* ===== 입력 섹션 ===== */
.cgt-input-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cgt-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cgt-input-group label {
    font-size: 13px;
    font-weight: 600;
    color: #5f5a56;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cgt-input-group label .cgt-optional {
    font-size: 11px;
    font-weight: 400;
    color: #a09a94;
}

.cgt-input-group input,
.cgt-input-group select {
    padding: 11px 12px;
    font-size: 15px;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #faf9f7;
    color: #2d2a26;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

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

.cgt-input-group input::placeholder {
    color: #a09a94;
}

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

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

/* 접이식 섹션 */
.cgt-collapsible {
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    overflow: hidden;
}

.cgt-collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #faf9f7;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.cgt-collapsible-header:hover {
    background: #f5f3f0;
}

.cgt-collapsible-title {
    font-size: 13px;
    font-weight: 600;
    color: #5f5a56;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cgt-collapsible-title i {
    color: #d4af37;
}

.cgt-collapsible-toggle {
    font-size: 12px;
    color: #a09a94;
    transition: transform 0.2s;
}

.cgt-collapsible.open .cgt-collapsible-toggle {
    transform: rotate(180deg);
}

.cgt-collapsible-content {
    display: none;
    padding: 12px;
    border-top: 1px solid #e8e4dc;
}

.cgt-collapsible.open .cgt-collapsible-content {
    display: block;
}

/* 체크박스 스타일 */
.cgt-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cgt-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #5f5a56;
}

.cgt-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #d4af37;
    cursor: pointer;
}

/* 라디오 그룹 */
.cgt-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cgt-radio-btn {
    flex: 1;
    min-width: calc(50% - 4px);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #5f5a56;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.cgt-radio-btn:hover {
    border-color: #d4af37;
    background: #fff;
}

.cgt-radio-btn.active {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.08);
    border-color: #d4af37;
    font-weight: 600;
}

/* 계산 버튼 */
.cgt-calc-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

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

.cgt-calc-btn:active {
    transform: translateY(0);
}

/* 도움말 텍스트 */
.cgt-help-text {
    font-size: 11px;
    color: #a09a94;
    margin: 0;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.cgt-help-text i {
    flex-shrink: 0;
    margin-top: 1px;
}

/* 숨김 */
.cgt-hidden {
    display: none !important;
}

/* ===== 대기 상태 ===== */
.cgt-waiting {
    text-align: center;
    padding: 40px 20px;
    color: #a09a94;
}

.cgt-waiting > i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    color: #d4af37;
}

.cgt-waiting > p {
    font-size: 14px;
    margin-bottom: 16px;
}

.cgt-waiting-guide {
    text-align: left;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    padding: 14px;
}

.cgt-waiting-guide .guide-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cgt-waiting-guide .guide-title i {
    color: #d4af37;
}

.cgt-waiting-guide ul {
    margin: 0;
    padding-left: 18px;
}

.cgt-waiting-guide li {
    font-size: 12px;
    color: #5f5a56;
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ===== 메인 결과 ===== */
.cgt-main-result {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12) 0%, rgba(184, 134, 11, 0.05) 100%);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.cgt-main-label {
    font-size: 14px;
    color: #7a756d;
    margin-bottom: 8px;
}

.cgt-main-value {
    font-size: 44px;
    font-weight: 700;
    color: #d4af37;
    line-height: 1;
    margin-bottom: 4px;
}

.cgt-main-value .unit {
    font-size: 20px;
    font-weight: 600;
    color: #b8860b;
    margin-left: 4px;
}

.cgt-effective-rate {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    color: #b8860b;
    background: rgba(212, 175, 55, 0.15);
    margin-top: 8px;
}

/* 비과세 알림 */
.cgt-tax-exempt {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.12) 0%, rgba(46, 204, 113, 0.05) 100%);
    border: 1px solid rgba(46, 204, 113, 0.35);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.cgt-tax-exempt .cgt-main-label {
    color: #27ae60;
}

.cgt-tax-exempt .cgt-main-value {
    color: #27ae60;
    font-size: 36px;
}

.cgt-tax-exempt-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #27ae60;
    background: rgba(46, 204, 113, 0.15);
    margin-top: 10px;
}

.cgt-tax-exempt-badge i {
    font-size: 16px;
}

/* ===== 세부 결과 그리드 ===== */
.cgt-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.cgt-result-card {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.cgt-result-card:hover {
    border-color: #d4af37;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.12);
}

.cgt-result-card.full-width {
    grid-column: span 2;
}

.cgt-result-label {
    font-size: 12px;
    font-weight: 600;
    color: #7a756d;
    margin-bottom: 6px;
}

.cgt-result-value {
    font-size: 22px;
    font-weight: 700;
    color: #2d2a26;
}

.cgt-result-value .unit {
    font-size: 13px;
    font-weight: 500;
    color: #7a756d;
}

.cgt-result-value.highlight {
    color: #d4af37;
}

.cgt-result-value.negative {
    color: #e74c3c;
}

.cgt-result-sub {
    font-size: 11px;
    color: #a09a94;
    margin-top: 4px;
}

/* ===== 계산 단계 ===== */
.cgt-steps-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.cgt-steps-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cgt-steps-title i {
    color: #d4af37;
}

.cgt-step {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px dashed #f0ede8;
}

.cgt-step:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cgt-step-num {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 12px;
}

.cgt-step-content {
    flex: 1;
}

.cgt-step-label {
    font-size: 13px;
    font-weight: 600;
    color: #5f5a56;
    margin-bottom: 4px;
}

.cgt-step-formula {
    font-size: 12px;
    color: #a09a94;
    margin-bottom: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.cgt-step-value {
    font-size: 16px;
    font-weight: 700;
    color: #2d2a26;
}

.cgt-step-value.highlight {
    color: #d4af37;
}

/* ===== 세율표 섹션 ===== */
.cgt-rate-table-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.cgt-rate-table-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cgt-rate-table-title i {
    color: #d4af37;
}

.cgt-rate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cgt-rate-table th,
.cgt-rate-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #f0ede8;
}

.cgt-rate-table th {
    background: #faf9f7;
    font-weight: 600;
    color: #5f5a56;
    font-size: 12px;
}

.cgt-rate-table td {
    color: #2d2a26;
}

.cgt-rate-table tr:last-child td {
    border-bottom: none;
}

.cgt-rate-table tr.current {
    background: rgba(212, 175, 55, 0.1);
}

.cgt-rate-table tr.current td {
    font-weight: 600;
    color: #d4af37;
}

.cgt-rate-table .range {
    text-align: left;
}

/* ===== 장기보유특별공제 안내 ===== */
.cgt-ltc-section {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.08) 0%, rgba(52, 152, 219, 0.02) 100%);
    border: 1px solid rgba(52, 152, 219, 0.25);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.cgt-ltc-title {
    font-size: 14px;
    font-weight: 600;
    color: #3498db;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cgt-ltc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cgt-ltc-item {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.cgt-ltc-label {
    font-size: 12px;
    color: #5f5a56;
    margin-bottom: 4px;
}

.cgt-ltc-value {
    font-size: 20px;
    font-weight: 700;
    color: #3498db;
}

.cgt-ltc-total {
    grid-column: span 2;
    background: rgba(52, 152, 219, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
}

.cgt-ltc-total-label {
    font-size: 13px;
    font-weight: 600;
    color: #3498db;
}

.cgt-ltc-total-value {
    font-size: 22px;
    font-weight: 700;
    color: #3498db;
}

/* ===== 중과세 경고 ===== */
.cgt-surtax-warning {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.08) 0%, rgba(231, 76, 60, 0.02) 100%);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.cgt-surtax-title {
    font-size: 14px;
    font-weight: 600;
    color: #e74c3c;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cgt-surtax-info {
    font-size: 13px;
    color: #5f5a56;
    line-height: 1.6;
}

.cgt-surtax-info strong {
    color: #e74c3c;
}

/* ===== 유예 기간 안내 ===== */
.cgt-grace-period {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.08) 0%, rgba(46, 204, 113, 0.02) 100%);
    border: 1px solid rgba(46, 204, 113, 0.25);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.cgt-grace-title {
    font-size: 14px;
    font-weight: 600;
    color: #27ae60;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cgt-grace-info {
    font-size: 13px;
    color: #5f5a56;
    line-height: 1.6;
}

.cgt-grace-date {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(46, 204, 113, 0.15);
    border-radius: 4px;
    color: #27ae60;
    font-weight: 600;
}

/* ===== 안내문 ===== */
.cgt-notice {
    text-align: center;
    padding: 12px;
    background: #faf9f7;
    border-radius: 8px;
}

.cgt-notice p {
    font-size: 12px;
    color: #a09a94;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cgt-notice i {
    color: #d4af37;
}

/* ===== 지방소득세 ===== */
.cgt-local-tax {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cgt-local-tax-label {
    font-size: 13px;
    color: #5f5a56;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cgt-local-tax-label i {
    color: #a09a94;
}

.cgt-local-tax-value {
    font-size: 18px;
    font-weight: 700;
    color: #2d2a26;
}

.cgt-local-tax-value .unit {
    font-size: 12px;
    font-weight: 500;
    color: #7a756d;
}

/* ===== 총 납부세액 ===== */
.cgt-total-tax {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.08) 0%, rgba(155, 89, 182, 0.02) 100%);
    border: 1px solid rgba(155, 89, 182, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cgt-total-tax-label {
    font-size: 15px;
    font-weight: 600;
    color: #9b59b6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cgt-total-tax-value {
    font-size: 26px;
    font-weight: 700;
    color: #9b59b6;
}

.cgt-total-tax-value .unit {
    font-size: 14px;
    font-weight: 500;
}

/* ===== 반응형 - 태블릿 ===== */
@media (max-width: 900px) {
    .cgt-ltc-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cgt-results-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ===== 반응형 - 모바일 ===== */
@media (max-width: 768px) {
    .cgt-main-result {
        padding: 20px 16px;
    }

    .cgt-main-value {
        font-size: 36px;
    }

    .cgt-main-value .unit {
        font-size: 16px;
    }

    .cgt-results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .cgt-result-value {
        font-size: 18px;
    }

    .cgt-rate-table {
        font-size: 12px;
    }

    .cgt-rate-table th,
    .cgt-rate-table td {
        padding: 8px 4px;
    }

    .cgt-input-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .cgt-input-row-3 {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .cgt-total-tax {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .cgt-local-tax {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
}

/* ===== 반응형 - 작은 모바일 ===== */
@media (max-width: 480px) {
    .cgt-tab-btn {
        padding: 8px 6px;
        font-size: 11px;
    }

    .cgt-main-value {
        font-size: 30px;
    }

    .cgt-main-value .unit {
        font-size: 14px;
    }

    .cgt-results-grid {
        grid-template-columns: 1fr;
    }

    .cgt-result-card.full-width {
        grid-column: span 1;
    }

    .cgt-radio-btn {
        min-width: calc(50% - 4px);
        padding: 8px 8px;
        font-size: 12px;
    }

    .cgt-ltc-grid {
        grid-template-columns: 1fr;
    }

    .cgt-ltc-total {
        grid-column: span 1;
        flex-direction: column;
        gap: 6px;
    }

    .cgt-step {
        flex-direction: column;
    }

    .cgt-step-num {
        margin-bottom: 8px;
        margin-right: 0;
    }
}
