<?php
include('head.php');
include('header.php');
requirePermission($pdo, $_SESSION['clientId'], 'tasks');

$pspId = $_SESSION['pspId'];
$clientId = $_SESSION['clientId'];
?>

<style>
    .tasks-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 32px 30px;
    }
    
    .page-header {
        margin-bottom: 32px;
    }
    
    .page-title {
        font-size: 28px;
        font-weight: 700;
        color: #1a202c;
        margin-bottom: 8px;
    }
    
    .page-subtitle {
        font-size: 15px;
        color: #718096;
    }
    
    .task-filters {
        display: flex;
        gap: 12px;
        margin-bottom: 24px;
        flex-wrap: wrap;
    }
    
    .filter-btn {
        padding: 10px 20px;
        border-radius: 8px;
        border: 2px solid #e2e8f0;
        background: white;
        color: #4a5568;
        font-weight: 600;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .filter-btn:hover {
        border-color: #1a70b8;
        color: #1a70b8;
    }
    
    .filter-btn.active {
        background: linear-gradient(135deg, #1a70b8 0%, #60e438 100%);
        color: white;
        border-color: transparent;
    }
    
    .tasks-grid {
        display: grid;
        gap: 16px;
    }
    
    .task-card {
        background: white;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        border-left: 4px solid #1a70b8;
        transition: all 0.3s ease;
    }
    
    .task-card:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        transform: translateX(4px);
    }
    
    .task-card.priority-high {
        border-left-color: #f59e0b;
    }
    
    .task-card.priority-urgent {
        border-left-color: #ef4444;
    }
    
    .task-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 12px;
    }
    
    .task-title {
        font-size: 16px;
        font-weight: 600;
        color: #1a202c;
        margin-bottom: 4px;
    }
    
    .task-description {
        font-size: 14px;
        color: #718096;
        margin-bottom: 12px;
    }
    
    .task-meta {
        display: flex;
        gap: 16px;
        font-size: 13px;
        color: #718096;
    }
    
    .task-meta-item {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .task-meta-item i {
        color: #1a70b8;
    }
    
    .task-actions {
        display: flex;
        gap: 8px;
    }
    
    .task-btn {
        padding: 6px 12px;
        border-radius: 6px;
        border: none;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .task-btn-complete {
        background: #60e438;
        color: white;
    }
    
    .task-btn-complete:hover {
        background: #4ade80;
    }
    
    .priority-badge {
        padding: 4px 10px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
    }
    
    .priority-normal {
        background: #bee3f8;
        color: #2c5282;
    }
    
    .priority-high {
        background: #feebc8;
        color: #744210;
    }
    
    .priority-urgent {
        background: #fed7d7;
        color: #742a2a;
    }
</style>

<div class="main-content">
    <div class="tasks-container">
        <div class="page-header">
            <h1 class="page-title">Task Management</h1>
            <p class="page-subtitle">Manage and track your patient-related tasks</p>
        </div>

        <div class="task-filters">
            <button class="filter-btn active">All Tasks</button>
            <button class="filter-btn">Today</button>
            <button class="filter-btn">This Week</button>
            <button class="filter-btn">Overdue</button>
            <button class="filter-btn">Completed</button>
        </div>

        <div class="tasks-grid">
            <div class="task-card priority-urgent">
                <div class="task-header">
                    <div>
                        <div class="task-title">Complete Welcome Calls - Urgent</div>
                        <div class="task-description">5 patients waiting for initial welcome call</div>
                    </div>
                    <span class="priority-badge priority-urgent">Urgent</span>
                </div>
                <div class="task-meta">
                    <div class="task-meta-item">
                        <i class="far fa-clock"></i>
                        <span>Due: Today</span>
                    </div>
                    <div class="task-meta-item">
                        <i class="fas fa-user"></i>
                        <span>Assigned to you</span>
                    </div>
                </div>
                <div class="task-actions" style="margin-top: 12px;">
                    <button class="task-btn task-btn-complete">
                        <i class="fas fa-check"></i> Mark Complete
                    </button>
                </div>
            </div>

            <div class="task-card priority-high">
                <div class="task-header">
                    <div>
                        <div class="task-title">Review New Enrollments</div>
                        <div class="task-description">3 new patient enrollments need verification</div>
                    </div>
                    <span class="priority-badge priority-high">High</span>
                </div>
                <div class="task-meta">
                    <div class="task-meta-item">
                        <i class="far fa-clock"></i>
                        <span>Due: Tomorrow</span>
                    </div>
                    <div class="task-meta-item">
                        <i class="fas fa-user"></i>
                        <span>Assigned to you</span>
                    </div>
                </div>
                <div class="task-actions" style="margin-top: 12px;">
                    <button class="task-btn task-btn-complete">
                        <i class="fas fa-check"></i> Mark Complete
                    </button>
                </div>
            </div>

            <div class="task-card">
                <div class="task-header">
                    <div>
                        <div class="task-title">Update Reimbursement Status</div>
                        <div class="task-description">Update billing status for 8 patients</div>
                    </div>
                    <span class="priority-badge priority-normal">Normal</span>
                </div>
                <div class="task-meta">
                    <div class="task-meta-item">
                        <i class="far fa-clock"></i>
                        <span>Due: In 2 days</span>
                    </div>
                    <div class="task-meta-item">
                        <i class="fas fa-user"></i>
                        <span>Assigned to you</span>
                    </div>
                </div>
                <div class="task-actions" style="margin-top: 12px;">
                    <button class="task-btn task-btn-complete">
                        <i class="fas fa-check"></i> Mark Complete
                    </button>
                </div>
            </div>

            <div class="task-card">
                <div class="task-header">
                    <div>
                        <div class="task-title">Follow-up Calls Scheduled</div>
                        <div class="task-description">6 patients scheduled for 30-day follow-up</div>
                    </div>
                    <span class="priority-badge priority-normal">Normal</span>
                </div>
                <div class="task-meta">
                    <div class="task-meta-item">
                        <i class="far fa-clock"></i>
                        <span>Due: In 3 days</span>
                    </div>
                    <div class="task-meta-item">
                        <i class="fas fa-user"></i>
                        <span>Assigned to you</span>
                    </div>
                </div>
                <div class="task-actions" style="margin-top: 12px;">
                    <button class="task-btn task-btn-complete">
                        <i class="fas fa-check"></i> Mark Complete
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

<?php include('footer.php'); ?>
