
    .chart-container {
        position: relative;
        height: 400px;
        width: 100%;
        margin-bottom: 30px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        background-color: white;
        padding: 20px;
    }
    
    canvas {
        -moz-user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Make sure chart container divs have this class */
    #glucose-simulation-chart, 
    #metrics-comparison-chart {
        width: 100%;
        height: 100%;
    }
    
    .chart-tooltip {
        background-color: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 10px;
        border-radius: 4px;
        pointer-events: none;
        z-index: 10000;
        font-size: 14px;
    }
    
    /* Add high-contrast styles for better readability */
    .positive-change {
        color: #00a651;
        font-weight: bold;
    }
    
    .negative-change {
        color: #e41e26;
        font-weight: bold;
    }

// Add this to your CSS or include it inline
$('head').append(`
    <style>
    .api-notice {
        background-color: #fff3cd;
        color: #856404;
        padding: 10px;
        margin-bottom: 15px;
        border-radius: 4px;
        border-left: 4px solid #ffeeba;
        font-size: 14px;
    }
    </style>
`);
#error-container {
    display: none;
    color: red;
    padding: 10px;
    background: #ffe6e6;
    border: 1px solid #ff9999;
    border-radius: 5px;
    margin: 10px 0;
}
#charts_container {
    max-width: 1200px;
    margin: 0 auto;
}

.charts-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Base chart card styling */
.chart-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    position: relative;
    overflow: hidden;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Full-width charts (Health Metrics, Lifestyle Impact Heatmap) */
.chart-card.full-width {
    height: 500px;
    max-height: 500px;
    min-height: 500px;
}

/* Container for smaller charts */
.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
}

/* Small charts (Treatment Response, Risk Assessment, Glycemic Risk Score) */
.chart-card.small {
    height: 300px;
    max-height: 300px;
}

/* Wide charts (Glucose Control Analysis, Insulin Sensitivity Trend) */
.chart-card.wide {
    grid-column: span 2;
    height: 400px;
    max-height: 400px;
}

/* Ensure canvas fits within card */
.chart-card canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: calc(100% - 30px); /* Account for title height */
}

/* Title styling */
.chart-card h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1em;
    text-align: center;
}

/* Specific styling for new charts */

/* Glycemic Risk Score (Doughnut Chart) */
.chart-card.small#riskScoreChart-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.chart-card.small#riskScoreChart-card canvas {
    max-width: 250px; /* Constrain doughnut size */
    max-height: 250px;
}

/* Insulin Sensitivity Trend (Line Chart) */
.chart-card.wide#sensitivityChart-card {
    padding-bottom: 20px; /* Extra space for x-axis labels */
}

.chart-card.wide#sensitivityChart-card canvas {
    max-height: 350px; /* Leave room for title and legend */
}

/* Lifestyle Impact Heatmap (Stacked Bar Chart) */
.chart-card.full-width#lifestyleHeatmap-card {
    padding-bottom: 25px; /* Space for x-axis labels */
}

.chart-card.full-width#lifestyleHeatmap-card canvas {
    max-height: 450px; /* Leave room for title and legend */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chart-row {
        grid-template-columns: 1fr;
    }
    .chart-card.wide {
        grid-column: auto;
    }
    .charts-grid {
        padding: 10px;
    }
    .chart-card.full-width {
        height: 400px; /* Reduce height on smaller screens */
        max-height: 400px;
    }
    .chart-card.small {
        height: 250px;
        max-height: 250px;
    }
    .chart-card.wide {
        height: 350px;
        max-height: 350px;
    }
}

/* Additional global styles (unchanged) */
canvas {
    width: 100% !important;
    height: 100% !important;
}



.patient-data-container {
    padding: 20px;
}

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.analytics-summary > div {
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: white;
}

.prediction-card {
    border-left: 4px solid #4CAF50;
}

.treatment-card {
    border-left: 4px solid #2196F3;
}

.risk-card {
    border-left: 4px solid #FFC107;
}

.risk-card.high {
    border-left-color: #f44336;
}

.risk-card.moderate {
    border-left-color: #FF9800;
}

.risk-card.low {
    border-left-color: #4CAF50;
}

.analytics-summary h4 {
    margin-top: 0;
    color: #333;
    font-size: 1.1em;
}

.analytics-summary p {
    margin: 8px 0;
    color: #666;
}
.arrow-indicator {
    display: none;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px;
    cursor: pointer;
    z-index: 1001;
}

.arrow-left { left: 10px; }
.arrow-right { right: 10px; }

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    overflow-x: hidden;
}



#content-wrapper {
    padding: 20px;
    overflow: overlay;
    max-width: 100%;
margin-right: 100px;
    box-sizing: content-box;

}

button, .btn {
    background-color: #007bff;
    color: #fff;
    padding: 10px 15px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

button:hover, .btn:hover {
    background-color: #0056b3;
}

#open-patient-drawer {
    position: fixed;
    z-index: 100;
    color: white;
    margin-top: 200px;
    margin-left: -50px;
    transform: translateY(-50%) rotate(90deg);
    left: 3px;
    box-shadow: 0 4px 7px 6px rgb(39 43 46 / 30%);
}

h1 {
    color: #333;
    text-align: center;
    font-weight: 300;
    font-size: 2em;
}

#patient_table_container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 20px;
}

#patient_table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

#patient_table thead {
    position: sticky;
    top: 0;
    background-color: #f0f0f0;
    z-index: 1;
}

table, th, td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: left;
    color: #333;
}

th {
    background-color: #f0f0f0;
    white-space: nowrap;
}

input[type="text"], select, textarea {
    padding: 8px;
    margin: 5px 0;
    box-sizing: border-box;
    width: 100%;
}

