/* ============================================
   월급 실수령액 계산기 (Take-Home Pay Calculator)
   Prefix: thpc
   ============================================ */

/* Layout */
.thpc-main-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.thpc-input-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.thpc-result-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 20px;
    align-self: start;
}

/* Section */
.thpc-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
}

.thpc-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #5c5649;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.thpc-section-title i {
    color: #d4af37;
    font-size: 14px;
}

/* Tabs */
.thpc-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: #f5f3f0;
    border-radius: 8px;
    padding: 4px;
}

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

.thpc-tab.active {
    background: #fff;
    color: #2c2a25;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.thpc-tab:hover:not(.active) {
    color: #5c5649;
    background: rgba(255, 255, 255, 0.5);
}

/* Tab Content */
.thpc-tab-content {
    display: none;
}

.thpc-tab-content.active {
    display: block;
}

/* Tab content sections need margin since parent gap doesn't reach inside */
.thpc-tab-content .thpc-section + .thpc-section {
    margin-top: 14px;
}

/* Input Group */
.thpc-input-group {
    margin-bottom: 10px;
    max-width: 100%;
    box-sizing: border-box;
}

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

.thpc-input-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #8c8578;
    margin-bottom: 6px;
}

.thpc-label-hint {
    font-weight: 400;
    color: #b0a99c;
}

.thpc-amount-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 15px;
    font-weight: 600;
    color: #2c2a25;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    text-align: right;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.thpc-amount-input::placeholder {
    color: #ccc;
    font-weight: 400;
}

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

/* Select */
.thpc-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 13px;
    color: #2c2a25;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    cursor: pointer;
    appearance: auto;
}

.thpc-select:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* Input Row (side by side) */
.thpc-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Checkbox Group */
.thpc-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.thpc-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #5c5649;
    cursor: pointer;
}

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

.thpc-checkbox-item span {
    line-height: 1.3;
}

/* Nontax Total */
.thpc-nontax-total {
    font-size: 12px;
    color: #8c8578;
    text-align: right;
    padding-top: 8px;
    border-top: 1px solid #f0ede8;
    margin-top: 8px;
}

.thpc-nontax-total strong {
    color: #d4af37;
    font-weight: 600;
}

/* Withholding Options */
.thpc-withholding-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.thpc-withholding-btn {
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    color: #8c8578;
    cursor: pointer;
    transition: all 0.2s;
}

.thpc-withholding-btn.active {
    border-color: #d4af37;
    background: #fdf8ec;
    color: #d4af37;
    font-weight: 600;
}

.thpc-withholding-btn:hover:not(.active) {
    border-color: #ccc;
    background: #f5f3f0;
}

/* Hint */
.thpc-hint {
    font-size: 11px;
    color: #b0a99c;
    margin-top: 8px;
    line-height: 1.4;
}

/* Button Group */
.thpc-btn-group {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-top: 14px;
}

.thpc-calculate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #d4af37, #c4a030);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
}

.thpc-calculate-btn:hover {
    background: linear-gradient(135deg, #c4a030, #b4922a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

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

.thpc-reset-btn:hover {
    background: #ebe8e3;
}

/* Waiting */
.thpc-waiting {
    text-align: center;
    padding: 48px 20px;
    color: #b0a99c;
}

.thpc-waiting i {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
}

.thpc-waiting p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

/* Hidden */
.thpc-hidden {
    display: none !important;
}

/* Result Summary */
.thpc-result-summary {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.thpc-summary-title {
    font-size: 12px;
    font-weight: 500;
    color: #8c8578;
    margin-bottom: 4px;
}

.thpc-summary-main {
    font-size: 32px;
    font-weight: 700;
    color: #d4af37;
    margin-bottom: 4px;
}

.thpc-summary-main .thpc-unit {
    font-size: 16px;
    font-weight: 500;
    margin-left: 2px;
}

.thpc-summary-label {
    font-size: 11px;
    color: #b0a99c;
    margin-bottom: 16px;
}

.thpc-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
}

.thpc-summary-row + .thpc-summary-row {
    border-top: 1px solid #f5f3f0;
}

.thpc-summary-row-label {
    color: #8c8578;
}

.thpc-summary-row-value {
    font-weight: 600;
    color: #2c2a25;
}

/* Year Compare */
.thpc-year-compare {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
}

.thpc-compare-title {
    font-size: 13px;
    font-weight: 600;
    color: #5c5649;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.thpc-compare-title i {
    color: #d4af37;
    font-size: 14px;
}

.thpc-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.thpc-compare-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #faf9f7;
    border-radius: 6px;
    font-size: 12px;
}

.thpc-compare-label {
    color: #8c8578;
}

.thpc-compare-value {
    font-weight: 600;
    color: #2c2a25;
}

.thpc-compare-value.thpc-negative {
    color: #e74c3c;
}

.thpc-compare-value.thpc-positive {
    color: #27ae60;
}

.thpc-compare-total {
    grid-column: 1 / -1;
    background: #fdf8ec;
    border: 1px solid #f0e6c0;
}

.thpc-compare-total .thpc-compare-label {
    font-weight: 600;
    color: #5c5649;
}

/* Deduction Detail */
.thpc-deduction-detail {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
}

.thpc-deduction-table {
    display: flex;
    flex-direction: column;
}

.thpc-deduction-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    color: #5c5649;
}

