<?php 
session_start(); 
require_once __DIR__ . '/config/db.php'; 
$page_title = 'Our Team'; 
$conn = $connection;

$conn->query("CREATE TABLE IF NOT EXISTS team_members (
    id INT PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(100) NOT NULL,
    designation VARCHAR(100) NOT NULL,
    image_path VARCHAR(255),
    twitter_url VARCHAR(255),
    linkedin_url VARCHAR(255),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)");

$count_result = $conn->query("SELECT COUNT(*) as count FROM team_members");
$count_row = $count_result->fetch_assoc();

if ($count_row['count'] == 0) {
    $default_members = [
        ['Jake Saper', 'CEO & Founder', 'assets/img/team/team_1_1.png'],
        ['Mari Doly', 'Chief Architect', 'assets/img/team/team_1_2.png'],
        ['Michel Smith', 'General Manager', 'assets/img/team/team_1_3.png'],
        ['Elis Mike', 'Assistant Architect', 'assets/img/team/team_1_4.png'],
        ['Johone Smith', 'Johone Smith', 'assets/img/team/team_1_5.png'],
        ['Tony Mari', 'Chief Planner', 'assets/img/team/team_1_6.png']
    ];
    foreach ($default_members as $member) {
        $conn->query("INSERT INTO team_members (name, designation, image_path, twitter_url, linkedin_url) 
                     VALUES ('{$member[0]}', '{$member[1]}', '{$member[2]}', 'https://twitter.com/', 'https://linkedin.com/')");
    }
}

$team_members = [];
$result = $conn->query("SELECT * FROM team_members ORDER BY created_at ASC");
if ($result) {
    while ($row = $result->fetch_assoc()) {
        $team_members[] = $row;
    }
}
?>
<!doctype html>
<html class="no-js" lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Our Team - Faren Interior Design</title>
    <meta name="author" content="Faren Interior Design">
    <meta name="description" content="Meet the talented team behind Faren Interior Design.">
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
    <link rel="icon" type="image/png" sizes="32x32" href="assets/img/favicons/favicon-32x32.png">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
    <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/fontawesome.min.css">
    <link rel="stylesheet" href="assets/css/magnific-popup.min.css">
    <link rel="stylesheet" href="assets/css/swiper-bundle.min.css">
    <link rel="stylesheet" href="assets/css/style.css">
    <link rel="stylesheet" href="assets/css/responsive-chat.css">
    <script src="assets/js/auth-ui-global.js"></script>
    <style>
        /* ==============================================
           TEAM PAGE — GRID LAYOUT, ALL BREAKPOINTS
           ============================================== */
        .tp-wrap {
            font-family: 'DM Sans', sans-serif;
            background: #f7f4f0;
            min-height: 100vh;
        }

        /* ── Hero Banner ── */
        .tp-hero {
            background: linear-gradient(135deg, #1e1610 0%, #3a2a1c 60%, #4d3828 100%);
            color: #fff;
            text-align: center;
            padding: 10px;
        }
        .tp-hero-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: rgba(212,165,116,0.18);
            border: 1px solid rgba(212,165,116,0.30);
            border-radius: 999px;
            padding: 5px 16px;
            font-size: 11px;
            font-weight: 700;
            color: #d4a574;
            text-transform: uppercase;
            letter-spacing: 0.12em;
            margin-bottom: 14px;
        }
        .tp-hero h1 {
            font-size: clamp(22px,4.5vw,44px);
            font-weight: 800;
            letter-spacing: -0.02em;
            line-height: 1.15;
            margin: 0 0 10px;
        }
        .tp-hero p {
            max-width: 48ch;
            margin: 0 auto;
            color: rgba(255,255,255,0.6);
            font-size: clamp(13px,1.6vw,16px);
            line-height: 1.65;
        }

        /* ── Grid Container ── */
        .tp-grid-wrap {
            max-width: 1360px;
            margin: 0 auto;
            padding: clamp(16px,3vw,40px) clamp(10px,2vw,24px) clamp(32px,5vw,64px);
        }

        /* ── THE GRID — always multi-column ── */
        .tp-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: clamp(12px,2vw,28px);
        }

        /* ── Card ── */
        .tp-card {
            background: #fff;
            border-radius: 14px;
            overflow: hidden;
            border: 1px solid #ebe5dc;
            box-shadow: 0 2px 12px rgba(0,0,0,0.04);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            display: flex;
            flex-direction: column;
        }
        .tp-card:hover {
            transform: translateY(-6px);
            box-shadow: 0 16px 40px rgba(0,0,0,0.10);
        }

        /* Card Image */
        .tp-card-img {
            width: 100%;
            aspect-ratio: 1 / 1;
            overflow: hidden;
            background: #f0ebe4;
            flex-shrink: 0;
        }
        .tp-card-img img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            transition: transform 0.4s ease;
        }
        .tp-card:hover .tp-card-img img {
            transform: scale(1.05);
        }

        /* Card Info */
        .tp-card-info {
            padding: clamp(10px,1.5vw,20px);
            display: flex;
            flex-direction: column;
            flex: 1;
        }
        .tp-card-name {
            font-size: clamp(13px,1.4vw,17px);
            font-weight: 800;
            color: #1a1612;
            margin: 0 0 2px;
            line-height: 1.3;
        }
        .tp-card-name a {
            color: inherit;
            text-decoration: none;
        }
        .tp-card-name a:hover {
            color: #b8834a;
        }
        .tp-card-role {
            font-size: clamp(10px,1.1vw,12px);
            font-weight: 700;
            color: #b8834a;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            margin-bottom: 10px;
        }

        /* Social */
        .tp-card-social {
            display: flex;
            gap: 6px;
            margin-top: auto;
        }
        .tp-card-social a {
            width: clamp(30px,3vw,36px);
            height: clamp(30px,3vw,36px);
            border-radius: 8px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: #f7f4f0;
            border: 1px solid #ebe5dc;
            color: #7a7168;
            font-size: clamp(11px,1.2vw,13px);
            text-decoration: none;
            transition: all 0.25s ease;
        }
        .tp-card-social a:hover {
            background: linear-gradient(135deg, #d4a574, #b8834a);
            border-color: transparent;
            color: #fff;
            transform: translateY(-2px);
        }

        /* ==============================================
           RESPONSIVE — Tablet ≤1024px → 3 columns
           ============================================== */
        @media (max-width: 1024px) {
            .tp-grid {
                grid-template-columns: repeat(3, 1fr);
                gap: 14px;
            }
        }

        /* ==============================================
           RESPONSIVE — ≤768px → 2 columns
           ============================================== */
        @media (max-width: 768px) {
            .tp-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 12px;
            }
            .tp-card:hover {
                transform: translateY(-3px);
            }
        }

        /* ==============================================
           RESPONSIVE — ≤480px → 2 columns (compact)
           ============================================== */
        @media (max-width: 480px) {
            .tp-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 10px;
            }
            .tp-card {
                border-radius: 10px;
            }
            .tp-card-info {
                padding: 10px;
            }
            .tp-card-name {
                font-size: 13px;
            }
            .tp-card-role {
                font-size: 10px;
                margin-bottom: 8px;
            }
            .tp-card-social a {
                width: 28px;
                height: 28px;
                font-size: 11px;
                border-radius: 6px;
            }
            .tp-hero {
                padding: 20px 12px 18px;
            }
            .tp-hero h1 {
                font-size: 20px;
            }
        }

        /* ==============================================
           RESPONSIVE — ≤360px → 2 columns (tight)
           ============================================== */
        @media (max-width: 360px) {
            .tp-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 8px;
            }
            .tp-grid-wrap {
                padding-left: 8px;
                padding-right: 8px;
            }
            .tp-card-info {
                padding: 8px;
            }
            .tp-card-name {
                font-size: 12px;
            }
            .tp-card-role {
                font-size: 9px;
            }
            .tp-card-social a {
                width: 26px;
                height: 26px;
                font-size: 10px;
            }
        }

        /* ==============================================
           LARGE DESKTOP ≥1440px
           ============================================== */
        @media (min-width: 1440px) {
            .tp-grid {
                gap: 32px;
            }
            .tp-card-name {
                font-size: 18px;
            }
            .tp-card-social a {
                width: 38px;
                height: 38px;
                font-size: 14px;
            }
        }

        /* Reduced motion */
        @media (prefers-reduced-motion: reduce) {
            .tp-card, .tp-card-img img, .tp-card-social a {
                transition: none !important;
            }
        }
    </style>
