/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem 0;
}

/* Cards */
.card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Investment Options Grid */
.investment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.investment-option {
    background: var(--background-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.investment-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.investment-option.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.option-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.investment-option h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.investment-option p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.option-stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.stat {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--card-background);
}

.risk-low { color: var(--secondary-color); }
.risk-medium { color: var(--warning-color); }
.risk-high { color: #f97316; }
.risk-extreme { color: var(--danger-color); }

.allocation-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
}

.allocation-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.allocation-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
}

.warning {
    color: var(--danger-color);
    font-weight: 600;
}

.hidden {
    display: none;
}

/* Risk Assessment */
.risk-profile {
    margin-bottom: 1.5rem;
}

.risk-meter {
    height: 20px;
    background: linear-gradient(to right, #10b981, #f59e0b, #ef4444);
    border-radius: var(--radius-md);
    position: relative;
    margin-bottom: 0.5rem;
}

.risk-bar {
    position: absolute;
    width: 4px;
    height: 30px;
    background: var(--text-primary);
    border-radius: 2px;
    top: -5px;
    left: 0;
    transition: left 0.5s ease;
}

.risk-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.risk-score {
    text-align: center;
    font-size: 1.25rem;
}

.risk-score strong {
    font-size: 2rem;
    color: var(--primary-color);
}

.risk-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.risk-detail-item {
    background: var(--background-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.risk-detail-item h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.risk-detail-item span {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Simulation Parameters */
.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.param-group input,
.param-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--card-background);
}

.param-group input:focus,
.param-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn-primary {
    display: block;
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--background-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Outcome Cards */
.outcomes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.outcome-card {
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.outcome-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.outcome-card.pessimistic {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
}

.outcome-card.expected {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
}

.outcome-card.optimistic {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #bbf7d0;
}

.outcome-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.pessimistic .outcome-value { color: #dc2626; }
.expected .outcome-value { color: var(--primary-color); }
.optimistic .outcome-value { color: #16a34a; }

.outcome-return {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Probability Section */
.probability-section {
    background: var(--background-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.probability-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.probability-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.probability-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.probability-item:last-child {
    border-bottom: none;
}

.probability-item strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Chart Section */
.chart-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.chart-tab {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--card-background);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.chart-tab:hover {
    border-color: var(--primary-color);
}

.chart-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 1rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
}

/* Summary Section */
.summary-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-item {
    background: var(--background-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

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

.summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Footer */
footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: auto;
}

footer a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.disclaimer {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .card {
        padding: 1rem;
    }

    .card h2 {
        font-size: 1.25rem;
    }

    .investment-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .option-icon {
        font-size: 2rem;
    }

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

    .outcome-value {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 300px;
    }

    .risk-score strong {
        font-size: 1.5rem;
    }

    .allocation-summary {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .logo {
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo-img {
        width: 40px;
        height: 40px;
    }

    header h1 {
        font-size: 1.25rem;
    }

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

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

    .summary-content {
        grid-template-columns: 1fr 1fr;
    }

    .chart-tabs {
        justify-content: flex-start;
    }
}

/* Print Styles */
@media print {
    header, footer {
        background: none;
        color: black;
    }

    .btn-primary, .btn-secondary {
        display: none;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
