* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

html {
    overflow-y: scroll;
}

body {
    background-color: #f5f5f5;
    min-height: 100vh;
    padding-top: 0px;
    margin: 0;
}

/* Header styles */
.header {
    background-color: #003049;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header-content {
    height: 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
    gap: 0.25rem;
}

.logo-icon {
    font-size: 2rem;
    color: white;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: bold;
}

.beta-badge {
    background-color: #3b82f6;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.main-nav {
    display: flex;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    color: white;
    text-decoration: none;
    gap: 0.25rem;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #bfdbfe;
}

/* Calculator Container */
.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px;
}

.calculator-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 24px;
    position: relative;
    margin-top: 20px;
}

h1 {
    background-color: #fcbf49;
    margin: -24px -24px 24px -24px;
    padding: 16px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

/* Form Styles */
#calculatorForm {
    margin-bottom: 24px;
}

/* Section Styling */
.input-section {
    margin-bottom: 24px;
}

.input-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #003049;
    margin-bottom: 16px;
    padding-left: 12px;
    letter-spacing: 0.3px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    background: linear-gradient(to right, rgba(0, 48, 73, 0.05), transparent);
    padding: 8px 12px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Input Groups and Error Handling */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #4b5563;
}

.input-wrapper {
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
    background-color: #fff;
    color: #111827;
}

.input-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Error States */
.input-group input.error {
    border-color: #dc2626;
    background-color: #fff5f5;
}

.input-group input.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.error-message {
    display: none;
    color: #dc2626;
    font-size: 14px;
    margin-top: 4px;
    padding-left: 4px;
}

.error-message.visible {
    display: block;
}

/* Contribution Group */
.contribution-inputs {
    display: flex;
    gap: 8px;
    width: 100%;
}

.contribution-inputs input {
    width: 60%;
}

.contribution-inputs select {
    width: 40%;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background-color: white;
    font-size: 16px;
}

/* Inflation Group */
.inflation-group {
    margin-top: 16px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: #2563eb;
    border-color: #2563eb;
}

.checkbox-group label {
    font-size: 16px;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
}

.inflation-rate {
    margin-left: 24px;
    transition: margin 0.2s ease;
}

.inflation-rate input {
    width: 120px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
}

.return-rate-group input {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
}

.return-rate-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.inflation-rate input:focus,
.return-rate-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Preset Buttons */
.preset-buttons {
    display: flex;
    gap: 8px;
}

.preset-btn {
    padding: 9px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.preset-btn:hover {
    background: #e5e7eb;
}

/* FAQ Section Styles */
.faq-section {
    margin-top: 32px;
    padding: 24px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 32px;
}

.faq-section h2 {
    color: #003049;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
}

.faq-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.faq-item {
    background: linear-gradient(to bottom right, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    border-radius: 4px;
    padding: 16px;
    transition: transform 0.2s ease;
}

.faq-item:hover {
    transform: translateY(-2px);
}

.faq-question {
    color: #003049;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.faq-answer {
    color: #334155;
    font-size: 16px;
    line-height: 1.5;
}

.faq-answer p {
    margin-bottom: 12px;
}

.faq-answer ul {
    list-style-type: none;
    padding-left: 0;
}

.faq-answer ul li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 8px;
    color: #4b5563;
}

.faq-answer ul li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #003049;
    font-weight: bold;
}

.faq-answer ul li:last-child {
    margin-bottom: 0;
}

