/* styles.css (Complete - Revised for Width Constraint & Spacing) */

/* --- Global Styles & Variables --- */
:root {
    --bg-dark: #2c3e50; /* Midnight Blue */
    --bg-medium: #34495e; /* Wet Asphalt */
    --bg-light: #f8f9fa; /* Very light grey for section backgrounds */
    --bg-panel: #ffffff; /* White for panels */
    --bg-container: #eef1f3; /* Slightly off-white page background */
    --text-light: #f1f2f6; /* Lighter text */
    --text-dark: #2d3436; /* Darker text */
    --text-medium: #555e67;
    --text-muted: #7f8c8d; /* Asbestos */
    --accent-blue: #3498db; /* Peter River */
    --accent-green: #2ecc71; /* Emerald */
    --accent-yellow: #f1c40f; /* Sun Flower */
    --accent-orange: #e67e22; /* Carrot */
    --accent-red: #e74c3c; /* Alizarin */
    --border-color: #ced4da; /* Lighter border */
    --border-light: #e1e5e9;
    --shadow-color: rgba(44, 62, 80, 0.1); /* Use bg-dark with alpha */
    --shadow-light: rgba(44, 62, 80, 0.05);

    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --base-spacing: 20px;
    --half-spacing: calc(var(--base-spacing) / 2);
    --quarter-spacing: calc(var(--base-spacing) / 4);
    --panel-border-radius: 6px;
    --dashboard-max-width: 1300px; /* Max width for the dashboard content */
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-container);
    color: var(--text-dark);
    line-height: 1.6;
    padding: var(--base-spacing);
}

.page-wrapper {
    max-width: 100%; /* Allow page wrapper to take full width */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--base-spacing);
    align-items: center; /* Center items within the page */
}


/* --- Input Section --- */
.input-section {
    background-color: var(--bg-panel);
    padding: var(--base-spacing);
    border-radius: var(--panel-border-radius);
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 5px var(--shadow-light);
    width: 100%; /* Take full width of parent */
    max-width: var(--dashboard-max-width); /* Constrain to dashboard width */
}
/* Input section content styling ... (Keep as before) */
.input-section h2 { font-size: 1.3em; margin-bottom: var(--half-spacing); color: var(--bg-dark); font-weight: 600; }
.input-section p { margin-bottom: var(--base-spacing); font-size: 0.95em; color: var(--text-medium); }
.input-section code { background-color: var(--bg-light); padding: 2px 5px; border-radius: 3px; font-family: monospace; border: 1px solid var(--border-light); }
.json-loader label { margin-right: 8px; font-weight: 500; }
input[type="file"] { color: var(--text-medium); }
input[type="file"]::file-selector-button { background-color: var(--accent-blue); color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; transition: background-color 0.2s ease; margin-right: 10px; }
input[type="file"]::file-selector-button:hover { background-color: #2980b9; }
.error-message { color: var(--accent-red); margin-top: var(--half-spacing); font-size: 0.9em; font-weight: 500;}
/* Dropdown Select Styling */
#patientSelect {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    padding-right: 30px; /* Space for the arrow */
    font-family: var(--font-main);
    font-size: 0.95em;
    color: var(--text-dark);
    width: 100%;
    max-width: 300px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232c3e50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    transition: border-color 0.2s ease;
    margin-bottom: var(--base-spacing);
}

#patientSelect:hover {
    border-color: var(--accent-blue);
}

#patientSelect:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Styling for the label */
label[for="patientSelect"] {
    display: block;
    margin-bottom: var(--quarter-spacing);
    font-weight: 500;
    color: var(--text-medium);
}

/* Button styling to match the design */
#runButton {
    background-color: var(--accent-blue);
    color: white;
    font-family: var(--font-main);
    font-size: 0.95em;
    font-weight: 500;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#runButton:hover {
    background-color: #2980b9; /* Slightly darker blue on hover */
}

#runButton:active {
    background-color: #2472a4; /* Even darker when pressed */
}

