<?php
/*
|--------------------------------------------------------------------------
| AFRIMEE
| Social Media + Creator Monetization + Marketplace
|--------------------------------------------------------------------------
| Premium Home Feed UI
|--------------------------------------------------------------------------
*/

$appName = "Afrimee";

$posts = [
    [
        "type" => "creator",
        "name" => "Amani Juma",
        "username" => "@amanijuma",
        "avatar" => "https://i.pravatar.cc/150?img=12",
        "verified" => true,
        "premium" => true,
        "time" => "12 min",
        "text" => "Building something amazing for Africa. What are you working on today?",
        "image" => "https://images.unsplash.com/photo-1529156069898-49953e39b3ac?auto=format&fit=crop&w=1200&q=85",
        "views" => "12.8K",
        "likes" => 248,
        "comments" => 31,
        "shares" => 18
    ],

    [
        "type" => "marketplace",
        "name" => "Neema Store",
        "username" => "@neemastore",
        "avatar" => "https://i.pravatar.cc/150?img=32",
        "verified" => true,
        "premium" => false,
        "time" => "35 min",
        "text" => "New arrival. Premium sneakers now available. Delivery available nationwide.",
        "image" => "https://images.unsplash.com/photo-1542291026-7eec264c27ff?auto=format&fit=crop&w=1200&q=85",
        "views" => "5.4K",
        "likes" => 514,
        "comments" => 47,
        "shares" => 29,
        "product" => [
            "name" => "Premium Sneakers",
            "price" => "TSh 89,000",
            "location" => "Mwanza"
        ]
    ],

    [
        "type" => "normal",
        "name" => "Johnson",
        "username" => "@johnson",
        "avatar" => "https://i.pravatar.cc/150?img=11",
        "verified" => true,
        "premium" => true,
        "time" => "1 hr",
        "text" => "Connect with people. Share your ideas. Create value. Earn from your creativity.",
        "image" => "",
        "views" => "24.1K",
        "likes" => 892,
        "comments" => 96,
        "shares" => 71
    ],

    [
        "type" => "sponsored",
        "name" => "Afrimee Business",
        "username" => "@afrimeebusiness",
        "avatar" => "https://i.pravatar.cc/150?img=49",
        "verified" => true,
        "premium" => false,
        "time" => "Sponsored",
        "text" => "Grow your business with Afrimee Ads. Reach customers where they spend their time.",
        "image" => "https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=1200&q=85",
        "views" => "Sponsored",
        "likes" => 321,
        "comments" => 24,
        "shares" => 12
    ]
];
?>

<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="UTF-8">

<meta
    name="viewport"
    content="width=device-width, initial-scale=1.0, maximum-scale=1.0"
>

<title>AfriMee — Connect. Create. Earn. Enjoy.</title>

<meta
    name="description"
    content="Afrimee — Connect, Create, Earn and Enjoy."
>

<meta name="theme-color" content="#050b10">

<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=Inter:wght@400;500;600;700;800&display=swap"
    rel="stylesheet"
>

<style>

/* =========================================================
   DESIGN SYSTEM
========================================================= */

:root{

    --bg:#050a0f;

    --surface:#09131b;

    --surface2:#0c1821;

    --surface3:#10232e;

    --border:rgba(255,255,255,.075);

    --text:#f5f9fc;

    --muted:#81939e;

    --blue:#00b7ef;

    --blue2:#007cff;

    --cyan:#00d8ff;

    --gold:#ffc857;

    --danger:#ff4f70;

    --green:#20d890;

}


/* =========================================================
   RESET
========================================================= */

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

html{
    scroll-behavior:smooth;
}

body{

    font-family:Inter,Arial,sans-serif;

    background:
        radial-gradient(
            circle at 50% -10%,
            rgba(0,183,239,.14),
            transparent 36%
        ),
        var(--bg);

    color:var(--text);

    min-height:100vh;

    padding-bottom:82px;

}

button,
input,
textarea{
    font-family:inherit;
}

button{
    cursor:pointer;
}

a{
    text-decoration:none;
    color:inherit;
}


/* =========================================================
   SVG ICON
========================================================= */

.icon{

    width:20px;
    height:20px;

    stroke:currentColor;

    stroke-width:1.8;

    fill:none;

    stroke-linecap:round;

    stroke-linejoin:round;

}

.icon-sm{

    width:16px;
    height:16px;

}

.icon-lg{

    width:24px;
    height:24px;

}


/* =========================================================
   HEADER
========================================================= */

