<?php
session_start();
require_once("../config/config.php");

if (!isset($_SESSION['user_id'])) {
    header("Location: ../login.php");
    exit();
}

$full_name = $_SESSION['full_name'] ?? 'User';
$user_role = $_SESSION['role'] ?? 'Staff';
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Billing Dashboard</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
    <style>
        :root {
            --primary: #a855f7;
            --accent: #c084fc;
            --glass: rgba(255,255,255,0.10);
            --glass-border: rgba(255,255,255,0.20);
            --text: #f1f5f9;
        }

        * { margin:0; padding:0; box-sizing:border-box; }

        body {
            font-family: 'Inter', system-ui, sans-serif;
            background: linear-gradient(135deg, rgba(0,0,0,0.78), rgba(0,0,0,0.92)), 
                        url('../background.jpeg') center/cover fixed;
            color: var(--text);
            min-height: 100vh;
            padding: 20px 15px;
        }

        .container {
            max-width: 1280px;
            margin: 0 auto;
        }

        .glass-container {
            background: var(--glass);
            backdrop-filter: blur(24px);
            border-radius: 32px;
            border: 1px solid var(--glass-border);
            box-shadow: 0 25px 80px rgba(0,0,0,0.65);
            overflow: hidden;
        }

        .header {
            background: linear-gradient(90deg, rgba(168,85,247,0.35), rgba(147,51,234,0.25));
            padding: 60px 40px 50px;
            text-align: center;
        }

        .header h1 {
            font-size: clamp(32px, 6vw, 48px);
            font-weight: 700;
            margin-bottom: 12px;
            background: linear-gradient(to right, #e0bbff, #c084fc);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .welcome {
            font-size: 1.1rem;
            opacity: 0.9;
            margin-top: 8px;
        }

        .main-content {
            padding: 40px;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 20px;
            margin-bottom: 50px;
        }

        .stat-card {
            background: rgba(255,255,255,0.08);
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 20px;
            padding: 28px;
            transition: transform 0.3s ease;
        }

        .stat-card:hover {
            transform: translateY(-8px);
        }

        .stat-icon {
            font-size: 2.8rem;
            margin-bottom: 18px;
            opacity: 0.9;
        }

        .stat-value {
            font-size: 2.4rem;
            font-weight: 700;
            margin-bottom: 6px;
        }

        .stat-label {
            font-size: 1.05rem;
            opacity: 0.85;
        }

        .quick-links {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
            gap: 20px;
        }

        .link-card {
            background: rgba(255,255,255,0.07);
            border: 1px solid rgba(255,255,255,0.18);
            border-radius: 20px;
            padding: 32px 28px;
            text-decoration: none;
            color: inherit;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }

        .link-card:hover {
            background: rgba(168,85,247,0.15);
            border-color: var(--primary);
            transform: translateY(-6px);
        }

        .link-icon {
            font-size: 3.2rem;
            margin-bottom: 20px;
            color: var(--primary);
        }

        .link-title {
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 8px;
        }

        .link-desc {
            font-size: 0.95rem;
            opacity: 0.8;
        }

        @media (max-width: 768px) {
            .header { padding: 45px 25px 35px; }
            .main-content { padding: 30px 25px; }
            .stats-grid, .quick-links { grid-template-columns: 1fr; }
        }
    </style>
</head>
<body>

<?php include '../config/header.php'; ?>

<div class="container">
    <div class="glass-container">

        <!-- Header -->
        <div class="header">
            <h1>Billing Dashboard</h1>
            <div class="welcome">
                Welcome back, <strong><?= htmlspecialchars($full_name) ?></strong> 
                <span style="opacity:0.7;">(<?= ucfirst($user_role) ?>)</span>
            </div>
        </div>

        <div class="main-content">

            
            <!-- Quick Links -->
            <h2 style="margin-bottom:25px; color:#e0e7ff;">Quick Access</h2>
            
            <div class="quick-links">
                <a href="../boq/boq-management.php" class="link-card">
                    <div class="link-icon"><i class="fas fa-list-check"></i></div>
                    <div class="link-title">BOQ Management</div>
                    <div class="link-desc">Create and manage Bill of Quantities</div>
                </a>

                <a href="bbu_list.php" class="link-card">
                    <div class="link-icon"><i class="fas fa-cubes"></i></div>
                    <div class="link-title">BBU Management</div>
                    <div class="link-desc">Track BBU inventory &amp; deployment</div>
                </a>

                
            </div>

        </div>
    </div>
</div>

</body>
</html>