#runButton:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

/* Space the elements nicely */
h2 {
    color: var(--bg-dark);
    font-size: 1.3em;
    margin-bottom: var(--half-spacing);
    font-weight: 600;
}

/* Layout for the form elements */
.input-section {
    display: flex;
    flex-direction: column;
}

/* Add loading indicator to button when processing */
#runButton.loading {
    position: relative;
    pointer-events: none;
    background-color: #3498db;
    opacity: 0.8;
}

#runButton.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.section-abnormal-markers {
    margin-top: 20px;
}

.abnormal-marker-block {
    margin-bottom: 15px;
    padding: 10px;
    border-left: 4px solid #c0392b;
    background: #fdf2f2;
}

.abnormal-marker-block h3 {
    margin-bottom: 6px;
    font-size: 1.1em;
}

/* For smaller screens */
@media (max-width: 768px) {
    #patientSelect {
        max-width: 100%;
    }
}
.category-row td {
    background-color: #d0ebff;
    color: #000000;
    font-weight: bold;
    font-size: 1.05rem;
    padding: 10px 12px;
    text-transform: uppercase;
    border-top: 2px solid #b0daff;
    border-bottom: 2px solid #b0daff;
}

/* --- Dashboard Container --- */
.dashboard-container {
    width: 100%; /* Take full width of parent */
    max-width: var(--dashboard-max-width); /* ** APPLY MAX WIDTH CONSTRAINT HERE ** */
    margin: 0 auto; /* Center the container */
    background-color: transparent;
    border-radius: var(--panel-border-radius); /* Apply radius to the container */
    box-shadow: 0 5px 15px var(--shadow-color); /* Add shadow to the container */
    overflow: hidden; /* Contain child elements */
    border: 1px solid var(--border-light);
}

.dashboard-header {
    background: var(--bg-dark); color: var(--text-light); padding: var(--half-spacing) var(--base-spacing);
    border-bottom: 4px solid var(--accent-blue);
    /* Removed top border radius, container handles it */
}
/* Header content styling ... (Keep as before) */
.dashboard-header h1 { font-size: 1.5em; margin-bottom: var(--half-spacing); display: flex; align-items: center; font-weight: 600; }
.dashboard-header h1 i { margin-right: 12px; color: var(--accent-blue); font-size: 1.1em; }
.header-info { font-size: 0.85em; opacity: 0.9; display: flex; flex-wrap: wrap; gap: 5px 15px; }
.header-info strong { color: var(--accent-yellow); font-weight: 600; }


/* --- Dashboard Status Message --- */
#dashboardStatusMessage {
    text-align: center; padding: calc(var(--base-spacing) * 2) var(--base-spacing);
    font-size: 1.1em; color: var(--text-muted); background-color: var(--bg-panel);
    /* Removed border radius, container handles it */
    min-height: 100px; display: flex; align-items: center; justify-content: center;
    /* Removed border, container handles it */
}
#dashboardStatusMessage.error {
    color: var(--accent-red); font-weight: 500; background-color: #fdecea;
}

/* --- Dashboard Main Area --- */
.dashboard-main {
    display: flex; flex-direction: column; gap: var(--base-spacing);
    background-color: var(--bg-light); /* Give main area a light bg */
    padding: var(--base-spacing); /* Add padding around the sections */
}

/* Reusable Panel Style */
.panel {
     background-color: var(--bg-panel); padding: var(--base-spacing);
     border: 1px solid var(--border-light); border-radius: var(--panel-border-radius);
     box-shadow: 0 2px 5px var(--shadow-light); /* Lighter shadow for panels */
     display: flex; flex-direction: column;
}