.topbar{

    position:fixed;

    top:0;
    left:0;
    right:0;

    height:68px;

    z-index:1000;

    display:flex;

    align-items:center;

    justify-content:space-between;

    padding:0 16px;

    background:
        rgba(5,10,15,.88);

    backdrop-filter:blur(24px);

    border-bottom:
        1px solid
        var(--border);

}


.logo{

    display:flex;

    align-items:center;

    gap:9px;

    font-size:21px;

    font-weight:800;

    letter-spacing:-1px;

}


.logo-icon{

    width:35px;
    height:35px;

    border-radius:12px;

    display:flex;

    align-items:center;

    justify-content:center;

    background:
        linear-gradient(
            135deg,
            var(--cyan),
            var(--blue2)
        );

    color:white;

    font-weight:800;

    box-shadow:
        0 0 22px
        rgba(0,183,239,.28);

}


.logo span{
    color:white;
}

.logo b{
    color:var(--cyan);
}


.header-actions{

    display:flex;

    align-items:center;

    gap:8px;

}


.icon-button{

    width:40px;
    height:40px;

    border:
        1px solid
        var(--border);

    border-radius:13px;

    display:flex;

    align-items:center;

    justify-content:center;

    color:#cbd9df;

    background:
        rgba(255,255,255,.035);

    position:relative;

}


.notification-dot{

    width:7px;
    height:7px;

    position:absolute;

    top:7px;
    right:7px;

    border-radius:50%;

    background:var(--cyan);

    box-shadow:
        0 0 9px
        var(--cyan);

}


/* =========================================================
   MAIN
========================================================= */

.container{

    width:100%;

    max-width:700px;

    margin:auto;

    padding:
        84px
        12px
        20px;

}


/* =========================================================
   STORIES
========================================================= */

.stories{

    display:flex;

    gap:13px;

    overflow-x:auto;

    padding:
        4px
        2px
        18px;

    scrollbar-width:none;

}

.stories::-webkit-scrollbar{
    display:none;
}


.story{

    min-width:62px;

    text-align:center;

}


.story-ring{

    width:60px;
    height:60px;

    padding:2px;

    margin:auto;

    border-radius:50%;

    background:
        linear-gradient(
            135deg,
            var(--cyan),
            var(--blue2),
            #754cff
        );

}


.story-ring img{

    width:100%;
    height:100%;

    object-fit:cover;

    border-radius:50%;

    border:3px solid var(--bg);

}


.story-name{

    margin-top:6px;

    font-size:9px;

    color:#98aab4;

    white-space:nowrap;

    overflow:hidden;

    text-overflow:ellipsis;

}


.story-add{

    background:
        var(--surface2);

    position:relative;

    display:flex;

    align-items:center;

    justify-content:center;

}


.story-add .plus{

    position:absolute;

    right:-1px;
    bottom:-1px;

    width:22px;
    height:22px;

    border-radius:50%;

    display:flex;

    align-items:center;
    justify-content:center;

    background:
        linear-gradient(
            135deg,
            var(--cyan),
            var(--blue2)
        );

    border:
        2px solid
        var(--bg);

    color:white;

}


/* =========================================================
   FEED TABS
========================================================= */

.feed-tabs{

    display:flex;

    gap:7px;

    overflow-x:auto;

    scrollbar-width:none;

    margin-bottom:14px;

}

.feed-tabs::-webkit-scrollbar{
    display:none;
}


.feed-tab{

    border:
        1px solid
        var(--border);

    background:
        rgba(255,255,255,.025);

    color:var(--muted);

    padding:
        9px
        16px;

    border-radius:20px;

    font-size:10px;

    white-space:nowrap;

}


.feed-tab.active{

    color:var(--cyan);

    border-color:
        rgba(0,183,239,.30);

    background:
        rgba(0,183,239,.09);

}


/* =========================================================
   CREATE BOX
========================================================= */

.create-box{

    padding:14px;

    margin-bottom:15px;

    border-radius:20px;

    border:
        1px solid
        rgba(0,183,239,.13);

    background:
        linear-gradient(
            145deg,
            rgba(0,183,239,.08),
            rgba(255,255,255,.025)
        );

}


.create-row{

    display:flex;

    align-items:center;

    gap:10px;

}


.my-avatar{

    width:42px;
    height:42px;

    object-fit:cover;

    border-radius:50%;

}


.post-input{

    flex:1;

    height:44px;

    display:flex;

    align-items:center;

    padding:0 15px;

    border-radius:14px;

    background:
        rgba(255,255,255,.045);

    border:
        1px solid
        var(--border);

    color:#7f929d;

    font-size:12px;

    transition:.2s;

}


