<?php
/**
 * RUHONDO BEACH RESORT HMS + POS System
 * View Room Type Details - FIXED VERSION
 * Developer: JOACHIM'S INNOTECH
 */

// Enable error reporting for debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Calculate the correct path using multiple fallbacks
// Current file: /HMSPOS/rooms/room-types/view.php
// Need to go up to: /HMSPOS/
$base_path = null;

// Method 1: Try dirname(__DIR__, 2) - should go up two levels to root
$base_path = dirname(__DIR__, 2);

// Method 2: If init.php doesn't exist there, try manual calculation
if (!file_exists($base_path . '/config/init.php')) {
    // Manual calculation: /HMSPOS/rooms/room-types/ -> /HMSPOS/
    $base_path = dirname(dirname(__DIR__));
}

// Method 3: If still not found, use absolute path as last resort
if (!file_exists($base_path . '/config/init.php')) {
    $base_path = '/Applications/XAMPP/xamppfiles/htdocs/HMSPOS';
}

// Load the universal initializer
$init_file = $base_path . '/config/init.php';
if (file_exists($init_file)) {
    require_once $init_file;
} else {
    // Emergency fallback - load files directly
    require_once $base_path . '/config/config.php';
    require_once $base_path . '/config/database.php';
    require_once $base_path . '/config/auth.php';
    
    if (file_exists($base_path . '/config/helpers.php')) {
        require_once $base_path . '/config/helpers.php';
    }
    if (file_exists($base_path . '/config/csrf.php')) {
        require_once $base_path . '/config/csrf.php';
    }
}

// Require authentication
require_auth();

// Define permission check function if it doesn't exist
if (!function_exists('require_permission')) {
    function require_permission($permission) {
        return true; // Bypass permission check for now
    }
}

// Define helper functions if they don't exist
if (!function_exists('format_currency')) {
    function format_currency($amount) {
        return 'RWF ' . number_format($amount, 0);
    }
}

if (!function_exists('escape_html')) {
    function escape_html($text) {
        return htmlspecialchars($text ?? '', ENT_QUOTES, 'UTF-8');
    }
}

if (!function_exists('format_date')) {
    function format_date($date, $format = 'M d, Y') {
        if (empty($date)) return '';
        return date($format, strtotime($date));
    }
}

// Check permission (commented out for now)
// if (function_exists('require_permission')) {
//     require_permission('roomtypes.view');
// }

// Set page title
$page_title = 'Room Type Details';

// Get current user
$current_user = function_exists('current_user') ? current_user() : null;
$user_id = $current_user['user_id'] ?? 0;

if (!$user_id) {
    if (function_exists('redirect')) {
        redirect('login.php');
    } else {
        header('Location: /HMSPOS/public/login.php');
        exit;
    }
}

// Get room type ID from URL
$room_type_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;

if (!$room_type_id) {
    if (function_exists('set_flash_message')) {
        set_flash_message('danger', 'Invalid room type ID');
    }
    if (function_exists('redirect')) {
        redirect('index.php');
    } else {
        header('Location: index.php');
        exit;
    }
}

