:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --color-saving: #10b981;
    --color-investing: #8b5cf6;
    --color-food: #f59e0b;
    --color-housing: #3b82f6;
    --color-other: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: move 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--color-investing);
    bottom: -50px;
    left: -50px;
    animation-delay: -5s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: var(--color-saving);
    top: 40%;
    left: 20%;
    animation-delay: -10s;
}

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(50px, 50px) scale(1.1); }
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(1rem, 5vw, 2.5rem);
}

header {
    text-align: center;
    margin-bottom: clamp(1.5rem, 8vw, 3rem);
}

header h1 {
    font-size: clamp(1.75rem, 8vw, 3rem);
    font-weight: 700;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: clamp(0.9rem, 4vw, 1.1rem);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

@media (max-width: 968px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Card Styles */
.card {
    border-radius: 1.5rem;
    padding: clamp(1.25rem, 5vw, 2rem);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass {
    background: var(--card-bg);
}

.shadow-lg {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.card-header h2 {
    font-size: clamp(1.2rem, 5vw, 1.5rem);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* Input Panel */
.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--primary);
}

.category-inputs {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.category-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.percentage-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px; /* Thicker track for easier touch */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    outline: none;
    margin: 10px 0; /* Extra vertical space */
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px; /* Larger thumb for touch */
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.1s ease;
}

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

@media (max-width: 480px) {
    input[type="range"]::-webkit-slider-thumb {
        width: 28px; /* Even larger on very small screens */
        height: 28px;
    }
}

/* Add Category Form */
.add-category-form {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.input-row {
    display: flex;
    gap: 0.5rem;
}

.input-row input {
    flex: 1;
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    outline: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

#total-percent-display.max-reached span {
    color: var(--color-investing);
}

.btn-remove {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-other);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: var(--color-other);
    color: white;
}

.category-label-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Category specific colors for sliders (Dynamic) */
/* We will use inline styles or dynamic classes and just keep the badge styles here */

/* Viz Panel */
.chart-container {
    position: relative;
    height: clamp(250px, 50vw, 350px); /* Smaller height on small screens */
    width: 100%;
    margin-bottom: 2rem;
}

.amount-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
}

@media (max-width: 480px) {
    .amount-summary {
        grid-template-columns: 1fr 1fr; /* Two columns on mobile */
        gap: 0.75rem;
    }
}

.summary-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 1rem;
    text-align: center;
    border: 1px solid var(--glass-border);
}

.summary-card .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.summary-card .value {
    font-size: 1.25rem;
    font-weight: 700;
}

footer {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--glass-border);
    margin-top: 2rem;
}