.post-input:hover{

    border-color:
        rgba(0,183,239,.25);

    background:
        rgba(0,183,239,.045);

}


/* =========================================================
   FEED
========================================================= */

.feed{

    display:flex;

    flex-direction:column;

    gap:14px;

}


.post{

    overflow:hidden;

    border-radius:21px;

    border:
        1px solid
        var(--border);

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.045),
            rgba(255,255,255,.018)
        );

}


.post.sponsored{

    border-color:
        rgba(0,183,239,.20);

}


/* =========================================================
   POST HEADER
========================================================= */

.post-header{

    padding:14px;

    display:flex;

    align-items:center;

    justify-content:space-between;

}


.user-info{

    display:flex;

    align-items:center;

    gap:10px;

}


.avatar{

    width:43px;
    height:43px;

    object-fit:cover;

    border-radius:50%;

    border:
        2px solid
        rgba(0,183,239,.28);

}


.name-line{

    display:flex;

    align-items:center;

    gap:5px;

}


.user-name{

    font-size:12px;

    font-weight:700;

}


.username{

    margin-top:3px;

    color:var(--muted);

    font-size:9px;

}


.verified{

    width:15px;
    height:15px;

    display:flex;

    align-items:center;
    justify-content:center;

    border-radius:50%;

    background:
        var(--blue);

    color:white;

    font-size:8px;

}


.premium{

    color:var(--gold);

}


.follow-btn{

    margin-left:7px;

    padding:
        5px
        9px;

    border-radius:8px;

    border:
        1px solid
        rgba(0,183,239,.25);

    background:
        rgba(0,183,239,.06);

    color:var(--cyan);

    font-size:8px;

}


.more-button{

    width:32px;
    height:32px;

    border:0;

    background:none;

    color:#728591;

    display:flex;

    align-items:center;

    justify-content:center;

}


/* =========================================================
   POST TEXT
========================================================= */

.post-text{

    padding:
        0
        14px
        14px;

    color:#d7e4ea;

    font-size:12px;

    line-height:1.65;

}


/* =========================================================
   POST IMAGE
========================================================= */

.post-image{

    width:100%;

    max-height:470px;

    display:block;

    object-fit:cover;

}


/* =========================================================
   PRODUCT
========================================================= */

.product-card{

    margin:
        12px;

    padding:12px;

    display:flex;

    align-items:center;

    justify-content:space-between;

    gap:10px;

    border-radius:15px;

    border:
        1px solid
        rgba(0,183,239,.13);

    background:
        rgba(0,183,239,.055);

}


.product-info h4{

    font-size:11px;

    margin-bottom:5px;

}


.product-price{

    color:var(--cyan);

    font-size:11px;

    font-weight:700;

}


.product-location{

    margin-top:4px;

    color:var(--muted);

    font-size:8px;

}


.buy-btn{

    border:0;

    padding:
        9px
        12px;

    border-radius:10px;

    color:white;

    background:
        linear-gradient(
            135deg,
            var(--cyan),
            var(--blue2)
        );

    font-size:9px;

    font-weight:700;

}


/* =========================================================
   POST STATS
========================================================= */

.post-stats{

    padding:
        0
        14px
        9px;

    display:flex;

    justify-content:space-between;

    color:#667b87;

    font-size:8px;

}


/* =========================================================
   POST ACTIONS
========================================================= */

.post-actions{

    padding:
        10px
        14px;

    border-top:
        1px solid
        rgba(255,255,255,.045);

    display:flex;

    align-items:center;

    justify-content:space-between;

}


.action-left{

    display:flex;

    gap:19px;

}


.action{

    display:flex;

    align-items:center;

    gap:5px;

    color:#81939e;

    font-size:9px;

}


.action-button{

    border:0;

    background:none;

    color:inherit;

    display:flex;

    align-items:center;

    gap:5px;

}


.action.liked{

    color:#00c8ff;

}


/* =========================================================
   CREATE MODAL
========================================================= */

.overlay{

    position:fixed;

    inset:0;

    z-index:2000;

    background:
        rgba(0,0,0,.68);

    backdrop-filter:blur(8px);

    opacity:0;

    pointer-events:none;

    transition:.2s;

}


.overlay.show{

    opacity:1;

    pointer-events:auto;

}


.create-modal{

    position:fixed;

    left:50%;

    bottom:0;

    transform:
        translate(-50%,100%);

    width:
        min(100%,560px);

    z-index:2100;

    background:
        #09131b;

    border:
        1px solid
        rgba(0,183,239,.16);

    border-radius:
        24px
        24px
        0
        0;

    padding:18px;

    transition:.28s;

}


