<?php
session_start();
require_once '../../../dripend/includes/db.php';

$staff_name = $_SESSION['first_name'] ?? 'System Admin';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IPD Master Configuration | eRHAMS</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<style>
    @font-face {
        font-family: 'Inter';
        src: url('/rimax/application/assets/fonts/Inter-Regular.woff2') format('woff2');
        font-weight: 400;
        font-style: normal;
    }
    :root {
        --bg-color: #f8fafc;
        --card-bg: #ffffff;
        --border-color: #e2e8f0;
        --text-main: #0f172a;
        --text-muted: #64748b;
        
        /* Category Colors */
        --c-infra: #10b981; /* Emerald */
        --c-infra-bg: #d1fae5;
        --c-surgery: #e11d48; /* Rose */
        --c-surgery-bg: #ffe4e6;
        --c-nursing: #3b82f6; /* Blue */
        --c-nursing-bg: #dbeafe;
        --c-billing: #f59e0b; /* Amber */
        --c-billing-bg: #fef3c7;
        --c-mapping: #8b5cf6; /* Violet */
        --c-mapping-bg: #ede9fe;
    }

    body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg-color); color: var(--text-main); }
    
    .dashboard-container { max-width: 1400px; margin: 0 auto; padding: 40px 20px; }
    
    .welcome-banner { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); color: #fff; padding: 30px 40px; border-radius: 16px; margin-bottom: 40px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); display: flex; justify-content: space-between; align-items: center;}
    .welcome-text h1 { font-weight: 800; font-size: 26px; margin-bottom: 8px; }
    .welcome-text p { color: #94a3b8; font-size: 15px; margin: 0; }
    .date-badge { background: rgba(255,255,255,0.1); padding: 10px 20px; border-radius: 50px; font-weight: 600; font-size: 14px; backdrop-filter: blur(10px); }

    .category-section { margin-bottom: 45px; }
    .category-title { font-size: 17px; font-weight: 700; color: var(--text-main); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; text-transform: uppercase; letter-spacing: 0.5px;}
    .category-title::after { content: ''; flex: 1; height: 1px; background: var(--border-color); margin-left: 10px; }

    .grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 15px; }
    
    .grid-item { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px; padding: 20px 15px; text-decoration: none; color: var(--text-main); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; align-items: center; gap: 15px; position: relative; overflow: hidden; }
    .grid-item:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.06); border-color: transparent; color: var(--text-main); }
    
    .grid-item::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--hover-color); opacity: 0; transition: opacity 0.3s ease; z-index: 0; }
    .grid-item:hover::before { opacity: 0.05; }
    
    .icon-wrapper { width: 45px; height: 45px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; z-index: 1; transition: transform 0.3s ease; flex-shrink: 0;}
    .grid-item:hover .icon-wrapper { transform: scale(1.1); }
    
    .item-label { font-weight: 600; font-size: 14px; z-index: 1; line-height: 1.3; }

    /* Category Specific Colors */
    .cat-infra .icon-wrapper { background: var(--c-infra-bg); color: var(--c-infra); }
    .cat-infra.grid-item { --hover-color: var(--c-infra); }
    
    .cat-surgery .icon-wrapper { background: var(--c-surgery-bg); color: var(--c-surgery); }
    .cat-surgery.grid-item { --hover-color: var(--c-surgery); }

    .cat-nursing .icon-wrapper { background: var(--c-nursing-bg); color: var(--c-nursing); }
    .cat-nursing.grid-item { --hover-color: var(--c-nursing); }

    .cat-billing .icon-wrapper { background: var(--c-billing-bg); color: var(--c-billing); }
    .cat-billing.grid-item { --hover-color: var(--c-billing); }

    .cat-mapping .icon-wrapper { background: var(--c-mapping-bg); color: var(--c-mapping); }
    .cat-mapping.grid-item { --hover-color: var(--c-mapping); }

</style>
</head>
<body>


