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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.4;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-size: 14px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin-top: 5px;
    margin-bottom: 5px;
}

header {
    text-align: center;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 2px solid #f0f0f0;
}

header h1 {
    color: #2c3e50;
    font-size: 1.6rem;
    margin-bottom: 3px;
}

header p {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* How to Use Section */
.how-to-use {
    margin-bottom: 40px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border: 1px solid #dee2e6;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.how-to-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    text-align: center;
}

.how-to-header h2 {
    margin: 0;
    font-size: 1.8rem;
}

.how-to-content {
    padding: 30px;
}

.step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.step-card {
    background: white;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.step-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.step-number {
    position: absolute;
    top: -10px;
    left: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.step-card h3 {
    margin: 12px 0 8px 0;
    color: #2c3e50;
    font-size: 1rem;
}

.step-card p {
    color: #495057;
    line-height: 1.4;
    margin: 0;
    font-size: 0.9rem;
}

.interpretation-guide {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.interpretation-guide h3 {
    color: #2c3e50;
    margin-bottom: 12px;
    text-align: center;
    font-size: 1.1rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.guide-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    border-left: 4px solid #667eea;
}

.guide-item h4 {
    color: #2c3e50;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.guide-item p {
    color: #495057;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.3;
}

.quick-tips {
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #dee2e6;
}

.quick-tips h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.quick-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quick-tips li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    color: #495057;
    line-height: 1.4;
    position: relative;
    padding-left: 18px;
    font-size: 0.9rem;
}

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

.quick-tips li:before {
    content: "💡";
    position: absolute;
    left: 0;
    top: 10px;
}

.input-section {
    margin-bottom: 25px;
}

.investment-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.option-group {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.option-group h3 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 1rem;
}

.form-select, .form-input {
    width: 100%;
    padding: 8px;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 8px;
    transition: border-color 0.3s ease;
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: #667eea;
}

.component-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.return-rate {
    color: #27ae60;
    font-weight: bold;
}

.tax-info {
    color: #e74c3c;
    font-size: 0.9rem;
}

.allocation-slider {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
}

.allocation-slider h3 {
    margin-bottom: 12px;
    color: #2c3e50;
    text-align: center;
    font-size: 1rem;
}

.slider-container {
    margin-bottom: 20px;
}

.slider-container label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    text-align: center;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 10px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.allocation-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.allocation-display {
    margin-top: 15px;
}

.allocation-bar {
    height: 50px;
    border-radius: 25px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fixed-portion {
    background: linear-gradient(135deg, #3498db, #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
}

.equity-portion {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
}

.parameters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.parameter-group {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.parameter-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 0.9rem;
}

.calculate-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.calculate-btn:active {
    transform: translateY(0);
}

.results-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #f0f0f0;
}

.results-section h2 {
    text-align: center;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.4rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.metric-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #dee2e6;
    transition: transform 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-card h4 {
    color: #2c3e50;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.metric-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 4px;
}

.metric-value.pretax {
    color: #3498db;
}

.metric-value.posttax {
    color: #27ae60;
}

.metric-value.tax-amount {
    color: #e74c3c;
}

.metric-value.tax-impact {
    color: #f39c12;
}

.metric-subtext {
    color: #7f8c8d;
    font-size: 0.8rem;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.chart-section-wide {
    grid-column: 1 / -1;
}

.chart-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.chart-section h3 {
    text-align: center;
    margin-bottom: 12px;
    color: #2c3e50;
    font-size: 1rem;
}

.chart-section canvas {
    max-height: 300px;
}

.chart-explanation {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 8px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: #2c3e50;
    border-radius: 0 4px 4px 0;
    line-height: 1.3;
}

/* Collapsible sections */
.collapsible-section {
    margin-bottom: 20px;
}

.collapsible-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.3s ease;
    user-select: none;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
}

.collapsible-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1rem;
}

.collapsible-toggle {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
    transition: transform 0.3s ease;
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible-content.collapsed {
    max-height: 0;
}

.collapsible-content.expanded {
    max-height: 2000px;
}

.collapsible-inner {
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.collapsible-header.collapsed .collapsible-toggle {
    transform: rotate(0deg);
}

.collapsible-header.expanded .collapsible-toggle {
    transform: rotate(180deg);
}

/* Explanation styles */
.analysis-explanations {
    background: #e8f4fd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #bee5eb;
}

.analysis-explanations h4 {
    color: #0c5460;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.metric-explanations {
    display: grid;
    gap: 12px;
}

.metric-explanation {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #17a2b8;
    font-size: 0.9rem;
    color: #495057;
}

.detailed-results {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.detailed-results h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    text-align: center;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.analysis-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: white;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.analysis-item .label {
    font-weight: bold;
    color: #2c3e50;
}

.analysis-item .value {
    color: #667eea;
    font-weight: bold;
}

/* Tax breakdown section styles */
.tax-breakdown-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 30px;
}

.tax-breakdown-section h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    text-align: center;
}

.tax-explanation {
    display: grid;
    gap: 25px;
}

.tax-rates-used {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.tax-rates-used h4 {
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

.tax-components {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.tax-component-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tax-component-card h5 {
    margin-bottom: 15px;
    color: #2c3e50;
    text-align: center;
    padding: 10px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.tax-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tax-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.tax-label {
    font-weight: bold;
    color: #495057;
    font-size: 0.9rem;
}

.tax-value {
    font-weight: bold;
    color: #667eea;
}

.tax-value.tax-amount {
    color: #e74c3c;
}

.tax-rate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
    margin-bottom: 8px;
}

.tax-rate-label {
    font-weight: bold;
    color: #495057;
}

.tax-rate-value {
    font-weight: bold;
    color: #667eea;
}

.tax-note {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 5px;
    padding: 10px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #856404;
}

footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    color: #7f8c8d;
    font-size: 0.9rem;
    border-top: 1px solid #e9ecef;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.calculate-btn.calculating {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        margin: 5px;
        padding: 8px;
    }

    header {
        margin-bottom: 10px;
        padding: 8px 0;
    }

    header h1 {
        font-size: 1.4rem;
    }

    header p {
        font-size: 0.85rem;
    }

    .investment-options {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 15px;
    }

    .charts-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .parameters {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .tax-components {
        grid-template-columns: 1fr;
    }

    .collapsible-inner {
        padding: 8px;
    }

    .step-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }

    .how-to-header h2 {
        font-size: 1.2rem;
    }

    .step-card {
        padding: 10px;
    }

    .interpretation-guide,
    .quick-tips {
        padding: 12px;
    }

    .option-group,
    .parameter-group,
    .allocation-slider {
        padding: 8px;
    }

    .form-select, .form-input {
        padding: 6px;
        font-size: 0.85rem;
    }

    .calculate-btn {
        padding: 10px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    .container {
        margin: 2px;
        padding: 6px;
    }

    header h1 {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }

    header p {
        font-size: 0.8rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .metric-card {
        padding: 8px;
    }

    .metric-card h4 {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }

    .metric-value {
        font-size: 1rem;
        margin-bottom: 2px;
    }

    .metric-subtext {
        font-size: 0.7rem;
    }

    .collapsible-header {
        padding: 8px 10px;
    }

    .collapsible-header h3 {
        font-size: 0.9rem;
    }

    .option-group h3,
    .allocation-slider h3 {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .form-select, .form-input {
        padding: 5px;
        font-size: 0.8rem;
    }

    .parameter-group label {
        font-size: 0.8rem;
    }

    .calculate-btn {
        padding: 8px;
        font-size: 0.9rem;
    }

    .results-section h2 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
}