:root {
    --primary: #F03F35;
    --primary-dark: #d63228;
    --secondary: #1e293b;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: #F03F35;
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: #ff8a80;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 400px;
    height: 400px;
    background: #ffccbc;
    animation-delay: -10s;
    opacity: 0.4;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    z-index: 1;
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.logo-container {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.header-nav {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.nav-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(240, 63, 53, 0.2);
}

.cards-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.calculator-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow);
    flex: 2;
}

.projection-card {
    flex: 1;
    background: #f1f5f9;
}

.calculator-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.input-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .input-wrapper {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(240, 63, 53, 0.1);
}

.percentage-input {
    position: relative;
    width: 100%;
}

.percentage-input input {
    padding-right: 3.5rem;
    text-align: center;
}

.percentage-input span {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    -webkit-transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Projection Row Styles */
.projection-row {
    margin-bottom: 1rem;
    background: white;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.row-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.year-label {
    font-weight: 700;
    color: var(--primary);
    width: 50px;
}

.percentage-input.small {
    width: 80px;
}

.percentage-input.small input {
    padding-right: 2rem;
    padding-left: 0.5rem;
}

.percentage-input.small span {
    right: 0.5rem;
}

.projection-result {
    flex: 1;
    text-align: right;
    font-weight: 600;
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--text-main);
}

/* Graph Bars */
.bar-container {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

/* Chart Container */
.chart-container {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.chart-container canvas {
    max-height: 300px;
}

.results-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.results-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.result-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.amount {
    color: var(--text-main);
    font-weight: 600;
    font-family: monospace;
    font-size: 1.1rem;
}

.amount.negative {
    color: var(--secondary);
}

.result-row.total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: 700;
}

.result-row.total .amount {
    color: #16a34a;
    font-size: 1.5rem;
}

.action-btn {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 63, 53, 0.3);
}

.action-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: #334155;
    color: white;
}

.secondary-btn:hover {
    background: #1e293b;
}

.primary-btn {
    background: var(--primary);
}

.primary-btn:hover {
    background: var(--primary-dark);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-large {
    max-width: 700px;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.modal-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.modal-actions .action-btn {
    width: auto;
    margin-top: 0;
    padding: 0.75rem 1.5rem;
}

/* Year Tabs */
.year-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.year-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.year-tab:hover {
    color: var(--text-main);
    background: rgba(240, 63, 53, 0.05);
}

.year-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Year Panels */
.year-panel {
    display: none;
}

.year-panel.active {
    display: block;
}

.year-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.data-item.full-width {
    grid-column: 1 / -1;
}

.data-item label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.data-item input {
    width: 100%;
}

.data-note {
    padding: 1rem;
    background: #f1f5f9;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .cards-wrapper {
        flex-direction: column;
    }

    .calculator-card,
    .projection-card {
        width: 100%;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container {
        max-width: 100%;
    }

    header {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .logo-container {
        justify-content: center;
    }

    .header-logo {
        height: 50px;
    }

    .header-nav {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }

    .nav-btn {
        flex: 1;
        min-width: 120px;
        text-align: center;
        font-size: 0.9rem;
        padding: 0.65rem 1rem;
    }

    .calculator-card {
        padding: 1.5rem;
    }

    .calculator-card h2 {
        font-size: 1.3rem;
    }

    input {
        width: 100%;
        min-width: 0;
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    .row-content {
        flex-wrap: wrap;
    }

    .projection-result {
        width: 100%;
        text-align: left;
        margin-top: 0.5rem;
    }

    .percentage-input.small {
        width: 100px;
    }

    .year-data-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 1.5rem;
        width: 95%;
        max-height: 85vh;
    }

    .action-btn {
        font-size: 0.95rem;
        padding: 0.9rem;
    }
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Salary Select Dropdown */
.salary-select {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    cursor: pointer;
}

.salary-select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(240, 63, 53, 0.1);
}