/* Action Buttons */
.button-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.calculate-button, .reset-button {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.calculate-button {
    background: #003049;
    color: white;
    border: 1px solid #003049;
}

.calculate-button:hover {
    background: #00436b;
    border-color: #00436b;
}

.reset-button {
    background: white;
    border: 1px solid #ddd;
    color: #333;
}

.reset-button:hover {
    background: #f5f5f5;
    border-color: #003049;
}

/* Results Section */
.results-section {
    background: #f8fafc;
    border-radius: 4px;
    padding: 16px;
    margin-top: 8px;
    width: 100%;
    box-sizing: border-box;
}

.results-section.hidden {
    display: none;
}

.results-section h2 {
    color: #1e40af;
    font-size: 16px;
    margin-bottom: 16px;
}

.result-card {
    background: white;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.result-card.primary-result {
    border-left: 4px solid #2563eb;
}

.result-card h3 {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 4px;
}

.result-value {
    font-size: 24px;
    font-weight: 600;
    color: #1e40af;
    margin: 8px 0;
}

.result-note {
    font-size: 12px;
    color: #6b7280;
}

.result-details {
    margin-top: 20px;
}

.result-details h3 {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 12px;
}

.breakdown {
    background: white;
    border-radius: 4px;
    padding: 16px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-label {
    font-size: 14px;
    color: #4b5563;
}

.breakdown-value {
    font-size: 14px;
    font-weight: 500;
    color: #1e40af;
}

/* Stack Layout */
.input-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .header-container {
        padding: 0 1rem;
    }
   
    .logo-text {
        font-size: 1rem;
    }
   
    .beta-badge {
        font-size: 0.625rem;
        padding: 0.125rem 0.375rem;
    }
   
    .header-content {
        height: 3.5rem;
    }

    .calculator-wrapper {
        padding: 16px;
    }
   
    h1 {
        margin: -16px -16px 16px -16px;
        font-size: 20px;
    }
    
    .input-section h2 {
        font-size: 14px;
        margin-bottom: 12px;
        padding: 6px 10px;
        padding-left: 10px;
        border-left-width: 2px;
        letter-spacing: 0.2px;
    }
    
    .input-section {
        margin-bottom: 20px;
    }
    
    .input-group label {
        font-size: 14px;
        margin-bottom: 4px;
        line-height: 1.3;
    }
    
    .input-group input {
        font-size: 14px;
        padding: 10px;
        -webkit-appearance: none;
        appearance: none;
        min-height: 44px;
    }
    
    .error-message {
        font-size: 12px;
    }
    
    .inflation-group {
        padding: 12px;
        margin-top: 12px;
    }

    .checkbox-group {
        gap: 8px;
        margin-bottom: 12px;
    }

    .checkbox-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    .checkbox-group label {
        font-size: 14px;
    }

    .inflation-rate {
        margin-left: 0;
        margin-top: 12px;
    }

    .inflation-rate input,
    .return-rate-group input {
        width: 100%;
        font-size: 14px;
        min-height: 44px;
    }

    .return-rate-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .return-rate-group {
        margin-bottom: 16px;
    }
	
	.faq-section {
        padding: 16px;
        margin-top: 24px;
    }
    
    .faq-section h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .faq-grid {
        gap: 16px;
    }

    .faq-question {
        font-size: 16px;
    }

    .faq-answer {
        font-size: 14px;
    }
    
    .faq-answer ul li {
        padding-left: 20px;
    }
    
    .faq-answer ul li::before {
        left: 6px;
    }
}

/* Deep Mobile Optimizations */
@media (max-width: 480px) {
    .header {
        position: fixed;
    }
    
    body {
        padding-top: 3.5rem;
    }
    
    .logo-icon {
        font-size: 1.5rem;
    }
    
    .calculator-content {
        padding: 16px;
    }
    
    .contribution-inputs {
        flex-direction: column;
    }
    
    .contribution-inputs select {
        width: 100%;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .calculate-button, .reset-button {
        width: 100%;
        font-size: 16px;
        padding: 14px;
    }
    
    .result-value {
        font-size: 20px;
    }
    
    .inflation-rate {
        margin-left: 0;
    }
    
    .inflation-rate input {
        width: 100%;
    }

    .preset-buttons {
        flex-direction: column;
        width: 100%;
    }

    .preset-btn {
        width: 100%;
        text-align: center;
    }

    .error-message {
        position: relative;
        padding-top: 4px;
    }

    .input-wrapper {
        width: 100%;
    }
	
	.faq-section {
        margin-bottom: 24px;
    }

    .faq-item {
        padding: 12px;
    }

    .faq-answer ul li {
        line-height: 1.4;
    }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.input-group input.error {
    animation: errorShake 0.4s ease-in-out;
}