/* ==========================================
   연봉 실수령액 계산기 - 관공서 스타일 (Clean & Official)
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
    --bg-page: #f4f6f9;
    --bg-white: #ffffff;
    --bg-section: #f9fafc;
    --bg-highlight: #eef3fb;
    --border-light: #dde3ec;
    --border-medium: #c5cdd9;
    --text-primary: #1a1e2c;
    --text-secondary: #4a5068;
    --text-muted: #8891a5;
    --text-label: #5c6478;
    --primary: #1a56db;
    --primary-dark: #1544b0;
    --primary-light: #e8eefb;
    --primary-lighter: #f0f4ff;
    --accent-blue: #2563eb;
    --accent-green: #0d7c3d;
    --accent-green-bg: #ecfdf5;
    --accent-red: #c62828;
    --accent-red-bg: #fef2f2;
    --accent-orange: #c77c14;
    --accent-orange-bg: #fffbeb;
    --accent-purple: #6d28d9;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* ---- Top Accent Bar ---- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent-blue), var(--primary));
    z-index: 100;
}

/* ---- No Orbs in Official Style ---- */
.orb {
    display: none;
}

/* ---- Container ---- */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 20px 16px 50px;
}

/* ---- Header / Hero ---- */
.hero {
    text-align: center;
    padding: 48px 20px 32px;
}

.hero h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.hero .subtitle {
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    color: var(--text-secondary);
    font-weight: 400;
}

.hero .year-badge {
    display: inline-block;
    margin-top: 14px;
    padding: 5px 16px;
    background: var(--primary-light);
    border: 1px solid rgba(26, 86, 219, 0.2);
    border-radius: 20px;
    font-size: 0.82rem;
    color: var(--primary);
    font-weight: 500;
}

/* ---- Card ---- */
.glass-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
}

.glass-card .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.glass-card .card-title .icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.glass-card .card-title .icon.blue {
    background: var(--primary-light);
}

.glass-card .card-title .icon.purple {
    background: #f3f0ff;
}

.glass-card .card-title .icon.pink {
    background: var(--accent-red-bg);
}

.glass-card .card-title .icon.green {
    background: var(--accent-green-bg);
}

/* ---- Mode Toggle ---- */
.mode-toggle {
    display: flex;
    background: var(--bg-section);
    border-radius: var(--radius);
    padding: 3px;
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
}

.mode-toggle button {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
}

.mode-toggle button.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.mode-toggle button:not(.active):hover {
    background: var(--bg-highlight);
    color: var(--text-primary);
}

/* ---- Input Group ---- */
.input-group {
    margin-bottom: 8px;
}

.input-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-label);
    margin-bottom: 6px;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 60px 14px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    font-family: 'Noto Sans KR', sans-serif;
    outline: none;
    transition: var(--transition);
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.95rem;
}

.input-wrapper .unit {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    pointer-events: none;
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
    margin-bottom: 18px;
}

/* ---- Calculate Button ---- */
.btn-calculate {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Noto Sans KR', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}

.btn-calculate:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-calculate:active {
    transform: translateY(1px);
}

/* ---- Results Section ---- */
.result-section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Summary Box ---- */
.summary-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.summary-item {
    background: var(--bg-section);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border-light);
}

.summary-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.summary-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
}

.summary-item .value.accent {
    color: var(--accent-blue);
}

.summary-item .value.pink {
    color: var(--accent-red);
}

.summary-item .value.green {
    color: var(--accent-green);
}

.summary-item .value.purple {
    color: var(--primary);
}

.summary-item .sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ---- Deduction Chart ---- */
.deduction-chart {
    margin-bottom: 20px;
}

.chart-bar-container {
    height: 10px;
    background: var(--bg-section);
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    margin-bottom: 14px;
    border: 1px solid var(--border-light);
}

.chart-bar-segment {
    height: 100%;
    transition: width 0.6s ease;
}

.chart-bar-segment:first-child {
    border-radius: 5px 0 0 5px;
}

.chart-bar-segment:last-child {
    border-radius: 0 5px 5px 0;
}

.chart-bar-segment.net {
    background: var(--primary);
}

.chart-bar-segment.pension {
    background: #6366f1;
}

.chart-bar-segment.health {
    background: #0891b2;
}

.chart-bar-segment.ltc {
    background: #059669;
}

.chart-bar-segment.employ {
    background: #d97706;
}

.chart-bar-segment.income-tax {
    background: #dc2626;
}

.chart-bar-segment.local-tax {
    background: #ea580c;
}

/* ---- Deduction Table ---- */
.deduction-table {
    width: 100%;
}

.deduction-row {
    display: flex;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid #f0f2f5;
}

.deduction-row:last-child {
    border-bottom: none;
}

.deduction-row .dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 10px;
    flex-shrink: 0;
}

.deduction-row .dot.pension {
    background: #6366f1;
}

.deduction-row .dot.health {
    background: #0891b2;
}

.deduction-row .dot.ltc {
    background: #059669;
}

.deduction-row .dot.employ {
    background: #d97706;
}

.deduction-row .dot.income-tax {
    background: #dc2626;
}

