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

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

<style>
    .files-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 32px 30px;
    }
    
    .files-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 32px;
    }
    
    .upload-btn {
        background: linear-gradient(135deg, #1a70b8 0%, #60e438 100%);
        color: white;
        padding: 12px 24px;
        border-radius: 10px;
        border: none;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
    
    .upload-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(26, 112, 184, 0.4);
    }
    
    .files-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .file-card {
        background: white;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        transition: all 0.3s ease;
        cursor: pointer;
    }
    
    .file-card:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        transform: translateY(-4px);
    }
    
    .file-icon {
        width: 60px;
        height: 60px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        color: white;
        margin-bottom: 16px;
    }
    
    .file-icon.pdf {
        background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    }
    
    .file-icon.doc {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    }
    
    .file-icon.img {
        background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    }
    
    .file-icon.excel {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    }
    
    .file-name {
        font-weight: 600;
        color: #1a202c;
        font-size: 15px;
        margin-bottom: 8px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .file-meta {
        display: flex;
        justify-content: space-between;
        font-size: 13px;
        color: #718096;
        margin-bottom: 12px;
    }
    
    .file-actions {
        display: flex;
        gap: 8px;
    }
    
    .file-btn {
        flex: 1;
        padding: 8px;
        border-radius: 6px;
        border: 1px solid #e2e8f0;
        background: white;
        color: #4a5568;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .file-btn:hover {
        background: #f7fafc;
        border-color: #1a70b8;
        color: #1a70b8;
    }
</style>

<div class="main-content">
    <div class="files-container">
        <div class="files-header">
            <div>
                <h1 class="page-title">Document Management</h1>
                <p class="page-subtitle">Manage patient documents and files</p>
            </div>
            <button class="upload-btn">
                <i class="fas fa-cloud-upload-alt"></i>
                Upload Document
            </button>
        </div>

        <div class="files-grid">
            <div class="file-card">
                <div class="file-icon pdf">
                    <i class="fas fa-file-pdf"></i>
                </div>
                <div class="file-name">Patient Consent Form</div>
                <div class="file-meta">
                    <span>2.4 MB</span>
                    <span>Today</span>
                </div>
                <div class="file-actions">
                    <button class="file-btn">
                        <i class="fas fa-download"></i> Download
                    </button>
                    <button class="file-btn">
                        <i class="fas fa-eye"></i> View
                    </button>
                </div>
            </div>

            <div class="file-card">
                <div class="file-icon doc">
                    <i class="fas fa-file-word"></i>
                </div>
                <div class="file-name">Enrollment Application</div>
                <div class="file-meta">
                    <span>1.8 MB</span>
                    <span>Yesterday</span>
                </div>
                <div class="file-actions">
                    <button class="file-btn">
                        <i class="fas fa-download"></i> Download
                    </button>
                    <button class="file-btn">
                        <i class="fas fa-eye"></i> View
                    </button>
                </div>
            </div>

            <div class="file-card">
                <div class="file-icon pdf">
                    <i class="fas fa-file-medical"></i>
                </div>
                <div class="file-name">Medical Records</div>
                <div class="file-meta">
                    <span>3.2 MB</span>
                    <span>2 days ago</span>
                </div>
                <div class="file-actions">
                    <button class="file-btn">
                        <i class="fas fa-download"></i> Download
                    </button>
                    <button class="file-btn">
                        <i class="fas fa-eye"></i> View
                    </button>
                </div>
            </div>

            <div class="file-card">
                <div class="file-icon excel">
                    <i class="fas fa-file-excel"></i>
                </div>
                <div class="file-name">Patient Data Export</div>
                <div class="file-meta">
                    <span>856 KB</span>
                    <span>3 days ago</span>
                </div>
                <div class="file-actions">
                    <button class="file-btn">
                        <i class="fas fa-download"></i> Download
                    </button>
                    <button class="file-btn">
                        <i class="fas fa-eye"></i> View
                    </button>
                </div>
            </div>

            <div class="file-card">
                <div class="file-icon img">
                    <i class="fas fa-file-image"></i>
                </div>
                <div class="file-name">Insurance Card Scan</div>
                <div class="file-meta">
                    <span>1.2 MB</span>
                    <span>4 days ago</span>
                </div>
                <div class="file-actions">
                    <button class="file-btn">
                        <i class="fas fa-download"></i> Download
                    </button>
                    <button class="file-btn">
                        <i class="fas fa-eye"></i> View
                    </button>
                </div>
            </div>

            <div class="file-card">
                <div class="file-icon pdf">
                    <i class="fas fa-file-invoice"></i>
                </div>
                <div class="file-name">Reimbursement Form</div>
                <div class="file-meta">
                    <span>980 KB</span>
                    <span>5 days ago</span>
                </div>
                <div class="file-actions">
                    <button class="file-btn">
                        <i class="fas fa-download"></i> Download
                    </button>
                    <button class="file-btn">
                        <i class="fas fa-eye"></i> View
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

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