input[type="button"], button {
    color: #fff;
    border: none;
    cursor: pointer;
    width: auto;
    margin-bottom: 10px;
}

button[style*="background-color:red"], input[type='button'][style*='background-color:red'] {
    background-color: #d9534f;
}

#submit {
    background-color: #5cb85c;
}

fieldset {
    border: 2px solid #ccc;
    padding: 20px;
    margin-bottom: 20px;
}

#error_msg {
    color: red;
    font-weight: bold;
}

#bg_table {
    background-image: url("https://images.pexels.com/photos/9175911/pexels-photo-9175911.jpeg");
    background-size: cover;
    padding: 20px;
    width: 100%;
}

.ui-datepicker-trigger {
    margin-left: 5px;
    vertical-align: middle;
}

input[contenteditable="true"] {
    background-color: #b3d9ff;
}

#patient-drawer {
    top: 50px;
    right: 0;
    width: 100%;
    height: 100%;
    background: white;
    border-left: 1px solid #ccc;
    padding: 20px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow: visible;
}

#patient-drawer-header {
    cursor: move;
    padding: 10px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
}

#patient-drawer.open {
    transform: translateX(0);
}

.edit-button, .delete-button {
    padding: 5px 10px;
    cursor: pointer;
    margin: 0;
    border: none;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.edit-button {
    background-color: #4CAF50;
    color: white;
}

.delete-button {
    background-color: red;
    color: white;
}

.edit-button:hover {
    background-color: #45a049;
}

.delete-button:hover {
    background-color: #d9534f;
}

#visits_container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 20px;
}

#chart_container {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
    padding: 20px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#patientProgressChart {
    min-width: 600px;
    height: 400px;
}

.chartjs-title {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}

.chartjs-tooltip {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 3px;
    padding: 5px;
}

.chartjs-legend {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.chartjs-legend li {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.chartjs-legend span {
    display: block;
    width: 20px;
    height: 20px;
    margin-right: 5px;
}

.tabs {
    overflow: hidden;
    background-color: #f1f1f1;
    margin-top: 20px;
}

.tablink {
    background-color: #999;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 17px;
}

.tablink:hover {
    background-color: #ddd;
}

.tablink.active {
    background-color: #3c6db8;
}

.tabcontent {
    display: none;
    padding: 20px;
    border-top: none;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    overflow-x: visible;
}

/* Responsive Design */
@media (max-width: 768px) {
    #patient_table_container, #visits_container, #chart_container {
        overflow-x: auto;
    }

    table, thead, tbody, th, td, tr {
        display: contents;
    }

    th, td {
        padding: 10px;
        text-align: right;
    }

    th::before, td::before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
    }

    th:last-child, td:last-child {
        border-bottom: 0;
    }

    input[type="text"], select, textarea {
        width: 100%;
    }
}

/* Diabetes Management Tools Styling */
    .prediction-tools {
        margin: 20px 0;
        padding: 15px;
        background: #f8f9fa;
        border-radius: 8px;
        border: 1px solid #dee2e6;
    }
    
    .prediction-tools h3 {
        margin-top: 0;
        margin-bottom: 15px;
        color: #495057;
    }
    
    .prediction-tools button {
        padding: 8px 16px;
        margin-right: 10px;
        margin-bottom: 10px;
        background: #0d6efd;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: background 0.3s;
    }
    
    .prediction-tools button:hover {
        background: #0b5ed7;
    }
    
    .prediction-tools button:disabled {
        background: #6c757d;
        cursor: not-allowed;
    }
    
    /* Results Styling */
    #previous-visit-data, #prediction-results, 
    #risk-assessment-results, #insulin-calculator-results,
    #treatment-recommendations {
        margin-top: 20px;
        padding: 15px;
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 8px;
    }
    
    /* Risk indicators */
    .risk-indicator {
        display: inline-block;
        padding: 4px 10px;
        border-radius: 4px;
        color: white;
        font-weight: bold;
    }
    
    .risk-indicator.high {
        background: #dc3545;
    }
    
    .risk-indicator.moderate {
        background: #fd7e14;
    }
    
    .risk-indicator.low {
        background: #198754;
    }
    
    /* BMI Category Styling */
    #bmi-category {
        margin-top: 5px;
        font-weight: bold;
    }
    
    .underweight { color: #0dcaf0; }
    .normal { color: #198754; }
    .overweight { color: #fd7e14; }
    .obese-1, .obese-2, .obese-3 { color: #dc3545; }
    
    /* Recommendation styling */
    .recommendation-item {
        margin-bottom: 15px;
        padding: 10px;
        border-radius: 4px;
        border-left: 5px solid #dee2e6;
    }
    
    .recommendation-item.high {
        border-left-color: #dc3545;
        background: rgba(220, 53, 69, 0.1);
    }
    
    .recommendation-item.medium {
        border-left-color: #fd7e14;
        background: rgba(253, 126, 20, 0.1);
    }
    
    .recommendation-item.low {
        border-left-color: #198754;
        background: rgba(25, 135, 84, 0.1);
    }
    
    /* Insulin calculator results */
    .insulin-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 15px;
    }
    
    .insulin-table th, .insulin-table td {
        padding: 8px;
        border: 1px solid #dee2e6;
        text-align: center;
    }
    
    .insulin-table th {
        background: #f8f9fa;
    }
    
    .total-row {
        font-weight: bold;
        background: #f8f9fa;
    }

.analytics-section, .advanced-analytics-section {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.analytics-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.analytics-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.analytics-card p, .analytics-card li {
    margin: 5px 0;
    color: #34495e;
}

.analytics-card canvas {
    max-height: 300px;
}