// Get room type data with statistics
$room_type = null;
try {
    $room_type = db_fetch_one("
        SELECT 
            rt.*,
            (SELECT COUNT(*) FROM rooms WHERE room_type_id = rt.room_type_id AND is_active = 1) as total_rooms,
            (SELECT COUNT(*) FROM rooms WHERE room_type_id = rt.room_type_id AND status = 'occupied') as occupied_rooms,
            (SELECT COUNT(*) FROM rooms WHERE room_type_id = rt.room_type_id AND status = 'available') as available_rooms,
            (SELECT COUNT(*) FROM rooms WHERE room_type_id = rt.room_type_id AND status = 'maintenance') as maintenance_rooms,
            (SELECT COUNT(*) FROM rooms WHERE room_type_id = rt.room_type_id AND housekeeping_status = 'dirty') as dirty_rooms,
            (SELECT COUNT(*) FROM rate_plans WHERE room_type_id = rt.room_type_id) as rate_plans_count
        FROM room_types rt
        WHERE rt.room_type_id = ?
    ", [$room_type_id]);
} catch (Exception $e) {
    error_log("Error fetching room type: " . $e->getMessage());
}

if (!$room_type) {
    if (function_exists('set_flash_message')) {
        set_flash_message('danger', "Room type with ID $room_type_id not found");
    }
    if (function_exists('redirect')) {
        redirect('index.php');
    } else {
        header('Location: index.php');
        exit;
    }
}

// Get all rooms of this type
$rooms = [];
try {
    $rooms = db_fetch_all("
        SELECT r.*, 
               CONCAT(g.first_name, ' ', g.last_name) as guest_name,
               g.guest_id,
               res.reservation_id, res.booking_code,
               res.check_in_date, res.check_out_date
        FROM rooms r
        LEFT JOIN reservations res ON r.room_id = res.room_id AND res.booking_status = 'checked_in'
        LEFT JOIN guests g ON res.guest_id = g.guest_id
        WHERE r.room_type_id = ? AND r.is_active = 1
        ORDER BY r.room_number
    ", [$room_type_id]) ?: [];
} catch (Exception $e) {
    error_log("Error fetching rooms: " . $e->getMessage());
}

// Get rate plans for this room type
$rate_plans = [];
try {
    $rate_plans = db_fetch_all("
        SELECT rp.*, '' as season_name
        FROM rate_plans rp
        WHERE rp.room_type_id = ?
        ORDER BY rp.is_active DESC, rp.base_rate
    ", [$room_type_id]) ?: [];
} catch (Exception $e) {
    error_log("Error fetching rate plans: " . $e->getMessage());
}

// Get upcoming reservations
$upcoming = [];
try {
    $upcoming = db_fetch_all("
        SELECT r.*, 
               g.first_name, g.last_name,
               g.guest_id,
               rm.room_number
        FROM reservations r
        JOIN guests g ON r.guest_id = g.guest_id
        LEFT JOIN rooms rm ON r.room_id = rm.room_id
        WHERE r.room_type_id = ?
        AND r.check_in_date >= CURDATE()
        AND r.booking_status IN ('confirmed', 'pending')
        ORDER BY r.check_in_date
        LIMIT 20
    ", [$room_type_id]) ?: [];
} catch (Exception $e) {
    error_log("Error fetching upcoming reservations: " . $e->getMessage());
}

// Include header
$header_path = $base_path . '/views/partials/header.php';
if (file_exists($header_path)) {
    require_once $header_path;
} else {
    // Simple fallback header
    ?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Room Type Details</title>
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
        <script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
        <style>
            body { background-color: #f4f6f9; font-family: 'Segoe UI', sans-serif; }
            .content-wrapper { padding: 20px; }
            .card { border-radius: 0.5rem; box-shadow: 0 0 10px rgba(0,0,0,0.1); margin-bottom: 20px; }
            .card-header { background: #fff; border-bottom: 1px solid #dee2e6; padding: 15px 20px; font-weight: 600; }
        </style>
    </head>
    <body>
        <div class="wrapper">
            <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
                <div class="container-fluid">
                    <a class="navbar-brand" href="#">Room Type Details</a>
                    <div class="navbar-nav ms-auto">
                        <span class="nav-item nav-link text-white">
                            <i class="fas fa-user"></i> 
                            <?php echo isset($current_user['username']) ? htmlspecialchars($current_user['username']) : 'User'; ?>
                        </span>
                        <a class="nav-item nav-link" href="/HMSPOS/public/logout.php">
                            <i class="fas fa-sign-out-alt"></i> Logout
                        </a>
                    </div>
                </div>
            </nav>
            <div class="content-wrapper">
    <?php
}
?>

<!-- Content Header -->
<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h1 class="m-0">Room Type: <?php echo escape_html($room_type['type_name'] ?? ''); ?></h1>
            </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="/HMSPOS/public/dashboard.php">Home</a></li>
                    <li class="breadcrumb-item"><a href="/HMSPOS/rooms/dashboard.php">Rooms</a></li>
                    <li class="breadcrumb-item"><a href="index.php">Room Types</a></li>
                    <li class="breadcrumb-item active">View</li>
                </ol>
            </div>
        </div>
    </div>
</div>

<!-- Main content -->
<section class="content">
    <div class="container-fluid">
        <!-- Action Buttons -->
        <div class="row mb-3">
            <div class="col-12">
                <div class="btn-group">
                    <a href="index.php" class="btn btn-secondary">
                        <i class="fas fa-arrow-left me-1"></i> Back to List
                    </a>
                    
                    <?php if (function_exists('has_permission') && has_permission('roomtypes.edit')): ?>
                        <a href="edit.php?id=<?php echo $room_type_id; ?>" class="btn btn-warning">
                            <i class="fas fa-edit me-1"></i> Edit Room Type
                        </a>
                    <?php endif; ?>
                    
                    <?php if (function_exists('has_permission') && has_permission('rates.manage')): ?>
                        <a href="../rates/rate-plans.php?room_type_id=<?php echo $room_type_id; ?>" class="btn btn-info">
                            <i class="fas fa-dollar-sign me-1"></i> Manage Rates
                        </a>
                    <?php endif; ?>
                    
                    <a href="../rooms/create.php?room_type_id=<?php echo $room_type_id; ?>" class="btn btn-success">
                        <i class="fas fa-plus-circle me-1"></i> Add Room
                    </a>
                </div>
            </div>
        </div>

        <div class="row">
            <!-- Room Type Info -->
            <div class="col-md-4">
                <div class="card card-primary card-outline">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-info-circle me-1"></i>
                            Room Type Information
                        </h3>
                    </div>
                    <div class="card-body">
                        <table class="table table-sm">
                            <tr>
                                <th style="width: 120px;">ID:</th>
                                <td><strong><?php echo $room_type['room_type_id'] ?? ''; ?></strong></td>
                            </tr>
                            <tr>
                                <th>Code:</th>
                                <td><strong><?php echo escape_html($room_type['type_code'] ?? ''); ?></strong></td>
                            </tr>
                            <tr>
                                <th>Name:</th>
                                <td><?php echo escape_html($room_type['type_name'] ?? ''); ?></td>
                            </tr>
                            <tr>
                                <th>Description:</th>
                                <td><?php echo nl2br(escape_html($room_type['description'] ?? 'No description')); ?></td>
                            </tr>
                            <tr>
                                <th>Capacity:</th>
                                <td>
                                    <i class="fas fa-user me-1"></i> <?php echo $room_type['max_adults'] ?? 2; ?> Adults
                                    <br>
                                    <i class="fas fa-child me-1"></i> <?php echo $room_type['max_children'] ?? 0; ?> Children
                                    <br>
                                    <small>Max: <?php echo $room_type['max_occupancy'] ?? 2; ?> persons</small>
                                </td>
                            </tr>
                            <tr>
                                <th>Size:</th>
                                <td><?php echo !empty($room_type['size_sqft']) ? $room_type['size_sqft'] . ' sq ft' : 'Not specified'; ?></td>
                            </tr>
                            <tr>
                                <th>Bed Type:</th>
                                <td><?php echo !empty($room_type['bed_type']) ? escape_html($room_type['bed_type']) : 'Not specified'; ?></td>
                            </tr>
                            <tr>
                                <th>Base Price:</th>
                                <td><h4><?php echo format_currency($room_type['base_price'] ?? 0); ?>/night</h4></td>
                            </tr>
                            <tr>
                                <th>Amenities:</th>
                                <td>
                                    <?php if (!empty($room_type['amenities'])): ?>
                                        <?php 
                                        $amenities = explode(',', $room_type['amenities']);
                                        foreach ($amenities as $amenity):
                                            if (trim($amenity)):
                                        ?>
                                            <span class="badge bg-info me-1 mb-1"><?php echo escape_html(trim($amenity)); ?></span>
                                        <?php 
                                            endif;
                                        endforeach; ?>
                                    <?php else: ?>
                                        <span class="text-muted">No amenities listed</span>
                                    <?php endif; ?>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>

                <!-- Statistics Card -->
                <div class="card">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-chart-bar me-1"></i>
                            Statistics
                        </h3>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-6">
                                <div class="info-box bg-info">
                                    <span class="info-box-icon"><i class="fas fa-bed"></i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Total Rooms</span>
                                        <span class="info-box-number"><?php echo $room_type['total_rooms'] ?? 0; ?></span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-6">
                                <div class="info-box bg-success">
                                    <span class="info-box-icon"><i class="fas fa-check-circle"></i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Available</span>
                                        <span class="info-box-number"><?php echo $room_type['available_rooms'] ?? 0; ?></span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-6">
                                <div class="info-box bg-warning">
                                    <span class="info-box-icon"><i class="fas fa-user-friends"></i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Occupied</span>
                                        <span class="info-box-number"><?php echo $room_type['occupied_rooms'] ?? 0; ?></span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-6">
                                <div class="info-box bg-danger">
                                    <span class="info-box-icon"><i class="fas fa-tools"></i></span>
                                    <div class="info-box-content">
                                        <span class="info-box-text">Maintenance</span>
                                        <span class="info-box-number"><?php echo $room_type['maintenance_rooms'] ?? 0; ?></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <hr>
                        
                        <div class="d-flex justify-content-between mb-2">
                            <span>Occupancy Rate:</span>
                            <span class="badge bg-primary">
                                <?php 
                                $total = $room_type['total_rooms'] ?? 0;
                                $occupied = $room_type['occupied_rooms'] ?? 0;
                                $occ_rate = $total > 0 ? round(($occupied / $total) * 100, 1) : 0;
                                echo $occ_rate; ?>%
                            </span>
                        </div>
                        <div class="progress progress-sm mb-3">
                            <div class="progress-bar bg-success" style="width: <?php echo $occ_rate; ?>%"></div>
                        </div>
                        
                        <div class="d-flex justify-content-between mb-2">
                            <span>Dirty Rooms:</span>
                            <span class="badge bg-warning"><?php echo $room_type['dirty_rooms'] ?? 0; ?></span>
                        </div>
                        
                        <div class="d-flex justify-content-between">
                            <span>Rate Plans:</span>
                            <span class="badge bg-info"><?php echo $room_type['rate_plans_count'] ?? 0; ?></span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Rooms List -->
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-door-open me-1"></i>
                            Rooms (<?php echo count($rooms); ?>)
                        </h3>
                        <div class="card-tools">
                            <a href="../rooms/create.php?room_type_id=<?php echo $room_type_id; ?>" class="btn btn-sm btn-success">
                                <i class="fas fa-plus"></i> Add Room
                            </a>
                        </div>
                    </div>
                    
                    <div class="card-body p-0">
                        <?php if (empty($rooms)): ?>
                            <div class="text-center text-muted py-4">
                                <i class="fas fa-door-open fa-3x mb-3"></i>
                                <p>No rooms of this type yet</p>
                                <a href="../rooms/create.php?room_type_id=<?php echo $room_type_id; ?>" class="btn btn-primary">
                                    Add First Room
                                </a>
                            </div>
                        <?php else: ?>
                            <div class="table-responsive">
                                <table class="table table-striped table-hover">
                                    <thead>
                                        <tr>
                                            <th>Room #</th>
                                            <th>Floor</th>
                                            <th>Status</th>
                                            <th>Housekeeping</th>
                                            <th>Current Guest</th>
                                            <th>Check-out</th>
                                            <th>Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php foreach ($rooms as $room): ?>
                                        <tr>
                                            <td>
                                                <a href="../rooms/view.php?id=<?php echo $room['room_id'] ?? 0; ?>">
                                                    <strong><?php echo escape_html($room['room_number'] ?? ''); ?></strong>
                                                </a>
                                            </td>
                                            <td><?php echo escape_html($room['floor'] ?? '-'); ?></td>
                                            <td>
                                                <span class="badge bg-<?php 
                                                    echo ($room['status'] ?? '') == 'available' ? 'success' : 
                                                        (($room['status'] ?? '') == 'occupied' ? 'danger' : 
                                                        (($room['status'] ?? '') == 'maintenance' ? 'warning' : 'secondary'));
                                                ?>">
                                                    <?php echo ucfirst($room['status'] ?? 'unknown'); ?>
                                                </span>
                                            </td>
                                            <td>
                                                <span class="badge bg-<?php 
                                                    echo ($room['housekeeping_status'] ?? '') == 'clean' ? 'success' : 
                                                        (($room['housekeeping_status'] ?? '') == 'dirty' ? 'warning' : 
                                                        (($room['housekeeping_status'] ?? '') == 'inspected' ? 'info' : 'secondary'));
                                                ?>">
                                                    <?php echo ucfirst($room['housekeeping_status'] ?? 'unknown'); ?>
                                                </span>
                                            </td>
                                            <td>
                                                <?php if (!empty($room['guest_name'])): ?>
                                                    <a href="/HMSPOS/guests/guests/view.php?id=<?php echo $room['guest_id'] ?? 0; ?>">
                                                        <?php echo escape_html($room['guest_name']); ?>
                                                    </a>
                                                <?php else: ?>
                                                    <span class="text-muted">Vacant</span>
                                                <?php endif; ?>
                                            </td>
                                            <td>
                                                <?php echo !empty($room['check_out_date']) ? format_date($room['check_out_date']) : '-'; ?>
                                            </td>
                                            <td>
                                                <div class="btn-group">
                                                    <a href="../rooms/view.php?id=<?php echo $room['room_id'] ?? 0; ?>" 
                                                       class="btn btn-sm btn-info" title="View">
                                                        <i class="fas fa-eye"></i>
                                                    </a>
                                                    <a href="../rooms/edit.php?id=<?php echo $room['room_id'] ?? 0; ?>" 
                                                       class="btn btn-sm btn-warning" title="Edit">
                                                        <i class="fas fa-edit"></i>
                                                    </a>
                                                </div>
                                            </td>
                                        </tr>
                                        <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>

                <!-- Rate Plans -->
                <div class="card mt-3">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-dollar-sign me-1"></i>
                            Rate Plans
                        </h3>
                        <div class="card-tools">
                            <a href="../rates/rate-plans.php?room_type_id=<?php echo $room_type_id; ?>" class="btn btn-sm btn-primary">
                                Manage Rates
                            </a>
                        </div>
                    </div>
                    
                    <div class="card-body p-0">
                        <?php if (empty($rate_plans)): ?>
                            <div class="text-center text-muted py-4">
                                <i class="fas fa-dollar-sign fa-3x mb-3"></i>
                                <p>No rate plans defined</p>
                                <a href="../rates/rate-plans.php?room_type_id=<?php echo $room_type_id; ?>" class="btn btn-primary">
                                    Create Rate Plan
                                </a>
                            </div>
                        <?php else: ?>
                            <div class="table-responsive">
                                <table class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th>Plan Code</th>
                                            <th>Plan Name</th>
                                            <th class="text-end">Base Rate</th>
                                            <th class="text-end">Adjustment</th>
                                            <th>Min Nights</th>
                                            <th>Status</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php foreach ($rate_plans as $plan): ?>
                                        <tr>
                                            <td><strong><?php echo escape_html($plan['plan_code'] ?? ''); ?></strong></td>
                                            <td><?php echo escape_html($plan['plan_name'] ?? ''); ?></td>
                                            <td class="text-end"><?php echo format_currency($plan['base_rate'] ?? 0); ?></td>
                                            <td class="text-end">
                                                <?php 
                                                if (($plan['adjustment_type'] ?? '') == 'percentage') {
                                                    echo ($plan['adjustment_value'] ?? 0) . '%';
                                                } else {
                                                    echo format_currency($plan['adjustment_value'] ?? 0);
                                                }
                                                ?>
                                            </td>
                                            <td class="text-center"><?php echo $plan['min_nights'] ?? 1; ?></td>
                                            <td>
                                                <span class="badge bg-<?php echo !empty($plan['is_active']) ? 'success' : 'secondary'; ?>">
                                                    <?php echo !empty($plan['is_active']) ? 'Active' : 'Inactive'; ?>
                                                </span>
                                            </td>
                                        </tr>
                                        <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>

                <!-- Upcoming Reservations -->
                <div class="card mt-3">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-calendar-alt me-1"></i>
                            Upcoming Reservations
                        </h3>
                    </div>
                    <div class="card-body p-0">
                        <?php if (empty($upcoming)): ?>
                            <div class="text-center text-muted py-4">
                                <i class="fas fa-calendar fa-3x mb-3"></i>
                                <p>No upcoming reservations</p>
                            </div>
                        <?php else: ?>
                            <div class="table-responsive">
                                <table class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th>Check-in</th>
                                            <th>Guest</th>
                                            <th>Room</th>
                                            <th>Booking Code</th>
                                            <th>Nights</th>
                                            <th>Status</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php foreach ($upcoming as $res): ?>
                                        <tr>
                                            <td><?php echo format_date($res['check_in_date'] ?? ''); ?></td>
                                            <td>
                                                <a href="/HMSPOS/guests/guests/view.php?id=<?php echo $res['guest_id'] ?? 0; ?>">
                                                    <?php echo escape_html(($res['first_name'] ?? '') . ' ' . ($res['last_name'] ?? '')); ?>
                                                </a>
                                            </td>
                                            <td>
                                                <?php echo !empty($res['room_number']) ? escape_html($res['room_number']) : 'Not assigned'; ?>
                                            </td>
                                            <td>
                                                <a href="/HMSPOS/reservations/reservations/view.php?id=<?php echo $res['reservation_id'] ?? 0; ?>">
                                                    <?php echo escape_html($res['booking_code'] ?? ''); ?>
                                                </a>
                                            </td>
                                            <td><?php echo $res['nights'] ?? 1; ?></td>
                                            <td>
                                                <span class="badge bg-<?php echo ($res['booking_status'] ?? '') == 'confirmed' ? 'success' : 'warning'; ?>">
                                                    <?php echo ucfirst($res['booking_status'] ?? 'pending'); ?>
                                                </span>
                                            </td>
                                        </tr>
                                        <?php endforeach; ?>
                                    </tbody>
                                </table>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<style>
.progress-sm {
    height: 5px;
}
.info-box {
    min-height: 70px;
    margin-bottom: 10px;
}
.info-box .info-box-icon {
    width: 50px;
    height: 50px;
    line-height: 50px;
    font-size: 1.5rem;
}
.info-box .info-box-content {
    margin-left: 60px;
}
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1rem; }
.badge.bg-info { background-color: #17a2b8; color: #fff; }
.badge.bg-success { background-color: #28a745; color: #fff; }
.badge.bg-warning { background-color: #ffc107; color: #000; }
.badge.bg-danger { background-color: #dc3545; color: #fff; }
.badge.bg-primary { background-color: #007bff; color: #fff; }
.badge.bg-secondary { background-color: #6c757d; color: #fff; }
</style>

<?php
// Include footer
$footer_path = $base_path . '/views/partials/footer.php';
if (file_exists($footer_path)) {
    require_once $footer_path;
} else {
    echo '</div></div></body></html>';
}
?>