:root {
    /* Color Palette */
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;

    --bg-color: #F8FAFC;
    --panel-bg: rgba(255, 255, 255, 0.7);
    --panel-border: rgba(255, 255, 255, 0.4);

    --text-main: #0F172A;
    --text-muted: #64748B;
    --text-light: #94A3B8;

    --danger: #EF4444;
    --success: #10B981;

    /* Typography */
    --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    overflow: hidden;
}

.background-animation::before,
.background-animation::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.background-animation::before {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #c7d2fe;
    animation-delay: 0s;
}

.background-animation::after {
    bottom: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: #ddd6fe;
    animation-direction: alternate-reverse;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(5%, 10%) scale(1.1);
    }
}

/* Layout */
.app-container {
    width: 100%;
    max-width: 1100px;
    padding: 2rem;
    margin: 0 auto;
    z-index: 1;
}

.app-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.header-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    display: inline-block;
}

.app-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header p {
    color: var(--text-muted);
    font-size: 1.125rem;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
}

.glass-panel:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.1);
    transform: translateY(-2px);
}

/* Form Styles */
.input-group {
    margin-bottom: 1.75rem;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.input-header label {
    margin-bottom: 0;
}

/* Segmented Control Toggle */
.segmented-control {
    position: relative;
    display: inline-flex;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 0.25rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control label {
    position: relative;
    z-index: 1;
    padding: 0.35rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s ease;
    margin-bottom: 0 !important;
    /* Override .input-group label */
}

.segmented-control input[type="radio"]:checked+label {
    color: var(--primary-dark);
}

.segmented-control-bg {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    bottom: 0.25rem;
    width: calc(50% - 0.25rem);
    /* half width minus padding */
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

#type-monthly:checked~.segmented-control-bg {
    transform: translateX(100%);
}

.tooltip-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: help;
}

.tooltip-container i {
    color: var(--text-light);
    font-size: 1.125rem;
    transition: color 0.2s;
    width: 1.25rem;
    height: 1.25rem;
}

.tooltip-container:hover i {
    color: var(--primary);
}

/* Custom CSS Tooltip */
.tooltip-container::after,
.tooltip-container::before {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 50;
}

/* Tooltip Body */
.tooltip-container::after {
    content: attr(data-tooltip);
    top: 50%;
    left: calc(100% + 10px);
    transform: translateY(-50%) translateX(-5px);
    width: max-content;
    max-width: 250px;
    background: rgba(15, 23, 42, 0.95);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-family);
    line-height: 1.4;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    text-align: left;
    white-space: normal;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Tooltip Arrow */
.tooltip-container::before {
    content: '';
    top: 50%;
    left: calc(100% + 4px);
    transform: translateY(-50%) translateX(-5px);
    border-width: 6px;
    border-style: solid;
    border-color: transparent rgba(15, 23, 42, 0.95) transparent transparent;
}

/* Hover States */
.tooltip-container:hover::after,
.tooltip-container:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

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

input[type="text"] {
    width: 100%;
    padding: 1.125rem 3rem 1.125rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    outline: none;
    transition: var(--transition);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

input[type="text"]:focus {
    background: #ffffff;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

input[type="text"]::placeholder {
    color: var(--text-light);
}

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

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

select {
    width: 100%;
    padding: 1.125rem 3rem 1.125rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

select:focus {
    background: #ffffff;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.select-wrapper i {
    position: absolute;
    right: 1.5rem;
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1.25rem;
}

.disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 12px;
    color: #B45309;
    font-size: 0.875rem;
    line-height: 1.5;
}

.disclaimer i {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* Result Section Styles */
.result-section {
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.state-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    animation: fadeIn 0.4s ease;
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.state-container p {
    line-height: 1.6;
    font-size: 1.05rem;
}

.state-container.hidden,
.result-content.hidden {
    display: none;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result Content */
.result-content {
    animation: fadeIn 0.5s ease;
}

.result-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.result-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.net-salary-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
    color: var(--primary);
}

.net-salary-display .amount {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
}

.net-salary-display .unit {
    font-size: 1.5rem;
    font-weight: 600;
}

.deduction-summary {
    display: flex;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-item.highlight .value {
    color: var(--danger);
}

.summary-item .label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.summary-item .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.breakdown-container h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breakdown-container h3 span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.breakdown-list {
    list-style: none;
    margin-bottom: 1.5rem;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.breakdown-list li:last-child {
    border-bottom: none;
}

.breakdown-list li span:last-child {
    font-weight: 600;
    color: var(--text-main);
}

.divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 1.5rem 0;
}

/* Insight Box */
.insight-box {
    margin-top: 2rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(79, 70, 229, 0.1));
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: 16px;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.insight-box i {
    font-size: 1.75rem;
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.insight-content h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
}

.insight-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.insight-content strong {
    color: var(--primary);
    font-weight: 700;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* =========================================
   SEO Content & Footer Styles
   ========================================= */

.seo-content {
    margin-top: 2rem;
    padding: 2rem;
    grid-column: 1 / -1;
}

.seo-content header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(79, 70, 229, 0.1);
    padding-bottom: 0.5rem;
}

.seo-content h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 1.5rem 0 0.5rem 0;
}

.seo-content p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.seo-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.seo-content li {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

/* Footer */
.app-footer {
    width: 100%;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

.footer-links {
    margin-top: 1rem;
}

.footer-links a {
    color: var(--primary-light);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}

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

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Content */
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    padding: 2rem;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--danger);
}

.modal-body h3 {
    font-size: 1.05rem;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
}

.modal-body p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.modal-body ul {
    margin-left: 1.2rem;
}

.modal-body li {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.modal-body a {
    color: var(--primary);
    text-decoration: underline;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

/* Responsive */
@media (max-width: 900px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }

    .app-container {
        padding: 1rem;
        padding-top: 2rem;
    }

    .glass-panel {
        padding: 1.5rem;
    }

    .result-section {
        min-height: auto;
    }

    .net-salary-display .amount {
        font-size: 2.75rem;
    }

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