:root {
    --primary-color: #4f46e5;
    /* Indigo */
    --primary-hover: #4338ca;
    --secondary-color: #10b981;
    /* Emerald */
    --danger-color: #ef4444;
    /* Red */
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #f3f4f6 100%);
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    /* Reduced padding */
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    max-width: 900px;
    /* Slightly wider */
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
    /* Reduced margin */
}

h1 {
    color: var(--text-main);
    font-size: 1.75rem;
    /* Slightly smaller */
    font-weight: 800;
    margin-bottom: 0.25rem;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #4f46e5, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Modern Tabs (Segmented Control) */
.tabs {
    display: flex;
    background: #f3f4f6;
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    /* Reduced margin */
    position: relative;
}

.tab-button {
    flex: 1;
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    z-index: 1;
}

.tab-button.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tab-content {
    display: none;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Visualizer Styling */
.visualizer-intro {
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    /* Reduced padding */
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 1.5rem;
    /* Reduced margin */
    color: #1e40af;
    font-size: 0.9rem;
    line-height: 1.4;
}

.controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    /* Reduced gap */
    margin-bottom: 1.5rem;
    /* Reduced margin */
}

@media (min-width: 640px) {
    .controls {
        grid-template-columns: 1fr 1fr;
        align-items: end;
    }

    .controls .form-group:last-child {
        grid-column: span 2;
    }
}

.full-width {
    grid-column: 1 / -1 !important;
    width: 100%;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input[type="number"],
input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #f9fafb;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

/* Custom Range Slider */
.slider-container {
    position: relative;
    padding: 10px 0;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    margin: 10px 0;
    /* Add margin for thumb clearance */
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 32px;
    /* Larger thumb */
    width: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -12px;
    /* Center on track */
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.4);
    border: 3px solid white;
    /* Thicker border */
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    /* Thicker track */
    cursor: pointer;
    background: #e5e7eb;
    border-radius: 4px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Results Cards */
.viz-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    /* Smaller min-width */
    gap: 0.75rem;
    /* Reduced gap */
    margin-bottom: 1.5rem;
    /* Reduced margin */
}

.viz-card {
    background: white;
    padding: 1rem;
    /* Reduced padding */
    border-radius: var(--radius-md);
    border: 1px solid #e5e7eb;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.viz-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.viz-card h3 {
    font-size: 0.75rem;
    /* Smaller font */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

.viz-card .amount {
    font-size: 1.25rem;
    /* Slightly smaller */
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

.viz-card.highlight {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #a7f3d0;
}

.viz-card.highlight .amount {
    color: #059669;
}

/* Bar Charts */
.chart-container {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid #e5e7eb;
}

.bar-group {
    margin-bottom: 1.25rem;
}

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

.bar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.bar-track {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

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

.wage-bar {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.benefit-bar {
    background: linear-gradient(90deg, #34d399, #10b981);
}

.expense-bar {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

/* Buttons */
button[type="submit"] {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
    transition: all 0.2s;
}

button[type="submit"]:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.4);
}

button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: var(--radius-md);
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
    cursor: pointer;
}

.checkbox-group input {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary-color);
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
}

/* Results Section in Calculator */
#results {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 2px dashed #e5e7eb;
}

#results h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}



.breakdown {
    margin-top: 2rem;
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.breakdown li {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.95rem;
}

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

.hidden {
    display: none;
}