</head>

<body id="show-grid">
    <?php include 'header-php.php'; ?>

    <div class="tp-wrap">
        <!-- Hero -->
        <section class="tp-hero">
            <span class="tp-hero-badge"><i class="fas fa-users"></i> Our Team</span>
            <h1>Meet the Creative Minds</h1>
            <p>Architects, designers, and planners dedicated to crafting beautiful, functional spaces.</p>
        </section>

        <!-- Team Grid -->
        <div class="tp-grid-wrap">
            <div class="tp-grid">
                <?php foreach ($team_members as $member): ?>
                <article class="tp-card">
                    <div class="tp-card-img">
                        <img src="<?php echo htmlspecialchars($member['image_path']); ?>" 
                             alt="<?php echo htmlspecialchars($member['name']); ?>" loading="lazy">
                    </div>
                    <div class="tp-card-info">
                        <h3 class="tp-card-name">
                            <a href="javascript:void(0);"><?php echo htmlspecialchars($member['name']); ?></a>
                        </h3>
                        <span class="tp-card-role"><?php echo htmlspecialchars($member['designation']); ?></span>
                        <div class="tp-card-social">
                            <a target="_blank" href="<?php echo htmlspecialchars($member['twitter_url']); ?>" aria-label="Twitter"><i class="fab fa-twitter"></i></a>
                            <a target="_blank" href="<?php echo htmlspecialchars($member['linkedin_url']); ?>" aria-label="LinkedIn"><i class="fab fa-linkedin-in"></i></a>
                        </div>
                    </div>
                </article>
                <?php endforeach; ?>
            </div>
        </div>
    </div>

    <?php include 'footer-section.html'; ?>


    <script src="assets/js/vendor/jquery-3.7.1.min.js"></script>
    <script src="assets/js/swiper-bundle.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery.magnific-popup.min.js"></script>
    <script src="assets/js/jquery.counterup.min.js"></script>
    <script src="assets/js/circle-progress.js"></script>
    <script src="assets/js/jquery-ui.min.js"></script>
    <script src="assets/js/imagesloaded.pkgd.min.js"></script>
    <script src="assets/js/isotope.pkgd.min.js"></script>
    <script src="assets/js/nice-select.min.js"></script>
    <script src="assets/js/wow.min.js"></script>
    <script src="assets/js/threesixty.min.js"></script>
    <script src="assets/js/panolens.min.js"></script>
    <script src="assets/js/gsap.min.js"></script>
    <script src="assets/js/ScrollTrigger.min.js"></script>
    <script src="assets/js/SplitText.js"></script>
    <script src="assets/js/SplitType.js"></script>
    <script src="assets/js/lenis.min.js"></script>
    <script src="assets/js/CustomEase.min.js"></script>
    <script src="assets/js/main.js"></script>

    <!-- Chat Widget -->
    <?php include 'includes/chat-widget.html'; ?>
    <script src="assets/js/responsive-chat-ai.js"></script>
</body>
</html>