.create-modal.show{

    transform:
        translate(-50%,0);

}


.modal-header{

    display:flex;

    align-items:center;

    justify-content:space-between;

    margin-bottom:16px;

}


.modal-title{

    font-size:15px;

    font-weight:700;

}


.close-button{

    width:34px;
    height:34px;

    border:0;

    border-radius:10px;

    background:
        rgba(255,255,255,.05);

    color:#aab9c0;

    display:flex;

    align-items:center;
    justify-content:center;

}


/* COMPOSER */

.composer{

    border:
        1px solid
        var(--border);

    border-radius:16px;

    overflow:hidden;

}


.composer textarea{

    width:100%;

    min-height:130px;

    resize:none;

    border:0;

    outline:none;

    background:transparent;

    color:white;

    padding:15px;

    font-size:13px;

}


.composer textarea::placeholder{
    color:#637681;
}


.media-preview{

    display:none;

    padding:10px;

}


.media-preview img,
.media-preview video{

    width:100%;

    max-height:280px;

    object-fit:cover;

    border-radius:12px;

}


.composer-toolbar{

    padding:10px;

    border-top:
        1px solid
        var(--border);

    display:flex;

    align-items:center;

    justify-content:space-between;

}


.media-buttons{

    display:flex;

    gap:7px;

}


.media-button{

    border:
        1px solid
        var(--border);

    background:
        rgba(255,255,255,.035);

    color:#a9bac3;

    padding:
        8px
        10px;

    border-radius:10px;

    display:flex;

    align-items:center;

    gap:6px;

    font-size:9px;

}


.publish-button{

    border:0;

    padding:
        9px
        15px;

    border-radius:10px;

    color:white;

    background:
        linear-gradient(
            135deg,
            var(--cyan),
            var(--blue2)
        );

    font-size:9px;

    font-weight:700;

}


/* =========================================================
   CREATE OPTIONS
========================================================= */

.create-options{

    display:grid;

    grid-template-columns:
        repeat(3,1fr);

    gap:8px;

    margin-top:12px;

}


.create-option{

    padding:14px 8px;

    border:
        1px solid
        var(--border);

    border-radius:14px;

    background:
        rgba(255,255,255,.025);

    color:#b9c8ce;

    text-align:center;

    font-size:9px;

}


.create-option .option-icon{

    width:27px;
    height:27px;

    margin:
        0 auto 8px;

    display:flex;

    align-items:center;
    justify-content:center;

    border-radius:9px;

    color:var(--cyan);

    background:
        rgba(0,183,239,.08);

}


/* =========================================================
   BOTTOM NAVIGATION
========================================================= */

.bottom-nav{

    position:fixed;

    left:0;
    right:0;
    bottom:0;

    height:72px;

    z-index:1000;

    background:
        rgba(5,10,15,.95);

    backdrop-filter:blur(24px);

    border-top:
        1px solid
        var(--border);

}


.nav-inner{

    width:100%;

    max-width:700px;

    height:100%;

    margin:auto;

    display:flex;

    align-items:center;

    justify-content:space-around;

}


.nav-item{

    width:20%;
    height:100%;

    display:flex;

    flex-direction:column;

    align-items:center;

    justify-content:center;

    gap:4px;

    color:#647781;

    font-size:8px;

    position:relative;

}


.nav-item.active{

    color:var(--cyan);

}


.nav-item.active:before{

    content:"";

    position:absolute;

    top:0;

    width:28px;
    height:2px;

    border-radius:4px;

    background:
        var(--cyan);

    box-shadow:
        0 0 12px
        rgba(0,216,255,.7);

}


.create-nav{

    width:48px;
    height:48px;

    margin-top:-20px;

    border-radius:17px;

    display:flex;

    align-items:center;
    justify-content:center;

    color:white;

    background:
        linear-gradient(
            135deg,
            var(--cyan),
            var(--blue2)
        );

    box-shadow:
        0 10px 30px
        rgba(0,183,239,.28);

}


/* =========================================================
   DESKTOP
========================================================= */

@media(min-width:900px){

    .topbar{

        padding-left:
            calc((100% - 700px)/2);

        padding-right:
            calc((100% - 700px)/2);

    }

    .container{

        padding-top:90px;

    }

    .create-modal{

        bottom:20px;

        border-radius:24px;

    }

}


/* =========================================================
   SMALL SCREEN
========================================================= */

@media(max-width:390px){

    .create-options{

        grid-template-columns:
            repeat(2,1fr);

    }

    .action-left{

        gap:12px;

    }

}

