<!
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Responsive Medical Dashboard</title>
<script src="[Link]
<style>
body {
margin: 0;
font-family: 'Segoe UI', sans-serif;
background: #f4f7fb;
}
.container {
display: flex;
min-height: 100vh;
}
/* Sidebar */
.sidebar {
width: 240px;
min-height: 100vh;
background: #0f172a;
color: white;
padding: 20px;
transition: 0.3s;
}
.sidebar h2 {
margin-bottom: 30px;
}
.sidebar button {
width: 100%;
padding: 12px;
margin: 6px 0;
background: none;
border: none;
color: #cbd5e1;
text-align: left;
cursor: pointer;
border-radius: 8px;
}
.sidebar button:hover {
background: #1e293b;
color: white;
}
/* Main */
.main {
flex: 1;
padding: 20px;
}
/* Cards */
.cards {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 15px;
}
.card {
background: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}
.card h4 {
margin: 0;
color: gray;
}
/* Chart section */
.chart-container {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 20px;
margin-top: 30px;
}
.chart, .circle-box {
background: white;
padding: 20px;
border-radius: 12px;
}
/* Tables */
.section {
margin-top: 30px;
background: white;
padding: 20px;
border-radius: 12px;
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 10px;
border-bottom: 1px solid #eee;
}
.status {
padding: 5px 10px;
border-radius: 8px;
font-size: 12px;
}
.active { background: #dcfce7; color: green; }
/* -------- RESPONSIVE -------- */
/* Tablet */
@media(max-width: 1000px){
.cards {
grid-template-columns: repeat(2, 1fr);
}
.chart-container {
grid-template-columns: 1fr;
}
}
/* Mobile */
@media(max-width: 768px){
.container {
flex-direction: column;
}
.sidebar {
width: 100%;
height: auto;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.sidebar h2 {
width: 100%;
text-align: center;
}
.sidebar button {
flex: 1 1 45%;
text-align: center;
}
.main {
padding: 15px;
}
.cards {
grid-template-columns: 1fr;
}
canvas {
width: 100% !important;
height: auto !important;
}
}
/* Small Mobile */
@media(max-width: 480px){
.sidebar button {
flex: 1 1 100%;
}
h2 {
font-size: 18px;
}
.card h2 {
font-size: 18px;
}
th, td {
font-size: 12px;
padding: 8px;
}
}
</style>
</head>
<body>
<div class="container">
<!-- Sidebar -->
<div class="sidebar">
<h2>🏥 MedSystem</h2>
<button>Dashboard</button>
<button>Patients</button>
<button>Doctors</button>
<button>Pharmacy</button>
<button>Reports</button>
</div>
<!-- Main -->
<div class="main">
<h2>Doctor / Admin Dashboard</h2>
<!-- Cards -->
<div class="cards">
<div class="card">
<h4>Total Patients</h4>
<h2>1200</h2>
</div>
<div class="card">
<h4>Served Today</h4>
<h2>45</h2>
</div>
<div class="card">
<h4>Daily Revenue</h4>
<h2>$1200</h2>
</div>
<div class="card">
<h4>Monthly Revenue</h4>
<h2>$32000</h2>
</div>
</div>
<!-- Charts -->
<div class="chart-container">
<!-- Bar Chart -->
<div class="chart">
<h3>Revenue Overview</h3>
<canvas id="barChart"></canvas>
</div>
<!-- Circle Chart -->
<div class="circle-box">
<h3>Service Performance</h3>
<canvas id="circleChart"></canvas>
</div>
</div>
<!-- Patient Table -->
<div class="section">
<h3>Patient List</h3>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Doctor</th>
<th>Status</th>
<th>Amount</th>
</tr>
<tr>
<td>P001</td>
<td>John</td>
<td>Dr. Smith</td>
<td><span class="status active">Done</span></td>
<td>$50</td>
</tr>
<tr>
<td>P002</td>
<td>Mary</td>
<td>Dr. Adams</td>
<td><span class="status active">Done</span></td>
<td>$70</td>
</tr>
<tr>
<td>P003</td>
<td>David</td>
<td>Dr. Brown</td>
<td><span class="status active">Done</span></td>
<td>$40</td>
</tr>
</table>
</div>
<!-- Medicine Table -->
<div class="section">
<h3>Medicine Inventory</h3>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Stock</th>
<th>Price</th>
</tr>
<tr>
<td>M001</td>
<td>Paracetamol</td>
<td>200</td>
<td>$2</td>
</tr>
<tr>
<td>M002</td>
<td>Amoxicillin</td>
<td>50</td>
<td>$5</td>
</tr>
<tr>
<td>M003</td>
<td>Ibuprofen</td>
<td>20</td>
<td>$3</td>
</tr>
</table>
</div>
</div>
</div>
<script>
/* Bar Chart */
new Chart([Link]('barChart'), {
type: 'bar',
data: {
labels: ['Week1','Week2','Week3','Week4'],
datasets: [{
label: 'Revenue',
data: [5000, 8000, 7000, 9000]
}]
}
});
/* Circle Chart with Center Text */
const centerText = {
id: 'centerText',
beforeDraw(chart) {
const {width, height, ctx} = chart;
[Link]();
[Link] = "20px Arial";
[Link] = "center";
[Link] = "middle";
[Link]("75%", width / 2, height / 2);
[Link]();
}
};
new Chart([Link]('circleChart'), {
type: 'doughnut',
data: {
labels: ['Served','Remaining'],
datasets: [{
data: [75, 25],
backgroundColor: ['#22c55e','#e5e7eb']
}]
},
options: {
cutout: '70%'
},
plugins: [centerText]
});
</script>
</body>
</html>