:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: rgba(255, 255, 255, 0.1);
    --buy-color: #10b981;
    --sell-color: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top right, #1e1b4b, var(--bg-color));
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
}

.app-container {
    width: 100%;
    max-width: 900px;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.attribution {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

.attribution a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

.attribution a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.settings-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.toggle-container {
    display: flex;
    flex-direction: row;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    padding: 0.5rem;
    align-items: center;
    gap: 0.5rem;
}

.toggle-label {
    padding: 0 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.toggle-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.toggle-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.5);
}

.fund-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.fund-row:last-child {
    margin-bottom: 0;
}

.fund-name-display {
    flex: 2;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
}

.fund-name-text {
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1.4;
    word-break: break-word;
}

.fund-target-pct {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
}

.fund-current-display {
    flex: 1;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
}

.fund-balance {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.3s ease;
    min-width: 0; /* prevents flex overflow */
}

.fund-balance:focus {
    border-color: var(--accent);
}

/* Remove arrows from number inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

.fund-result {
    flex: 1;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.fund-result.buy {
    color: var(--buy-color);
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.fund-result.sell {
    color: var(--sell-color);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

.contribution-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.contribution-group label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.contribution-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.3s ease;
}

.contribution-input:focus {
    border-color: var(--accent);
}

.primary-btn {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.primary-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.hidden {
    display: none;
}

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

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.result-item.total {
    background: transparent;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    margin-top: 1rem;
    padding-top: 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.fund-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.fund-target {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

.action {
    text-align: right;
}

.action-amount {
    font-weight: 700;
    font-size: 1.2rem;
}

.buy .action-amount {
    color: var(--buy-color);
}

.sell .action-amount {
    color: var(--sell-color);
}

.action-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}