</style>

</head>


<body>


<!-- =====================================================
     HEADER
===================================================== -->

<header class="topbar">

    <div class="logo">

        <div class="logo-icon">
            A
        </div>

        <span>
            Afri<b>mee</b>
        </span>

    </div>


    <div class="header-actions">

        <button class="icon-button">

            <svg class="icon">
                <use href="#search"></use>
            </svg>

        </button>


        <button class="icon-button">

            <svg class="icon">
                <use href="#bell"></use>
            </svg>

            <span class="notification-dot"></span>

        </button>


        <button class="icon-button">

            <svg class="icon">
                <use href="#message"></use>
            </svg>

        </button>

    </div>

</header>



<!-- =====================================================
     SVG ICON DEFINITIONS
===================================================== -->

<svg style="display:none">

    <symbol id="search" viewBox="0 0 24 24">
        <circle cx="11" cy="11" r="7"></circle>
        <path d="M20 20l-4-4"></path>
    </symbol>


    <symbol id="bell" viewBox="0 0 24 24">
        <path d="M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"></path>
        <path d="M10 21h4"></path>
    </symbol>


    <symbol id="message" viewBox="0 0 24 24">
        <path d="M20 11.5a8 8 0 0 1-8 8H7l-4 2v-4.5a8 8 0 1 1 17-5.5z"></path>
    </symbol>


    <symbol id="home" viewBox="0 0 24 24">
        <path d="M3 10.5L12 3l9 7.5"></path>
        <path d="M5 9.5V21h14V9.5"></path>
        <path d="M9 21v-6h6v6"></path>
    </symbol>


    <symbol id="reels" viewBox="0 0 24 24">
        <rect x="3" y="4" width="18" height="17" rx="4"></rect>
        <path d="M3 9h18"></path>
        <path d="M8 4l3 5"></path>
        <path d="M14 4l3 5"></path>
        <path d="M10 13l5 3-5 3z"></path>
    </symbol>


    <symbol id="store" viewBox="0 0 24 24">
        <path d="M4 10v10h16V10"></path>
        <path d="M3 10l2-6h14l2 6"></path>
        <path d="M3 10a3 3 0 0 0 6 0 3 3 0 0 0 6 0 3 3 0 0 0 6 0"></path>
        <path d="M9 20v-5h6v5"></path>
    </symbol>


    <symbol id="user" viewBox="0 0 24 24">
        <circle cx="12" cy="8" r="4"></circle>
        <path d="M4 21a8 8 0 0 1 16 0"></path>
    </symbol>


    <symbol id="plus" viewBox="0 0 24 24">
        <path d="M12 5v14"></path>
        <path d="M5 12h14"></path>
    </symbol>


    <symbol id="image" viewBox="0 0 24 24">
        <rect x="3" y="4" width="18" height="16" rx="3"></rect>
        <circle cx="8" cy="9" r="1.5"></circle>
        <path d="M21 16l-5-5-7 7"></path>
    </symbol>


    <symbol id="video" viewBox="0 0 24 24">
        <rect x="3" y="5" width="13" height="14" rx="3"></rect>
        <path d="M16 10l5-3v10l-5-3z"></path>
    </symbol>


    <symbol id="heart" viewBox="0 0 24 24">
        <path d="M20.8 8.8c0 5-8.8 10.2-8.8 10.2S3.2 13.8 3.2 8.8A4.8 4.8 0 0 1 12 6.1a4.8 4.8 0 0 1 8.8 2.7z"></path>
    </symbol>


    <symbol id="comment" viewBox="0 0 24 24">
        <path d="M20 11.5a8 8 0 0 1-8 8H7l-4 2v-4.5a8 8 0 1 1 17-5.5z"></path>
    </symbol>


    <symbol id="share" viewBox="0 0 24 24">
        <path d="M21 3L10 14"></path>
        <path d="M21 3l-7 18-4-7-7-4z"></path>
    </symbol>


    <symbol id="bookmark" viewBox="0 0 24 24">
        <path d="M6 4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18l-6-4-6 4z"></path>
    </symbol>


    <symbol id="close" viewBox="0 0 24 24">
        <path d="M6 6l12 12"></path>
        <path d="M18 6L6 18"></path>
    </symbol>


    <symbol id="live" viewBox="0 0 24 24">
        <circle cx="12" cy="12" r="4"></circle>
        <path d="M5 7a8 8 0 0 0 0 10"></path>
        <path d="M19 7a8 8 0 0 1 0 10"></path>
    </symbol>


    <symbol id="bag" viewBox="0 0 24 24">
        <path d="M5 8h14l1 13H4z"></path>
        <path d="M9 8V6a3 3 0 0 1 6 0v2"></path>
    </symbol>


    <symbol id="megaphone" viewBox="0 0 24 24">
        <path d="M4 14h4l10 5V5L8 10H4z"></path>
        <path d="M8 14l1 6"></path>
    </symbol>


    <symbol id="film" viewBox="0 0 24 24">
        <rect x="3" y="4" width="18" height="16" rx="3"></rect>
        <path d="M8 4v4"></path>
        <path d="M16 4v4"></path>
        <path d="M8 16v4"></path>
        <path d="M16 16v4"></path>
    </symbol>

