<?php
session_start();
include('includes/config.php');

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

$user_id = $_SESSION['user_id'];
$query = mysqli_query($conn, "SELECT * FROM users WHERE id='$user_id'");
$user = mysqli_fetch_assoc($query);
?>
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Profil Saya</title>
<style>
*{margin:0;padding:0;box-sizing:border-box;}
body{font-family:'Poppins',sans-serif;background:#f5f7fa;color:#333;}
nav{position:fixed;top:0;left:0;width:100%;background:rgba(30,136,229,0.4);backdrop-filter:blur(10px);padding:18px 50px;display:flex;justify-content:space-between;align-items:center;z-index:1000;}
nav .logo{font-size:1.8rem;font-weight:800;color:#fff;letter-spacing:2px;text-transform:uppercase;text-shadow:0 3px 6px rgba(0,0,0,0.4);}
nav ul{list-style:none;display:flex;gap:30px;align-items:center;}
nav ul li a{color:#fff;text-decoration:none;font-weight:500;transition:.3s;font-size:1rem;}
nav ul li a:hover{color:#ffeb3b;}
.container{width:90%;margin:120px auto;text-align:center;background:#fff;padding:30px;border-radius:15px;box-shadow:0 4px 10px rgba(0,0,0,0.1);}
h2{color:#1e88e5;margin-bottom:20px;}
.btn{display:inline-block;background:#00b4d8;color:#fff;text-decoration:none;border-radius:6px;padding:8px 12px;font-weight:600;transition:.3s;}
.btn:hover{background:#0096c7;}
</style>
</head>
<body>


<nav>
  <div class="logo">ALFATEEH SEPATUKU</div>
  <ul>
    <li><a href="index.php">Beranda</a></li>
    <li><a href="product.php">Product</a></li>
    <li><a href="tentang.php">Tentang</a></li>
    <li class="dropdown">
      <a href="profil.php" class="dropbtn">My Profile 👤</a>
      <ul class="dropdown-content">
        <li><a href="profil.php">Profil Saya</a></li>
        <li><a href="edit_profil.php">Edit Profil</a></li>
        <li><a href="ubah_password.php">Ubah Password</a></li>
        <li><a href="logout.php" style="color:#ffeb3b;">Logout</a></li>
      </ul>
    </li>
    <li><a href="status_pesanan.php">Pesanan 🔄</a></li>
  </ul>
</nav>


<div class="container">
  <h2>Profil Saya</h2>
  <p><strong>Nama:</strong> <?= htmlspecialchars($user['nama']) ?></p>
  <p><strong>Email:</strong> <?= htmlspecialchars($user['email']) ?></p>
  <a href="edit_profil.php" class="btn">Edit Profil</a>
  <a href="ubah_password.php" class="btn">Ubah Password</a>
</div>
</body>
</html>