.deduction-row .dot.local-tax {
    background: #ea580c;
}

.deduction-row .name {
    flex: 1;
    font-size: 0.87rem;
    color: var(--text-secondary);
}

.deduction-row .amount {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    min-width: 100px;
    font-variant-numeric: tabular-nums;
}

.deduction-row .rate {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-align: right;
    min-width: 48px;
    margin-left: 8px;
    font-variant-numeric: tabular-nums;
}

.deduction-row.total {
    border-top: 2px solid var(--border-light);
    border-bottom: none;
    margin-top: 6px;
    padding-top: 14px;
}

.deduction-row.total .name {
    font-weight: 600;
    color: var(--text-primary);
}

.deduction-row.total .amount {
    font-size: 1rem;
    color: var(--accent-red);
    font-weight: 700;
}

/* ---- Net Pay Highlight ---- */
.net-pay-highlight {
    background: var(--primary-lighter);
    border: 1px solid rgba(26, 86, 219, 0.15);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    position: relative;
}

.net-pay-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.net-pay-highlight .net-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.net-pay-highlight .net-value {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

.net-pay-highlight .net-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ---- Share Button ---- */
.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: 'Noto Sans KR', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.btn-share:hover {
    background: var(--bg-section);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.btn-share.copied {
    background: var(--accent-green-bg);
    border-color: rgba(13, 124, 61, 0.2);
    color: var(--accent-green);
}

/* ---- Quick Links ---- */
.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.quick-link {
    padding: 6px 14px;
    background: var(--bg-section);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-decoration: none;
    transition: var(--transition);
    font-family: 'Noto Sans KR', sans-serif;
}

.quick-link:hover {
    background: var(--primary-light);
    border-color: rgba(26, 86, 219, 0.2);
    color: var(--primary);
}

/* ---- Info Section ---- */
.info-section {
    margin-top: 8px;
}

.info-section h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.info-section h3 {
    font-size: 0.92rem;
    font-weight: 600;
    margin: 18px 0 8px;
    color: var(--text-primary);
}

.info-section p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 10px;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section ul li {
    font-size: 0.84rem;
    color: var(--text-secondary);
    padding: 4px 0 4px 16px;
    position: relative;
    line-height: 1.7;
}

.info-section ul li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* ---- Comparison Table ---- */
.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    font-variant-numeric: tabular-nums;
}

.compare-table thead th {
    text-align: center;
    padding: 10px 8px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-label);
    background: var(--bg-section);
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

.compare-table thead th:first-child {
    text-align: left;
    border-radius: var(--radius) 0 0 0;
}

.compare-table thead th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.compare-table tbody td {
    text-align: right;
    padding: 10px 8px;
    color: var(--text-secondary);
    border-bottom: 1px solid #f0f2f5;
    white-space: nowrap;
}

.compare-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
}

.compare-table tbody tr:hover {
    background: var(--bg-highlight);
}

.compare-table tbody tr.current-row {
    background: var(--primary-lighter);
    font-weight: 600;
}

.compare-table tbody tr.current-row td {
    color: var(--primary);
    font-weight: 600;
}

.compare-table tbody tr.current-row td:first-child::before {
    content: '▸ ';
    color: var(--primary);
}

.compare-table tbody tr:last-child td {
    border-bottom: none;
}

.compare-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
    padding: 0 8px;
}

.compare-table .col-deduction {
    color: var(--accent-red);
}

.compare-table .col-net {
    color: var(--accent-green);
    font-weight: 600;
}

.compare-table tbody tr.current-row .col-net {
    color: var(--primary-dark);
}

@media (max-width: 640px) {
    .compare-table {
        font-size: 0.76rem;
    }

    .compare-table thead th,
    .compare-table tbody td {
        padding: 8px 5px;
    }

    .compare-table .col-hide-mobile {
        display: none;
    }
}

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 32px 20px 24px;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border-light);
    margin-top: 20px;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer a:hover {
    color: var(--primary);
}

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 10px 22px;
    background: var(--text-primary);
    border-radius: var(--radius);
    color: #ffffff;
    font-size: 0.85rem;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .container {
        padding: 12px 10px 36px;
    }

    .hero {
        padding: 36px 12px 20px;
    }

    .glass-card {
        padding: 20px 16px;
        border-radius: var(--radius);
    }

    .summary-box {
        gap: 8px;
    }

    .summary-item {
        padding: 12px 8px;
    }

    .summary-item .value {
        font-size: 1rem;
    }

    .input-wrapper input {
        font-size: 1.1rem;
        padding: 12px 55px 12px 14px;
    }

    .deduction-row .rate {
        display: none;
    }

    .mode-toggle button {
        padding: 10px 8px;
        font-size: 0.82rem;
    }

    .quick-links {
        justify-content: center;
    }
}

@media (max-width: 380px) {
    .summary-box {
        grid-template-columns: 1fr;
    }
}

/* ---- Print ---- */
@media print {
    body::before {
        display: none;
    }

    .glass-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .mode-toggle,
    .btn-calculate,
    .btn-share,
    .quick-links {
        display: none;
    }
}