</svg>



<!-- =====================================================
     MAIN
===================================================== -->

<main class="container">


<!-- STORIES -->

<section class="stories">


    <div class="story">

        <div class="story-ring story-add">

            <img
                src="https://i.pravatar.cc/150?img=11"
            >

            <span class="plus">

                <svg class="icon-sm">
                    <use href="#plus"></use>
                </svg>

            </span>

        </div>

        <div class="story-name">
            Your Story
        </div>

    </div>


    <div class="story">

        <div class="story-ring">

            <img
                src="https://i.pravatar.cc/150?img=13"
            >

        </div>

        <div class="story-name">
            David
        </div>

    </div>


    <div class="story">

        <div class="story-ring">

            <img
                src="https://i.pravatar.cc/150?img=32"
            >

        </div>

        <div class="story-name">
            Neema
        </div>

    </div>


    <div class="story">

        <div class="story-ring">

            <img
                src="https://i.pravatar.cc/150?img=53"
            >

        </div>

        <div class="story-name">
            Brian
        </div>

    </div>


    <div class="story">

        <div class="story-ring">

            <img
                src="https://i.pravatar.cc/150?img=44"
            >

        </div>

        <div class="story-name">
            Mercy
        </div>

    </div>


    <div class="story">

        <div class="story-ring">

            <img
                src="https://i.pravatar.cc/150?img=68"
            >

        </div>

        <div class="story-name">
            Kevin
        </div>

    </div>


</section>



<!-- FEED FILTER -->

<div class="feed-tabs">

    <button class="feed-tab active">
        For You
    </button>

    <button class="feed-tab">
        Following
    </button>

    <button class="feed-tab">
        Trending
    </button>

</div>



<!-- CREATE POST -->

<section class="create-box">

    <div class="create-row">

        <img
            class="my-avatar"
            src="https://i.pravatar.cc/150?img=11"
        >


        <div
            class="post-input"
            onclick="openComposer()"
        >
            What's happening?
        </div>

    </div>

</section>



<!-- FEED -->

<section class="feed">


<?php foreach($posts as $post): ?>


<article
    class="post
    <?= $post['type'] === 'sponsored'
        ? 'sponsored'
        : '' ?>"
>


<!-- HEADER -->

<div class="post-header">

    <div class="user-info">

        <img
            class="avatar"
            src="<?= htmlspecialchars($post['avatar']) ?>"
        >


        <div>

            <div class="name-line">

                <span class="user-name">

                    <?= htmlspecialchars($post['name']) ?>

                </span>


                <?php if($post['verified']): ?>

                    <span class="verified">
                        ✓
                    </span>

                <?php endif; ?>


                <?php if($post['premium']): ?>

                    <span class="premium">
                        ★
                    </span>

                <?php endif; ?>

            </div>


            <div class="username">

                <?= htmlspecialchars($post['username']) ?>

                ·

                <?= htmlspecialchars($post['time']) ?>

            </div>

        </div>

    </div>


    <button class="more-button">

        <svg class="icon-sm">
            <use href="#more"></use>
        </svg>

    </button>

</div>



<!-- TEXT -->

<div class="post-text">

    <?= htmlspecialchars($post['text']) ?>

</div>



<!-- IMAGE -->

<?php if(!empty($post['image'])): ?>

<img
    class="post-image"
    src="<?= htmlspecialchars($post['image']) ?>"
    loading="lazy"
>

<?php endif; ?>



<!-- MARKETPLACE -->

<?php if($post['type'] === 'marketplace'): ?>

<div class="product-card">

    <div class="product-info">

        <h4>
            <?= htmlspecialchars($post['product']['name']) ?>
        </h4>

        <div class="product-price">

            <?= htmlspecialchars($post['product']['price']) ?>

        </div>

        <div class="product-location">

            <?= htmlspecialchars($post['product']['location']) ?>

        </div>

    </div>


    <button class="buy-btn">
        View Product
    </button>

