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

body {
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(to bottom, #f0f9ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    padding: 20px;
    color: #1e293b;
    line-height: 1.6;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: #0f172a;
    background: white;
    padding: 30px 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #0891b2;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #0f172a;
    font-weight: 600;
    letter-spacing: -0.5px;
}

header p {
    font-size: 1.1em;
    color: #475569;
    margin-bottom: 15px;
    font-weight: 400;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 1em;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    color: white;
    width: 100%;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(8, 145, 178, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0e7490 0%, #155e75 100%);
    box-shadow: 0 4px 8px rgba(8, 145, 178, 0.3);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    background: white;
    color: #0891b2;
    border: 2px solid #0891b2;
}

.btn-secondary:hover {
    background: #f0f9ff;
    border-color: #0e7490;
}

.btn-remove {
    background: #ef4444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Simulation Layout */
.simulation-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
    margin-top: 20px;
}

.controls-panel, .results-panel {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    overflow: visible;
}

.controls-panel {
    height: fit-content;
    position: sticky;
    top: 20px;
    border-left: 3px solid #0891b2;
}

.controls-panel h2, .results-panel h2 {
    color: #0f172a;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 600;
    border-bottom: 2px solid #e0f2fe;
    padding-bottom: 12px;
}

.controls-panel h3 {
    color: #334155;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.1em;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
    font-weight: 500;
}

.controls-panel h2 + h3 {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #1e293b;
    font-size: 0.95em;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s ease;
    background: #f8fafc;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group input[type="number"]:focus,
.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #0891b2;
    background: white;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #64748b;
    font-size: 0.85em;
    line-height: 1.4;
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #0891b2;
}

/* Parameter Rows */
.param-row {
    display: grid;
    grid-template-columns: 1fr 100px 40px;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.param-row select,
.param-row input {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9em;
    background: #f8fafc;
    transition: all 0.2s ease;
    max-width: 100%;
    min-width: 0;
}

.param-row select {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.param-row select:focus,
.param-row input:focus {
    outline: none;
    border-color: #0891b2;
    background: white;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

#additional-params {
    margin-bottom: 15px;
    overflow: visible;
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 15px;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-left: 3px solid #0891b2;
    border-radius: 8px;
    margin-top: 15px;
    color: #1e40af;
    font-weight: 500;
}

/* Error Message */
.error-msg {
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-left: 3px solid #ef4444;
    color: #991b1b;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

/* Results */
.placeholder {
    text-align: center;
    color: #94a3b8;
    padding: 60px 20px;
    font-size: 1.1em;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px dashed #cbd5e1;
}

#plot-container {
    margin-top: 20px;
}

#plot-img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

/* Dynamic plots grid - Responsive 2-column layout */
.plots-grid {
    display: grid;
    gap: 20px;
    margin-top: 20px;
    /* Auto-fit columns based on available width */
    /* Min column width: 350px, max 2 columns */
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
}

.plot-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.plot-item img,
.plot-item svg {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* Fine-tune for very small screens */
@media (max-width: 480px) {
    .plots-grid {
        gap: 15px;
    }
    
    .plot-item {
        padding: 10px;
    }
}

.info-text {
    margin-top: 15px;
    padding: 15px;
    background: #ecfeff;
    border-left: 3px solid #0891b2;
    border-radius: 8px;
    color: #164e63;
    line-height: 1.6;
}

/* Sensitivity Table */
#sensitivity-table {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

#sensitivity-table h3 {
    color: #0f172a;
    margin-bottom: 15px;
    font-weight: 600;
}

#sensitivity-data {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

#sensitivity-data thead {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    color: white;
}

#sensitivity-data th,
#sensitivity-data td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

#sensitivity-data tbody tr:hover {
    background: #f0f9ff;
}

#sensitivity-data tbody tr:last-child td {
    border-bottom: none;
}

/* Homepage Specific Styles */
.simulation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.simulation-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    border-left: 3px solid #0891b2;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.simulation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    border-left-color: #0e7490;
}

.simulation-card h2 {
    color: #0f172a;
    margin-bottom: 15px;
    font-size: 1.5em;
    font-weight: 600;
}

.simulation-card p {
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

.simulation-card .btn-primary {
    margin-top: auto;
}

.simulation-card .features {
    list-style: none;
    margin-top: 15px;
}

.simulation-card .features li {
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.9em;
}

.simulation-card .features li:last-child {
    border-bottom: none;
}

.simulation-card .features li::before {
    content: "▸ ";
    color: #0891b2;
    font-weight: bold;
}

.info-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    border-left: 3px solid #0891b2;
    margin-bottom: 40px;
}

.info-section h2 {
    color: #0f172a;
    margin-bottom: 15px;
    font-weight: 600;
}

.info-section h3 {
    color: #334155;
    margin-top: 25px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 1.15em;
}

.info-section p {
    color: #475569;
    line-height: 1.8;
    margin-bottom: 12px;
}

.info-section ul {
    margin: 15px 0;
    padding-left: 30px;
    list-style-type: disc;
}

.info-section ul li {
    color: #475569;
    line-height: 1.8;
    margin-bottom: 8px;
    padding-left: 8px;
}

.info-section ul li strong {
    color: #1e293b;
}

.info-section a {
    color: #0891b2;
    text-decoration: none;
    font-weight: 500;
}

.info-section a:hover {
    color: #0e7490;
    text-decoration: underline;
}

.info-section pre {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 15px 0;
    color: #1e293b;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .simulation-layout {
        grid-template-columns: 1fr;
    }
    
    .controls-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .param-row {
        grid-template-columns: 1fr;
    }
    
    .param-row .btn-remove {
        justify-self: end;
    }
    
    .simulation-grid {
        grid-template-columns: 1fr;
    }
}

/* Footer */
.site-footer {
    margin-top: 60px;
    padding: 30px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-top: 3px solid #0891b2;
}

.site-footer p {
    margin: 10px 0;
    color: #475569;
    font-size: 0.95em;
}

.site-footer a {
    color: #0891b2;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    padding: 0 8px;
}

.site-footer a:hover {
    color: #0e7490;
    text-decoration: underline;
}

.site-footer .footer-links {
    margin-top: 5px;
}

.site-footer .footer-links a {
    border-right: 1px solid #cbd5e1;
}

.site-footer .footer-links a:last-child {
    border-right: none;
}