.thpc-deduction-row + .thpc-deduction-row {
    border-top: 1px solid #f5f3f0;
}

.thpc-deduction-header {
    font-weight: 600;
    color: #8c8578;
    font-size: 12px;
    padding-bottom: 8px;
}

.thpc-deduction-subtotal {
    background: #faf9f7;
    padding: 8px 10px;
    margin: 4px -10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    color: #5c5649;
}

.thpc-deduction-grand {
    font-weight: 700;
    font-size: 14px;
    color: #d4af37;
    padding-top: 10px;
}

/* Chart */
.thpc-chart-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
}

.thpc-donut-wrap {
    position: relative;
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
}

.thpc-chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.thpc-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #5c5649;
}

.thpc-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.thpc-dot-net { background: #d4af37; }
.thpc-dot-insurance { background: #7ec8e3; }
.thpc-dot-tax { background: #e88e6a; }

/* Salary Table */
.thpc-salary-table {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
}

.thpc-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.thpc-table-header .thpc-section-title {
    margin-bottom: 0;
}

.thpc-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    background: #217346;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.thpc-download-btn:hover {
    background: #1a5c38;
}

.thpc-table-wrapper {
    overflow-x: auto;
}

.thpc-salary-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.thpc-salary-grid th {
    padding: 8px 10px;
    background: #faf9f7;
    font-weight: 600;
    color: #8c8578;
    text-align: right;
    white-space: nowrap;
}

.thpc-salary-grid th:first-child {
    text-align: left;
}

.thpc-salary-grid td {
    padding: 8px 10px;
    text-align: right;
    color: #5c5649;
    border-top: 1px solid #f5f3f0;
    white-space: nowrap;
}

.thpc-salary-grid td:first-child {
    text-align: left;
    font-weight: 500;
}

.thpc-salary-grid tr.thpc-highlight-row {
    background: #fdf8ec;
}

.thpc-salary-grid tr.thpc-highlight-row td {
    color: #d4af37;
    font-weight: 600;
}

/* Disclaimer */
.thpc-disclaimer {
    display: flex;
    gap: 8px;
    padding: 14px 16px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    font-size: 11px;
    color: #8c8578;
    line-height: 1.5;
}

.thpc-disclaimer i {
    color: #b0a99c;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.thpc-disclaimer p {
    margin: 0;
}

.thpc-disclaimer strong {
    color: #5c5649;
}

/* ==============================
   Mobile Responsive
   ============================== */

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

    .thpc-result-col {
        position: static;
    }

    .thpc-input-col {
        width: 100%;
    }

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

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

@media (max-width: 480px) {
    .thpc-main-layout {
        gap: 12px;
    }

    .thpc-section {
        padding: 14px;
        max-width: 100%;
        overflow: hidden;
    }

    .thpc-input-row {
        grid-template-columns: 1fr;
    }

    .thpc-compare-grid {
        grid-template-columns: 1fr;
    }

    .thpc-summary-main {
        font-size: 24px;
    }

    .thpc-result-summary,
    .thpc-year-compare,
    .thpc-deduction-detail,
    .thpc-chart-section,
    .thpc-salary-table {
        max-width: 100%;
        overflow: hidden;
    }

    .thpc-salary-grid th,
    .thpc-salary-grid td {
        padding: 6px 6px;
        font-size: 11px;
    }
}

/* 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;
}

