/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
}

/* Main Container */
.container {
    max-width: 960px;
    margin: 0 auto;
    background: #fff;
    padding: 20px 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Header */
header {
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.header-logo-link {
    display: block;
    margin-bottom: 1rem;
}

.header-logo-img {
    height: 45px;
    width: auto;
}

header h1 {
    color: #005f73;
    margin-bottom: 0.5rem;
}

header .subtitle {
    font-size: 1.1rem;
    color: #555;
}

/* Main Content */
main h2 {
    text-align: center;
    color: #005f73;
    margin-bottom: 25px;
}

/* Model Selection Grid */
.model-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 600px) {
    .model-selection {
        grid-template-columns: 1fr;
    }
}

/* Model Card Styling */
.model-card {
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.model-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.model-card h3 {
    margin-top: 0;
    color: #0a9396;
}

.model-card p {
    font-size: 0.95rem;
    color: #666;
}

/* Disabled Card State */
.model-card.disabled {
    background-color: #f9f9f9;
    color: #aaa;
    cursor: not-allowed;
    pointer-events: none; /* Disables click events */
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9rem;
    color: #888;
}

/* --- Form & Simulation Page Styles (PoC Replication) --- */
.math-box {
    background-color: #e9ecef;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
    text-align: center;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 1.1rem;
    line-height: 1.5;
    border: 1px solid #d6d6d6;
}
.math-desc {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.9rem;
    color: #555;
    margin-top: 10px;
}

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

.section-header {
    grid-column: 1 / -1;
    font-size: 1.5rem;
    font-weight: 600;
    color: #005f73;
    border-bottom: 2px solid #0a9396;
    padding-bottom: 10px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.param-card {
    background-color: #fdfdfd;
    padding: 20px;
    border: 1px solid #e7e7e7;
    border-radius: 5px;
}

.param-card h3 {
    margin-top: 0;
    margin-bottom: 5px;
    color: #333;
    font-size: 1.1rem;
}

.param-card .citation {
    font-size: 0.8rem;
    color: #888;
    display: block;
    margin-bottom: 15px;
}

.param-card label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    margin-top: 10px;
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-row > div {
    flex: 1;
}

.input-row > div > label {
    font-weight: normal;
    font-size: 0.9rem;
}

.info-note {
    font-size: 0.85rem;
    color: #666;
    background-color: #f8f9fa;
    padding: 8px;
    border-left: 3px solid #0a9396;
    border-radius: 3px;
    margin-top: 10px;
}

.run-section {
    text-align: center;
    margin: 40px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.button-primary {
    background-color: #005f73;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.button-primary:hover {
    background-color: #0a9396;
}

/* Spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0a9396;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

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

/* Modal Styles (from PoC) */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fefefe; margin: 5% auto; padding: 20px; border: 1px solid #888; width: 80%; max-width: 800px; border-radius: 8px; position: relative; }
.close-button { color: #aaa; float: right; font-size: 28px; font-weight: bold; }
.close-button:hover, .close-button:focus { color: black; text-decoration: none; cursor: pointer; }
#summary { margin-top: 20px; font-size: 1.1rem; text-align: center; }
#export-csv { margin-top: 15px; }

/* --- Form & Simulation Page Styles --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.form-section {
    background-color: #fdfdfd;
    padding: 20px;
    border: 1px solid #e7e7e7;
    border-radius: 5px;
}

.form-section h3 {
    margin-top: 0;
    border-bottom: 2px solid #0a9396;
    padding-bottom: 10px;
    margin-bottom: 20px;
    color: #005f73;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    width: 100%;
}

input[type="number"],
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
}

input:focus, select:focus {
    outline: none;
    border-color: #0a9396;
    box-shadow: 0 0 5px rgba(10, 147, 150, 0.5);
}

.formula-display {
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
}

.formula-display h4 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: #333;
}

.formula-display code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 1rem;
    color: #c7254e;
}

.run-section {
    text-align: center;
    margin: 40px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.button-primary {
    background-color: #005f73;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.button-primary:hover {
    background-color: #0a9396;
}

.button-secondary {
    background-color: #6c757d;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.button-secondary:hover {
    background-color: #5a6268;
}

/* Spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0a9396;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

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

/* Modal Styles (from PoC) */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fefefe; margin: 5% auto; padding: 20px; border: 1px solid #888; width: 80%; max-width: 800px; border-radius: 8px; position: relative; }
.close-button { color: #aaa; float: right; font-size: 28px; font-weight: bold; }
.close-button:hover, .close-button:focus { color: black; text-decoration: none; cursor: pointer; }
#summary { margin-top: 20px; font-size: 1.1rem; text-align: center; }
#export-csv { margin-top: 15px; }

/* Risk Matrix Styles */
#risk-matrix-container {
    margin-top: 25px;
}

.risk-matrix {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.risk-matrix th, .risk-matrix td {
    border: 1px solid #ccc;
    padding: 12px;
    font-size: 0.9rem;
}

.risk-matrix th {
    background-color: #f2f2f2;
}

.risk-matrix .y-axis-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg); /* Flips the right-to-left vertical text to be readable top-to-bottom */
    font-weight: bold;
}

.risk-matrix .low { background-color: #d4edda; } /* Green */
.risk-matrix .medium { background-color: #fff3cd; } /* Yellow */
.risk-matrix .high { background-color: #f8d7da; } /* Red */

.risk-matrix .highlight {
    border: 3px solid #005f73;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 95, 115, 0.5);
    position: relative;
    z-index: 1;
}