</div>

<?php endif; ?>



<!-- STATS -->

<div class="post-stats">

    <span>

        <?= htmlspecialchars($post['views']) ?>
        views

    </span>


    <span>

        <?= $post['comments'] ?>
        comments ·

        <?= $post['shares'] ?>
        shares

    </span>

</div>



<!-- ACTIONS -->

<div class="post-actions">


    <div class="action-left">


        <div class="action like-action">

            <button
                class="action-button"
                onclick="toggleLike(this)"
            >

                <svg class="icon">
                    <use href="#flame"></use>
                </svg>

                <span>
                    <?= $post['likes'] ?>
                </span>

            </button>

        </div>


        <div class="action">

            <button class="action-button">

                <svg class="icon">
                    <use href="#comment"></use>
                </svg>

                <span>
                    <?= $post['comments'] ?>
                </span>

            </button>

        </div>


        <div class="action">

            <button class="action-button">

                <svg class="icon">
                    <use href="#share"></use>
                </svg>

                <span>
                    Share
                </span>

            </button>

        </div>


    </div>


    <div class="action">

        <button class="action-button">

            <svg class="icon">
                <use href="#bookmark"></use>
            </svg>

        </button>

    </div>


</div>


</article>


<?php endforeach; ?>


</section>

</main>



<!-- =====================================================
     CREATE OVERLAY
===================================================== -->

<div
    class="overlay"
    id="overlay"
    onclick="closeComposer()"
></div>



<!-- =====================================================
     CREATE MODAL
===================================================== -->

<section
    class="create-modal"
    id="createModal"
>


    <div class="modal-header">

        <div class="modal-title">
            Create on Afrimee
        </div>


        <button
            class="close-button"
            onclick="closeComposer()"
        >

            <svg class="icon-sm">
                <use href="#close"></use>
            </svg>

        </button>

    </div>


    <!-- COMPOSER -->

    <div class="composer">

        <textarea
            id="postText"
            placeholder="Share something with Afrimee..."
        ></textarea>


        <div
            class="media-preview"
            id="mediaPreview"
        >

            <img
                id="imagePreview"
                style="display:none;"
            >

            <video
                id="videoPreview"
                style="display:none;"
                controls
            ></video>

        </div>


        <div class="composer-toolbar">


            <div class="media-buttons">


                <button
                    class="media-button"
                    onclick="document.getElementById('photoInput').click()"
                >

                    <svg class="icon-sm">
                        <use href="#image"></use>
                    </svg>

                    Add Photo

                </button>


                <button
                    class="media-button"
                    onclick="document.getElementById('videoInput').click()"
                >

                    <svg class="icon-sm">
                        <use href="#video"></use>
                    </svg>

                    Add Video

                </button>


            </div>


            <button
                class="publish-button"
                onclick="publishDemoPost()"
            >
                Post
            </button>


        </div>

    </div>


    <input
        type="file"
        id="photoInput"
        accept="image/*"
        hidden
        onchange="previewPhoto(this)"
    >


    <input
        type="file"
        id="videoInput"
        accept="video/*"
        hidden
        onchange="previewVideo(this)"
    >



    <!-- CREATE OPTIONS -->

    <div class="create-options">


        <button class="create-option">

            <div class="option-icon">

                <svg class="icon-sm">
                    <use href="#film"></use>
                </svg>

            </div>

            Reel

        </button>


        <button class="create-option">

            <div class="option-icon">

                <svg class="icon-sm">
                    <use href="#live"></use>
                </svg>

            </div>

            Go Live

        </button>


        <button class="create-option">

            <div class="option-icon">

                <svg class="icon-sm">
                    <use href="#bag"></use>
                </svg>

            </div>

            List Product

        </button>


        <button class="create-option">

            <div class="option-icon">

                <svg class="icon-sm">
                    <use href="#megaphone"></use>
                </svg>

            </div>

            Advertisement

        </button>


        <button class="create-option">

            <div class="option-icon">

                <svg class="icon-sm">
                    <use href="#image"></use>
                </svg>

            </div>

            Story

        </button>


        <button class="create-option">

            <div class="option-icon">

                <svg class="icon-sm">
                    <use href="#film"></use>
                </svg>

            </div>

            More

        </button>


    </div>

</section>



<!-- =====================================================
     BOTTOM NAVIGATION
===================================================== -->

<nav class="bottom-nav">

