:root {
    --primary-color: #0056b3;
    /* Medical Blue */
    --secondary-color: #00a8cc;
    /* Lighter Blue/Cyan */
    --accent-color: #ff6b6b;
    /* Soft Red for alerts/important stats */
    --bg-color: #f4f7f6;
    /* Very light cool gray */
    --text-color: #333;
    --sidebar-width: 250px;
    --header-height: 60px;
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 6px rgba(0, 0, 0, 0.1);
    --font-family: 'Inter', 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
    display: flex;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: margin-left 0.3s ease;
}

.brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
}

.brand i {
    margin-right: 10px;
    font-size: 1.4rem;
}

.nav-links {
    list-style: none;
    padding: 20px 0;
}

.nav-links li a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-links li a:hover,
.nav-links li a.active {
    background: #f0f7ff;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-links li a i {
    width: 25px;
    text-align: center;
    margin-right: 8px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.top-bar {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow-light);
    z-index: 9;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #666;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Dashboard Grid */
.dashboard-container {
    flex: 1;
    display: flex;
    padding: 20px;
    gap: 20px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.map-container {
    flex: 3;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    position: relative;
    /* For map controls */
    border: 1px solid #e0e0e0;
}

#map {
    width: 100%;
    height: 100%;
}

.stats-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 300px;
    overflow-y: auto;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    border-top: 4px solid var(--primary-color);
}

.stat-card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
}

.stat-card .trend {
    font-size: 0.85rem;
    margin-top: 5px;
}

.stat-card.blue {
    border-top-color: var(--primary-color);
}

.stat-card.cyan {
    border-top-color: var(--secondary-color);
}

.stat-card.red {
    border-top-color: var(--accent-color);
}

/* Quick Actions Button */
.fab {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0, 86, 179, 0.3);
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 1000;
}

.fab:hover {
    transform: scale(1.05);
    background: #004494;
}

/* Map Specifics */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: var(--shadow-card);
}

.leaflet-popup-content h3 {
    margin: 0 0 5px;
    color: var(--primary-color);
    font-family: var(--font-family);
}

.leaflet-container {
    font-family: var(--font-family);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: white;
    width: 600px;
    /* Widened slightly */
    max-width: 90%;
    max-height: 85vh;
    /* Ensure it doesn't take full screen but enough */
    overflow-y: auto;
    /* Scroll if content exceeds height */
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-family);
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-family: var(--font-family);
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #004494;
}