/* =========================================
   Korean Salary Calculator - Premium Dark UI
   ========================================= */

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

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(17, 24, 39, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.5);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-indigo: #818cf8;
    --accent-violet: #a78bfa;
    --accent-emerald: #4ade80;
    --accent-rose: #f472b6;
    --accent-amber: #fbbf24;
    --accent-cyan: #22d3ee;
    --accent-blue: #60a5fa;
    
    --gradient-primary: linear-gradient(135deg, #818cf8, #a78bfa, #c084fc);
    --gradient-success: linear-gradient(135deg, #4ade80, #22d3ee);
    --gradient-danger: linear-gradient(135deg, #f472b6, #fb7185);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(129, 140, 248, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Background Effects */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(34, 211, 238, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(129, 140, 248, 0.3);
    border-radius: 50%;
    animation: float-particle linear infinite;
}

@keyframes float-particle {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeInDown 0.6s ease;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.logo-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    box-shadow: var(--shadow-glow);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(129, 140, 248, 0.2); }
    50% { box-shadow: 0 0 40px rgba(129, 140, 248, 0.4); }
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
    margin-top: 2px;
}

/* Minimum Wage Banner */
.min-wage-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.08), rgba(34, 211, 238, 0.06));
    border: 1px solid rgba(74, 222, 128, 0.15);
    border-radius: 999px;
    margin: -1rem auto 2rem;
    width: fit-content;
    max-width: 100%;
    animation: fadeInUp 0.6s ease 0.3s both;
}

.min-wage-icon {
    font-size: 1rem;
}

#min-wage-badge {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent-emerald);
    letter-spacing: 0.01em;
}

/* Fallback Notice */
.fallback-notice {
    text-align: center;
    padding: 0.75rem 1.25rem;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent-amber);
    animation: fadeInUp 0.5s ease;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: fadeInUp 0.6s ease;
    transition: var(--transition-normal);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.input-card {
    animation-delay: 0.1s;
    animation-fill-mode: both;
}

.result-card {
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

.card-header {
    padding: 1.5rem 1.75rem 0;
}

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-body {
    padding: 1.5rem 1.75rem 1.75rem;
}

/* Toggle Group */
.toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-glass);
}

.toggle-btn {
    flex: 1;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.toggle-btn.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(129, 140, 248, 0.3);
}

.toggle-btn:not(.active):hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

/* Input Groups */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0 1rem;
    transition: var(--transition-normal);
    position: relative;
}

.input-wrapper:focus-within {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

.input-prefix {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1rem;
    margin-right: 0.5rem;
}

.input-suffix {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1.125rem;
    font-weight: 600;
    padding: 0.875rem 0;
    width: 100%;
}

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

/* Quick Amount Buttons */
.quick-amounts {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 0.375rem 0.875rem;
    background: rgba(129, 140, 248, 0.08);
    border: 1px solid rgba(129, 140, 248, 0.2);
    border-radius: 999px;
    color: var(--accent-indigo);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.quick-btn:hover {
    background: rgba(129, 140, 248, 0.2);
    border-color: rgba(129, 140, 248, 0.4);
    transform: translateY(-1px);
}

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

/* Stepper */
.stepper {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid var(--border-glass);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: fit-content;
}

.stepper-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stepper-btn:hover {
    background: rgba(129, 140, 248, 0.15);
    color: var(--accent-indigo);
}

.stepper-btn:active {
    background: rgba(129, 140, 248, 0.25);
}

.stepper input {
    width: 50px;
    text-align: center;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass);
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.625rem 0;
}

/* Help Text */
.help-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 1rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
    margin-top: 0.5rem;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: 0.5s;
}

.calculate-btn:hover::before {
    left: 100%;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(129, 140, 248, 0.35);
}

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

.btn-icon {
    font-size: 1.25rem;
    transition: transform var(--transition-normal);
}

.calculate-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* ===== Result Section ===== */

/* Net Salary Display */
.net-salary-display {
    text-align: center;
    padding: 1.75rem 1rem;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.08), rgba(34, 211, 238, 0.05));
    border: 1px solid rgba(74, 222, 128, 0.15);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.net-salary-display::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(74, 222, 128, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.net-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent-emerald);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.net-amount {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
}

.net-amount .currency {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-emerald);
    opacity: 0.7;
}

.net-amount .amount {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.net-sublabel {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Chart Container */
.chart-container {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 1.5rem auto;
}

.chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.chart-label {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.chart-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 2px;
}

/* Legend */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Deduction List */
.deduction-list {
    border-top: 1px solid var(--border-glass);
    padding-top: 1.25rem;
}

.deduction-header h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.deduction-category {
    margin-bottom: 1.25rem;
}

.deduction-category h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.deduction-item {
    padding: 0.625rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: var(--transition-fast);
}

.deduction-item:hover {
    background: rgba(255, 255, 255, 0.02);
    padding-left: 0.5rem;
    border-radius: var(--radius-sm);
}

.deduction-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.deduction-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.deduction-rate-text {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.deduction-amount {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--accent-rose);
    margin-bottom: 0.375rem;
}

.deduction-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.deduction-bar-fill {
    height: 100%;
    border-radius: 999px;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.deduction-bar-fill.pension { background: var(--accent-indigo); }
.deduction-bar-fill.health { background: var(--accent-cyan); }
.deduction-bar-fill.longterm { background: var(--accent-blue); }
.deduction-bar-fill.employment { background: var(--accent-violet); }
.deduction-bar-fill.incometax { background: var(--accent-rose); }
.deduction-bar-fill.localtax { background: var(--accent-amber); }

/* Total Section */
.total-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid rgba(255, 255, 255, 0.08);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.total-value {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.total-value.negative { color: var(--accent-rose); }
.total-value.positive { color: var(--accent-emerald); }

.net-total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.net-total span:first-child {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.net-total .total-value {
    font-size: 1.25rem;
    font-weight: 800;
}

/* Yearly Summary */
.yearly-summary {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
}

.yearly-summary h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.yearly-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.yearly-item {
    text-align: center;
}

.yearly-label {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.yearly-value {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
}

.yearly-value.highlight { color: var(--accent-emerald); }
.yearly-value.negative { color: var(--accent-rose); }

/* Footer */
.footer {
    text-align: center;
    margin-top: 2.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-glass);
}

.footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.footer strong {
    color: var(--accent-amber);
    font-weight: 600;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Animation class for results */
.animate-value {
    animation: countUp 0.5s ease forwards;
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.calculated .net-salary-display {
    animation: resultPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes resultPop {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1.25rem 1rem;
    }

    .main-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .logo-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .net-amount .amount {
        font-size: 2rem;
    }

    .yearly-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .yearly-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .yearly-label {
        margin-bottom: 0;
    }

    .quick-amounts {
        gap: 0.375rem;
    }

    .quick-btn {
        padding: 0.3rem 0.625rem;
        font-size: 0.6875rem;
    }
}

@media (max-width: 480px) {
    .net-amount .amount {
        font-size: 1.75rem;
    }

    .chart-container {
        width: 180px;
        height: 180px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Selection */
::selection {
    background: rgba(129, 140, 248, 0.3);
    color: white;
}