/* Section Title / Subtitle Styling ... (Keep as before) */
.section-title { font-size: 1.2em; color: var(--bg-dark); margin-bottom: var(--base-spacing); padding-bottom: var(--half-spacing); border-bottom: 2px solid var(--accent-blue); display: flex; align-items: center; flex-shrink: 0; font-weight: 600; }
.section-title i { margin-right: 10px; color: var(--accent-blue); font-size: 1.05em; }
.section-subtitle { font-size: 0.9em; color: var(--text-muted); margin-top: calc(-1 * var(--half-spacing)); margin-bottom: var(--base-spacing); }
.subsection-title { font-size: 1em; color: var(--bg-medium); margin-bottom: var(--half-spacing); margin-top: var(--half-spacing); font-weight: 600; }
.subsection-title i { margin-right: 6px; opacity: 0.8; }


/* --- Section A: Overall Status --- */
.section-overall-status {
    display: flex; flex-wrap: wrap; gap: var(--base-spacing);
}
.status-left { /* Panel applied */
    flex: 1 1 400px; display: flex; flex-direction: column;
    align-items: center; min-width: 300px;
}
.status-right { /* Panel applied */
    flex: 1 1 320px; display: flex; min-width: 300px;
}
.glycemic-control.panel { width: 100%; justify-content: space-between; }