<div class="dashboard-container">
    <div class="welcome-banner">
        <div class="welcome-text">
            <h1>IPD System Configuration & Masters</h1>
            <p>Configure hospital infrastructure, mappings, checklists, and enterprise dictionaries.</p>
        </div>
        <div class="date-badge">
            <i class="fa-solid fa-gears" style="margin-right: 8px;"></i> Master Setup
        </div>
    </div>

    <!-- SECTION 1: Infrastructure & Rooms -->
    <div class="category-section">
        <h3 class="category-title" style="color: var(--c-infra);">
            <i class="fa-solid fa-building-circle-check"></i> Ward & Room Infrastructure
        </h3>
        <div class="grid-container">
            <a href="ipd/roomWardManagement.php" class="grid-item cat-infra">
                <div class="icon-wrapper"><i class="fa-solid fa-bed"></i></div>
                <span class="item-label">Room / Ward Management</span>
            </a>
            <a href="ipd/wardCategoryMaster.php" class="grid-item cat-infra">
                <div class="icon-wrapper"><i class="fa-solid fa-layer-group"></i></div>
                <span class="item-label">Ward Category </span>
            </a>
            <a href="ipd/wardTypeMaster.php" class="grid-item cat-infra">
                <div class="icon-wrapper"><i class="fa-solid fa-tags"></i></div>
                <span class="item-label">Ward Type </span>
            </a>
            <a href="ipd/roomCategoryMaster.php" class="grid-item cat-infra">
                <div class="icon-wrapper"><i class="fa-solid fa-door-open"></i></div>
                <span class="item-label">Room Category </span>
            </a>
            <a href="ipd/roomGroupMaster.php" class="grid-item cat-infra">
                <div class="icon-wrapper"><i class="fa-solid fa-object-group"></i></div>
                <span class="item-label">Room Group </span>
            </a>
            <a href="ipd/wardMaintenanceCharges.php" class="grid-item cat-infra">
                <div class="icon-wrapper"><i class="fa-solid fa-wrench"></i></div>
                <span class="item-label">Manage Ward Maintenance Charges</span>
            </a>
        </div>
    </div>

    <!-- SECTION 2: Surgery & OT Setup -->
    <div class="category-section">
        <h3 class="category-title" style="color: var(--c-surgery);">
            <i class="fa-solid fa-kit-medical"></i> Surgery & Theatre Configuration
        </h3>
        <div class="grid-container">
            <a href="ipd/surgeryMaster.php" class="grid-item cat-surgery">
                <div class="icon-wrapper"><i class="fa-solid fa-scalpel-line-dashed"></i></div>
                <span class="item-label">Surgery </span>
            </a>
            <a href="ipd/surgeryChecklistMaster.php" class="grid-item cat-surgery">
                <div class="icon-wrapper"><i class="fa-solid fa-clipboard-check"></i></div>
                <span class="item-label">Surgery Checklist </span>
            </a>
            <a href="ipd/surgeryTemplate.php" class="grid-item cat-surgery">
                <div class="icon-wrapper"><i class="fa-solid fa-file-medical"></i></div>
                <span class="item-label">Manage Surgery Template</span>
            </a>
            <a href="ipd/otMaster.php" class="grid-item cat-surgery">
                <div class="icon-wrapper"><i class="fa-solid fa-door-closed"></i></div>
                <span class="item-label">OT </span>
            </a>
            <a href="ipd/cssdKitMaster.php" class="grid-item cat-surgery">
                <div class="icon-wrapper"><i class="fa-solid fa-box-archive"></i></div>
                <span class="item-label">CSSD Kit </span>
            </a>
            <a href="ipd/doctorSurgeryMaster.php" class="grid-item cat-surgery">
                <div class="icon-wrapper"><i class="fa-solid fa-user-doctor"></i></div>
                <span class="item-label">Doctor Surgery </span>
            </a>
            <a href="ipd/anesthetistMaster.php" class="grid-item cat-surgery">
                <div class="icon-wrapper"><i class="fa-solid fa-mask-ventilator"></i></div>
                <span class="item-label">Anesthetist </span>
            </a>
            <a href="ipd/theaterNurseMaster.php" class="grid-item cat-surgery">
                <div class="icon-wrapper"><i class="fa-solid fa-user-nurse"></i></div>
                <span class="item-label">Theater Nurse </span>
            </a>
        </div>
    </div>

    <!-- SECTION 3: Nursing & Clinical Checklists -->
    <div class="category-section">
        <h3 class="category-title" style="color: var(--c-nursing);">
            <i class="fa-solid fa-clipboard-user"></i> Nursing & Clinical Checklists
        </h3>
        <div class="grid-container">
            <a href="ipd/nursingCarePlanMaster.php" class="grid-item cat-nursing">
                <div class="icon-wrapper"><i class="fa-solid fa-notes-medical"></i></div>
                <span class="item-label">Nursing Care Plan </span>
            </a>
            <a href="ipd/nurseChecklistMaster.php" class="grid-item cat-nursing">
                <div class="icon-wrapper"><i class="fa-solid fa-list-check"></i></div>
                <span class="item-label">Nurse Checklist </span>
            </a>
            <a href="ipd/admissionChecklistMaster.php" class="grid-item cat-nursing">
                <div class="icon-wrapper"><i class="fa-solid fa-clipboard-list"></i></div>
                <span class="item-label">Admission Checklist </span>
            </a>
            <a href="ipd/dischargeChecklistMaster.php" class="grid-item cat-nursing">
                <div class="icon-wrapper"><i class="fa-solid fa-file-export"></i></div>
                <span class="item-label">Discharge Checklist </span>
            </a>
            <a href="ipd/ipdSpecialForms.php" class="grid-item cat-nursing">
                <div class="icon-wrapper"><i class="fa-solid fa-file-signature"></i></div>
                <span class="item-label">Manage IPD Special Forms</span>
            </a>
            <a href="ipd/ipdShifts.php" class="grid-item cat-nursing">
                <div class="icon-wrapper"><i class="fa-solid fa-clock"></i></div>
                <span class="item-label">IPD Shifts</span>
            </a>
        </div>
    </div>

    <!-- SECTION 4: Services, Billing & Packages -->
    <div class="category-section">
        <h3 class="category-title" style="color: var(--c-billing);">
            <i class="fa-solid fa-file-invoice-dollar"></i> Services & Billing Setup
        </h3>
        <div class="grid-container">
            <a href="ipd/ipdServiceMaster.php" class="grid-item cat-billing">
                <div class="icon-wrapper"><i class="fa-solid fa-hand-holding-medical"></i></div>
                <span class="item-label">IPD Service </span>
            </a>
            <a href="ipd/additionalServices.php" class="grid-item cat-billing">
                <div class="icon-wrapper"><i class="fa-solid fa-plus-circle"></i></div>
                <span class="item-label">Manage Additional Services</span>
            </a>
            <a href="ipd/billingCategoryMaster.php" class="grid-item cat-billing">
                <div class="icon-wrapper"><i class="fa-solid fa-money-bill-wave"></i></div>
                <span class="item-label">Billing Category </span>
            </a>
            <a href="ipd/packageMaster.php" class="grid-item cat-billing">
                <div class="icon-wrapper"><i class="fa-solid fa-box-open"></i></div>
                <span class="item-label">Package </span>
            </a>
            <a href="ipd/anesthesiaBillingMaster.php" class="grid-item cat-billing">
                <div class="icon-wrapper"><i class="fa-solid fa-receipt"></i></div>
                <span class="item-label">Anesthesia Surgery Billing </span>
            </a>
            <a href="ipd/menuList.php" class="grid-item cat-billing">
                <div class="icon-wrapper"><i class="fa-solid fa-utensils"></i></div>
                <span class="item-label">Menu List (Dietary)</span>
            </a>
        </div>
    </div>

    <!-- SECTION 5: System Mappings & Advanced -->
    <div class="category-section">
        <h3 class="category-title" style="color: var(--c-mapping);">
            <i class="fa-solid fa-network-wired"></i> System Mappings & Connectivity
        </h3>
        <div class="grid-container">
            <a href="ipd/wardHelperMapping.php" class="grid-item cat-mapping">
                <div class="icon-wrapper"><i class="fa-solid fa-people-arrows"></i></div>
                <span class="item-label">Ward to Helper Mapping</span>
            </a>
            <a href="ipd/wardDirectorateMapping.php" class="grid-item cat-mapping">
                <div class="icon-wrapper"><i class="fa-solid fa-sitemap"></i></div>
                <span class="item-label">Ward - Directorate Mapping</span>
            </a>
            <a href="ipd/wardModalityMapping.php" class="grid-item cat-mapping">
                <div class="icon-wrapper"><i class="fa-solid fa-link"></i></div>
                <span class="item-label">Ward - Modality Mapping</span>
            </a>
            <a href="ipd/channelsTypes.php" class="grid-item cat-mapping">
                <div class="icon-wrapper"><i class="fa-solid fa-share-nodes"></i></div>
                <span class="item-label">Channels & Channel Types</span>
            </a>
            <a href="ipd/virtualBedAccess.php" class="grid-item cat-mapping">
                <div class="icon-wrapper"><i class="fa-solid fa-cloud"></i></div>
                <span class="item-label">Manage Virtual Bed Accessibility</span>
            </a>
            <a href="ipd/dayObservation.php" class="grid-item cat-mapping">
                <div class="icon-wrapper"><i class="fa-solid fa-eye"></i></div>
                <span class="item-label">Manage Day Observation / Detention</span>
            </a>
        </div>
    </div>

</div>

<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>