<div class="nav-inner">


    <a
        href="#"
        class="nav-item active"
    >

        <svg class="icon">
            <use href="#home"></use>
        </svg>

        <span>
            Home
        </span>

    </a>



    <a
        href="#"
        class="nav-item"
    >

        <svg class="icon">
            <use href="#reels"></use>
        </svg>

        <span>
            Reels
        </span>

    </a>



    <button
        class="nav-item"
        style="border:0;background:none;"
        onclick="openComposer()"
    >

        <div class="create-nav">

            <svg class="icon-lg">
                <use href="#plus"></use>
            </svg>

        </div>

    </button>



    <a
        href="#"
        class="nav-item"
    >

        <svg class="icon">
            <use href="#store"></use>
        </svg>

        <span>
            Marketplace
        </span>

    </a>



    <a
        href="#"
        class="nav-item"
    >

        <svg class="icon">
            <use href="#user"></use>
        </svg>

        <span>
            Profile
        </span>

    </a>


</div>

</nav>



<script>

/* =========================================================
   ADDITIONAL ICONS
========================================================= */

const svgDefs = document.querySelector("body > svg");

svgDefs.innerHTML += `
<symbol id="flame" viewBox="0 0 24 24">
    <path d="M12 21c5 0 8-3.2 8-7.5 0-3.4-2.1-6.1-5.2-8.6.1 2.2-.6 3.7-1.8 4.7.2-3.5-1.5-6.2-4.7-8.6.2 3.8-3.3 5.6-3.3 9.5C5 17.7 8 21 12 21z"></path>
</symbol>

<symbol id="more" viewBox="0 0 24 24">
    <circle cx="5" cy="12" r="1"></circle>
    <circle cx="12" cy="12" r="1"></circle>
    <circle cx="19" cy="12" r="1"></circle>
</symbol>
`;


/* =========================================================
   CREATE COMPOSER
========================================================= */

function openComposer(){

    document
        .getElementById("overlay")
        .classList.add("show");

    document
        .getElementById("createModal")
        .classList.add("show");

    document.body.style.overflow = "hidden";

}


function closeComposer(){

    document
        .getElementById("overlay")
        .classList.remove("show");

    document
        .getElementById("createModal")
        .classList.remove("show");

    document.body.style.overflow = "";

}


/* =========================================================
   PHOTO PREVIEW
========================================================= */

function previewPhoto(input){

    if(!input.files || !input.files[0]){
        return;
    }

    const file = input.files[0];

    const reader = new FileReader();

    reader.onload = function(e){

        const preview =
            document.getElementById("mediaPreview");

        const image =
            document.getElementById("imagePreview");

        const video =
            document.getElementById("videoPreview");

        image.src = e.target.result;

        image.style.display = "block";

        video.style.display = "none";

        preview.style.display = "block";

    };

    reader.readAsDataURL(file);

}


/* =========================================================
   VIDEO PREVIEW
========================================================= */

function previewVideo(input){

    if(!input.files || !input.files[0]){
        return;
    }

    const file = input.files[0];

    const url =
        URL.createObjectURL(file);

    const preview =
        document.getElementById("mediaPreview");

    const image =
        document.getElementById("imagePreview");

    const video =
        document.getElementById("videoPreview");

    video.src = url;

    video.style.display = "block";

    image.style.display = "none";

    preview.style.display = "block";

}


/* =========================================================
   LIKE
========================================================= */

function toggleLike(button){

    const parent =
        button.closest(".action");

    const number =
        button.querySelector("span");

    let count =
        parseInt(number.textContent);

    if(parent.classList.contains("liked")){

        parent.classList.remove("liked");

        count--;

    }else{

        parent.classList.add("liked");

        count++;

    }

    number.textContent = count;

}


/* =========================================================
   DEMO POST
========================================================= */

function publishDemoPost(){

    const text =
        document
        .getElementById("postText")
        .value
        .trim();

    if(!text){

        alert("Please write something first.");

        return;

    }

    alert("Demo post created successfully.");

    document
        .getElementById("postText")
        .value = "";

    closeComposer();

}


/* =========================================================
   FEED TABS
========================================================= */

document
.querySelectorAll(".feed-tab")
.forEach(function(tab){

    tab.addEventListener(
        "click",
        function(){

            document
            .querySelectorAll(".feed-tab")
            .forEach(function(item){

                item.classList.remove("active");

            });

            this.classList.add("active");

        }
    );

});


/* =========================================================
   ESC KEY
========================================================= */

document.addEventListener(
    "keydown",
    function(event){

        if(event.key === "Escape"){

            closeComposer();

        }

    }
);

</script>


</body>
</html>