/* Gauge Styling ... (Keep as before) */
.gauge-container { width: 100%; max-width: 220px; aspect-ratio: 2 / 1.1; position: relative; margin-bottom: var(--half-spacing); display: flex; justify-content: center; align-items: flex-end; }
#riskGaugeChart { max-width: 100%; max-height: 182%; position: absolute; top: 0; left: 0; }
.gauge-label { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); font-size: 1.05em; font-weight: bold; z-index: 1; white-space: nowrap; }
.gauge-value { position: absolute; bottom: 1.5em; left: 50%; transform: translateX(-50%); font-size: 1em; color: var(--text-medium); font-weight: 500; z-index: 1; white-space: nowrap; }
/* Trajectory Bar Styling ... (Keep as before) */
.trajectory-container { width: 95%; max-width: 400px; margin-top: var(--base-spacing); }
.trajectory-bar { height: 20px; border-radius: 10px; background: linear-gradient(to right, var(--accent-green), var(--accent-yellow), var(--accent-orange), var(--accent-red), darken(var(--accent-red), 10%)); position: relative; display: flex; align-items: center; box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); overflow: hidden; }
.trajectory-stage { flex: 1; text-align: center; font-size: 0.65em; color: white; text-shadow: 1px 1px 1px rgba(0,0,0,0.5); font-weight: bold; opacity: 0; transition: opacity 0.3s; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.trajectory-bar:hover .trajectory-stage { opacity: 1; }
.trajectory-marker { position: absolute; bottom: -8px; font-size: 1.5em; transform: translateX(-50%); transition: left 0.5s ease-out; text-shadow: 0 0 3px white; z-index: 1; }
/* Glycemic Control Styling ... (Keep as before) */
.glycemic-control .panel-content { display: flex; flex-direction: column; gap: var(--half-spacing); }
.glycemic-control p { margin-bottom: 0; display: flex; justify-content: space-between; align-items: center; font-size: 0.95em; border-bottom: 1px solid var(--border-light); padding-bottom: var(--quarter-spacing); }
.glycemic-control p:last-of-type { border-bottom: none; }
.glycemic-control strong { color: var(--text-medium); margin-right: var(--base-spacing); font-weight: 500; flex-shrink: 0; }
.glycemic-value-unit { display: flex; align-items: center; gap: 5px; text-align: right; font-weight: 600; }
.glycemic-control span[id$="Status"] i { font-size: 0.9em; }
.status-icon-good { color: var(--accent-green); }
.status-icon-warning { color: var(--accent-orange); }
.status-icon-bad { color: var(--accent-red); }
.contrast-highlight { margin-top: var(--base-spacing); padding: var(--half-spacing); font-size: 0.85em; background-color: #fff3cd; border: 1px solid #ffeeba; border-left: 4px solid var(--accent-yellow); border-radius: 4px; color: #856404; display: flex; align-items: center; }
.contrast-highlight i { margin-right: 8px; font-size: 1.1em; color: #ffa500; }


/* --- Section B: Phenotype --- */
/* Phenotype Styling ... (Keep as before) */
.phenotype-content { gap: var(--base-spacing); }
.phenotype-dominant { gap: var(--base-spacing); align-items: flex-start; }
.phenotype-icon { font-size: 3em; margin-top: 5px; flex-shrink: 0; color: var(--accent-blue); }
.phenotype-dominant div { flex-grow: 1; }
.phenotype-dominant h3 { font-size: 1.25em; margin-bottom: 3px; color: var(--bg-dark);}
.phenotype-dominant p { font-size: 1em; margin-bottom: var(--quarter-spacing); }
.phenotype-dominant p strong { font-size: 1.05em; color: var(--accent-blue); }
.secondary-phenotypes { font-size: 0.8em; color: var(--text-muted); }
.phenotype-drivers ul { list-style: none; padding-left: 0; margin-top: var(--half-spacing); }
.phenotype-drivers li { margin-bottom: var(--quarter-spacing); font-size: 0.9em; display: flex; justify-content: space-between; align-items: center; }
.phenotype-drivers li strong { margin-right: var(--base-spacing); color: var(--text-medium); }
/* Status label styling ... (Keep as before) */
.status-label { display: inline-flex; align-items: center; padding: 3px 6px; border-radius: 4px; font-size: 0.9em; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.status-label i { margin-left: 4px; }
.status-high { color: var(--accent-red); border-color: var(--accent-red); background-color: #fdecea; }
.status-low { color: var(--accent-blue); border-color: var(--accent-blue); background-color: #eaf5fc; }
.status-normal { color: var(--accent-green); }
.status-flagged, .status-borderline { color: var(--accent-orange); border-color: var(--accent-orange); background-color: #fef3e8; }
.status-unknown { color: var(--text-muted); font-style: italic; }

/* --- Section C: Pathways --- */
.chart-container { height: 300px; margin-bottom: var(--half-spacing); position: relative; }
#pathwayChart { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.pathway-driver-details { margin-top: 5px; font-size: 0.8em; color: var(--text-muted); text-align: center;}

/* --- Section D: Complications --- */
.section-complications { /* Wrapper for title + content */
    display: flex; flex-direction: column; gap: 0;
}
.section-complications > .section-title { /* Main title */
     width: 100%; border-bottom: none; margin-bottom: var(--base-spacing);
}
.complications-content { /* Flex row for radar + details */
    display: flex; flex-wrap: wrap; gap: var(--base-spacing); align-items: stretch;
}
.complication-radar.panel { /* Panel applied */
    flex: 1 1 350px; min-height: 380px; display: flex; flex-direction: column;
}
.complication-radar .subsection-title { margin-bottom: var(--half-spacing); } /* Adjusted */
.complication-radar canvas { max-height: 300px; margin-top: auto; }
.complication-details.panel { /* Panel applied */
    flex: 1.5 1 450px; min-height: 380px; display: flex; flex-direction: column;
}
#complicationDetailsList { /* The list itself */
    list-style: none; padding: 0; margin-top: var(--half-spacing);
    flex-grow: 1; /* Let list fill space */
    /* REMOVED max-height and overflow-y */
}
/* Complication list item styling ... (Keep as before) */
#complicationDetailsList li { display: flex; align-items: flex-start; margin-bottom: var(--half-spacing); padding-bottom: var(--half-spacing); border-bottom: 1px solid var(--border-light); }
#complicationDetailsList li:last-child { border-bottom: none; margin-bottom: 0;}
.complication-icon { font-size: 1.5em; margin-right: var(--half-spacing); width: 30px; text-align: center; margin-top: 3px; flex-shrink: 0; }
.complication-info { flex-grow: 1; }
.complication-info .name { font-weight: 600; margin-bottom: var(--quarter-spacing); font-size: 1em; }
.complication-bar-percent { display: flex; align-items: center; margin-bottom: var(--quarter-spacing); }
.complication-risk-bar-container { height: 8px; background-color: var(--bg-light); border-radius: 4px; overflow: hidden; width: 120px; margin-right: 10px; border: 1px solid var(--border-light); }
.complication-risk-bar { height: 100%; border-radius: 3px; transition: width 0.5s ease-in-out;}
.complication-percent { font-weight: 600; min-width: 45px; text-align: left; font-size: 0.9em;}
.complication-drivers { font-size: 0.8em; color: var(--text-medium); margin-top: 2px; }
.complication-drivers i { margin-right: 3px; opacity: 0.7; }
/* Risk Colors ... (Keep as before) */
.risk-very-high { color: darken(var(--accent-red), 10%); }
.risk-high { color: var(--accent-red); }
.risk-moderate { color: var(--accent-orange); }
.risk-guarded { color: var(--accent-yellow); }
.risk-low { color: var(--accent-green); }
.complication-risk-bar.risk-very-high { background-color: darken(var(--accent-red), 10%);}
.complication-risk-bar.risk-high { background-color: var(--accent-red); }
.complication-risk-bar.risk-moderate { background-color: var(--accent-orange); }
.complication-risk-bar.risk-guarded { background-color: var(--accent-yellow); }
.complication-risk-bar.risk-low { background-color: var(--accent-green); }


 


/* --- Section E: Key Drivers Table --- */
.table-container {
    max-height: 400px; overflow-y: auto; border: 1px solid var(--border-light);
    border-radius: 4px; margin-top: var(--half-spacing);
}
#driversTable { width: 100%; border-collapse: collapse; table-layout: fixed; /* Helps with column widths */ }
#driversTable th, #driversTable td {
    padding: var(--half-spacing) var(--half-spacing); text-align: left;
    border-bottom: 1px solid var(--border-light); font-size: 0.88em;
    vertical-align: middle; overflow: hidden; text-overflow: ellipsis; /* Prevent content spill */
}
#driversTable th {
    background-color: var(--bg-medium); color: var(--text-light); font-weight: 600;
    position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
/* Align specific columns */
#driversTable th:nth-child(2), #driversTable td:nth-child(2) { text-align: right; }
#driversTable th:nth-child(3), #driversTable td:nth-child(3),
#driversTable th:nth-child(4), #driversTable td:nth-child(4),
#driversTable th:nth-child(6), #driversTable td:nth-child(6) { text-align: center; }

#driversTable td { color: var(--text-medium); }
#driversTable td:nth-child(1) { font-weight: 500; color: var(--text-dark); white-space: normal;} /* Allow wrap */
#driversTable td:nth-child(2) { font-weight: 600; color: var(--text-dark); white-space: nowrap;}
#driversTable td:nth-child(5) { white-space: nowrap; }

#driversTable tbody tr:nth-child(even) { background-color: #fdfdfe; }
#driversTable tbody tr:hover { background-color: #f0f3f4; }

/* Indicator Label Styling */
.indicator-label { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 0.85em; font-weight: 500; color: white; white-space: nowrap; }
.indicator-red { background-color: var(--accent-red); }
.indicator-white { background-color: var(--border-color); color: var(--text-dark); }
.indicator-yellow { background-color: var(--accent-yellow); color: var(--text-dark); }
.indicator-calculated { background-color: var(--bg-medium); color: var(--text-light); }
.indicator-n\/a, .indicator-absent, .indicator-clear, .indicator- { background-color: transparent; color: var(--text-muted); font-style: italic;}
.indicator-normal { background-color: transparent; color: var(--accent-green);}

/* Influence Icons Styling */
.influence-area-icons span { display: inline-flex; gap: 6px; justify-content: center; }
.influence-area-icon { opacity: 0.75; font-size: 1.1em; vertical-align: middle; transition: opacity 0.2s ease; }
.influence-area-icon:hover { opacity: 1; transform: scale(1.1); }
.fa-dna { color: var(--accent-blue); }
.fa-project-diagram { color: var(--accent-orange); }
.fa-heartbeat { color: var(--accent-red); }
.influence-area-icons span:-moz-only-whitespace { display: none; }

/* --- Footer --- */
.dashboard-footer {
    background-color: var(--bg-medium); color: var(--text-light); padding: var(--half-spacing) var(--base-spacing);
    text-align: center; font-size: 0.75em; opacity: 0.85; border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--panel-border-radius) var(--panel-border-radius); /* Round bottom */
    margin: 0; /* Footer is part of the container now */
}
.dashboard-footer p { margin-bottom: 3px; }

/* --- Responsive Adjustments --- */
@media (max-width: 1320px) { /* Add breakpoint close to max-width */
     :root { --base-spacing: 18px; } /* Slightly reduce spacing */
     html { font-size: 15px; }
}

@media (max-width: 992px) {
     :root { --base-spacing: 15px; }
     html { font-size: 15px; }
     .panel { padding: var(--base-spacing); }
     #driversTable th, #driversTable td { padding: 8px 10px; font-size: 0.85em; }
     .section-title { font-size: 1.15em;}
     .subsection-title { font-size: 1em;}
     .complication-details, .complication-radar { min-height: 360px;}
}

@media (max-width: 768px) {
    body { padding: 10px; }
    .page-wrapper { gap: 15px; }
    .dashboard-header { padding: 12px 15px; }
    .dashboard-header h1 { font-size: 1.3em; }
    .header-info { font-size: 0.8em; }
    .dashboard-main { gap: 15px; padding: var(--base-spacing); } /* Add padding back */

    /* Stack overall status and complications sections */
    .section-overall-status, .complications-content {
        flex-direction: column;
    }
    .section-overall-status > div, .complications-content > div {
        flex-basis: auto; width: 100%;
    }
    .complication-radar, .complication-details { min-height: auto;}
    .complication-radar { min-height: 280px;} /* Keep radar reasonable */

     /* Table horizontal scroll */
     .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
     #driversTable { width: 100%; min-width: 650px; table-layout: auto; } /* Let table size itself for scroll */
     #driversTable th, #driversTable td { white-space: nowrap; }
     #driversTable td:nth-child(1) { white-space: normal; } /* Allow wrap */
}

@media (max-width: 480px) {
     html { font-size: 14px; }
      .dashboard-header h1 { font-size: 1.1em; }
       .header-info { flex-direction: column; align-items: flex-start; gap: 3px;}
       .panel { padding: 12px;}
       .section-title { font-size: 1.1em;}
       .subsection-title { font-size: 0.95em;}
       .gauge-container { max-width: 180px; aspect-ratio: 2 / 1.2; }
       .gauge-label { font-size: 0.9em;}
       .gauge-value { font-size: 0.85em; bottom: 1.4em;}
       #driversTable th, #driversTable td { font-size: 0.8em; padding: 6px 8px;}
       .status-label { padding: 2px 4px; font-size: 0.85em;}
       .indicator-label { padding: 1px 4px; font-size: 0.8em;}
       .complication-icon { font-size: 1.4em; width: 25px; margin-right: 10px;}
       .complication-risk-bar-container { width: 100px; }
       #driversTable { min-width: 550px; }
}

.complication-report-block {
    background-color: #ffffff;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent-blue);
    border-radius: 4px;
    padding: var(--half-spacing);
    margin-bottom: var(--half-spacing);
}

.complication-report-block:last-child {
    margin-bottom: 0;
}

.complication-report-block h3 {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--bg-dark);
    margin-bottom: var(--half-spacing);
}

.complication-report-block ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.complication-report-block li {
    font-size: 0.9em;
    color: var(--text-medium);
    padding-bottom: var(--quarter-spacing);
    margin-bottom: var(--quarter-spacing);
    border-bottom: 1px dashed var(--border-light);
}

.complication-report-block li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.complication-report-block li strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* Styling for adjusted phenotype percentage */
.adjusted-phenotype {
    font-size: 0.8em;
    font-weight: 500;
    color: var(--text-medium);
    margin-left: 5px;
    font-style: italic;
}

/* Grid layout for new sections */
.medication-grid, .conditions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Adjusted min-width for better fit */
    gap: var(--base-spacing);
    width: 100%;
}

/* Card styling for Medication Analysis - Main Columns */
.medication-card {
    background-color: #f8f9fa; /* Light grey background for the card */
    border: 1px solid var(--border-light);
    border-radius: var(--panel-border-radius);
    padding: var(--half-spacing);
    display: flex;
    flex-direction: column;
}

.medication-card h3 {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--bg-dark);
    margin-bottom: var(--half-spacing);
    padding-bottom: var(--quarter-spacing);
    display: flex;
    align-items: center;
    border-bottom: none; /* No border on the card title */
}

.medication-card h3 i {
    margin-right: 8px;
    color: var(--text-medium); /* Muted icon color */
}



/* 1. Identified Active Medications Card */
.med-list-item {
    font-size: 0.9em;
    padding-bottom: var(--quarter-spacing);
    margin-bottom: var(--quarter-spacing);
    border-bottom: 1px solid var(--border-light);
}
.med-list-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.med-list-item strong {
    font-weight: 600;
}

/* 2. & 3. Biomarker/Considerations Sub-Cards */
.effect-item, .consideration-item {
    background-color: #ffffff; /* White background for the inner items */
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: var(--half-spacing);
    margin-bottom: var(--half-spacing);
}
.effect-item:last-child, .consideration-item:last-child {
    margin-bottom: 0;
}

.effect-item h4, .consideration-item h4 {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 5px 0;
    display: flex;
    align-items: flex-start;
}

.effect-item p, .consideration-item p {
    font-size: 0.88em;
    color: var(--text-medium);
    line-height: 1.5;
    margin: 0;
}

.effect-item h4 i {
    color: var(--accent-blue);
    margin-right: 6px;
    font-size: 0.9em;
    margin-top: 3px;
}

.consideration-item h4 i {
    color: var(--accent-orange);
    margin-right: 6px;
    font-size: 0.9em;
    margin-top: 3px;
}

/* Card styling for Detected Conditions */
.condition-card {
    background: #fdf2f2;
    border-left: 5px solid var(--accent-red);
    padding: var(--base-spacing);
    border-radius: 0 var(--panel-border-radius) var(--panel-border-radius) 0;
}

.condition-card h3 {
    font-size: 1.1em;
    color: var(--accent-red);
    font-weight: 600;
    margin-bottom: var(--quarter-spacing);
    display: flex;
    align-items: center;
}

.condition-card h3 i {
    margin-right: 8px;
}

.condition-card p {
    font-size: 0.9em;
    margin-bottom: var(--half-spacing);
    line-height: 1.5;
}

.condition-card .suggestion {
    font-weight: 500;
}

.condition-card .key-indicators {
    font-size: 0.8em;
    color: var(--text-medium);
    margin-top: var(--half-spacing);
}

.condition-card .key-indicators strong {
    color: var(--text-dark);
}

/* Styling for the enhanced Abnormal Marker Categories section */
.abnormal-marker-block ul {
    list-style-type: none;
    padding-left: 0;
    margin-top: 8px;
    margin-bottom: 12px;
}

.abnormal-marker-block li {
    font-size: 0.9em;
    padding: 5px 0;
    border-bottom: 1px dashed var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.abnormal-marker-block li:last-child {
    border-bottom: none;
}

.abnormal-marker-block li small {
    color: var(--text-medium);
    margin-left: 10px;
}

/* Use existing status-high/low classes for coloring values */
.abnormal-marker-block .status-high {
    font-weight: 600;
}

.abnormal-marker-block .status-low {
    font-weight: 600;
}

.abnormal-marker-block p {
    font-size: 0.9em;
    margin: 0;
}

/* Loader Overlay */
.loader-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

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