/
home
/
u764571690
/
domains
/
ojaspunj.com
/
public_html
/
/home/u764571690/domains/ojaspunj.com/public_html
mkdir
upload
Name
Size
Mode
Actions
api/
-
0755
rm
app/
-
0755
rm
billing/
-
0755
rm
certificates/
-
0755
rm
css/
-
0755
rm
detail image/
-
0755
rm
favicon_io/
-
0755
rm
fontawesome/
-
0755
rm
fonts/
-
0755
rm
image/
-
0755
rm
indeximage/
-
0755
rm
js/
-
0755
rm
OFFER PRODUCT/
-
0755
rm
offer product/
-
0755
rm
our product/
-
0755
rm
productdetail/
-
0755
rm
qwertyuiopasdfghjklzxcvbnmmnbvcxzlkjhgfdsapoiuytrewqqazwsxedcrfvtgbyhnujmikolppolikujmyhntgbrfvedcwsxqazasdfghjklpoiuytrewqzxcvbnmqwasedrftgyhjuikoplkjhgfdsazxcvbnmkoiuyhgtfrdeswqaszxdfcvgfdewwsdwasjdjfoifsdnjfhsudhfgjdssdhfgushfgbdghuifgbdgvhsdfg/
-
0755
rm
scholarship/
-
0755
rm
upload product/
-
0755
rm
vendor/
-
0755
rm
.htaccess
2654
0644
edit
dl
rm
about.php
23570
0644
edit
dl
rm
add_certificate.php
7159
0644
edit
dl
rm
add_offer_product.php
9101
0644
edit
dl
rm
add_our_product.php
7146
0644
edit
dl
rm
add_product.php
7186
0644
edit
dl
rm
admin_dashboard.php
27932
0644
edit
dl
rm
admin_login.php
4991
0644
edit
dl
rm
android-chrome-192x192.png
26999
0644
edit
dl
rm
android-chrome-512x512.png
130182
0644
edit
dl
rm
apple-touch-icon.png
24276
0644
edit
dl
rm
bmi.html
11059
0644
edit
dl
rm
buy.php
34458
0644
edit
dl
rm
check_session.php
3228
0644
edit
dl
rm
composer-setup.php
58444
0644
edit
dl
rm
composer.json
99
0644
edit
dl
rm
composer.lock
47706
0644
edit
dl
rm
composer.phar
3125568
0644
edit
dl
rm
config.php
246
0644
edit
dl
rm
contact.php
5852
0644
edit
dl
rm
create_remember_tokens.php
573
0644
edit
dl
rm
dashboard.php
140056
0644
edit
dl
rm
db_connect.php
712
0644
edit
dl
rm
delete_product.php
2567
0644
edit
dl
rm
edit_offer_product.php
7258
0644
edit
dl
rm
favicon-16x16.png
738
0644
edit
dl
rm
favicon.ico
15406
0644
edit
dl
rm
favicon.png
1958
0644
edit
dl
rm
get_product_detail_filename.php
647
0644
edit
dl
rm
google8752ffcd74dff0e8.html
53
0644
edit
dl
rm
googledc4255937cf5f8da.html
53
0644
edit
dl
rm
google_oauth.php
6539
0644
edit
dl
rm
index.php
69621
0644
edit
dl
rm
loading.html
584
0644
edit
dl
rm
log.php
596
0644
edit
dl
rm
login.php
17416
0644
edit
dl
rm
logout.php
598
0644
edit
dl
rm
my_orders.php
13285
0644
edit
dl
rm
order_success.php
3544
0644
edit
dl
rm
our_certificate.php
10809
0644
edit
dl
rm
our_product.php
9589
0644
edit
dl
rm
privacypolicy.php
4277
0644
edit
dl
rm
product1.php
22023
0644
edit
dl
rm
profile.php
18426
0644
edit
dl
rm
refund.php
6282
0644
edit
dl
rm
register.php
15800
0644
edit
dl
rm
robots.txt
742
0644
edit
dl
rm
savitrfoundationscholarship.php
160332
0644
edit
dl
rm
sitemap.xml
935
0644
edit
dl
rm
specialoffer.php
13234
0644
edit
dl
rm
terms$condition.php
6412
0644
edit
dl
rm
verify_payment.php
19770
0644
edit
dl
rm
view.php
4870
0644
edit
dl
rm
x.php
19056
0644
edit
dl
rm
Edit:
/home/u764571690/domains/ojaspunj.com/public_html/dashboard.php
(140056B)
<?php session_start(); // Start the session at the very beginning // Debug session error_reporting(E_ALL); ini_set('display_errors', 1); // Set cache control headers to prevent caching header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Debug session data error_log("Dashboard - Session data: " . print_r($_SESSION, true)); error_log("Dashboard - Request method: " . $_SERVER['REQUEST_METHOD']); error_log("Dashboard - User agent: " . $_SERVER['HTTP_USER_AGENT']); // Handle view mode $view_mode = $_GET['view'] ?? 'desktop'; if (!isset($_SESSION['view_mode']) || $_SESSION['view_mode'] !== $view_mode) { $_SESSION['view_mode'] = $view_mode; session_write_close(); } // Check if user is logged in, if not, redirect to login page if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true) { error_log("Dashboard - User not logged in. Redirecting to login page."); // Get the current domain and protocol $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http'; $domain = $_SERVER['HTTP_HOST']; // Debug information error_log("Dashboard - Attempting redirect to login"); error_log("Dashboard - Protocol: " . $protocol); error_log("Dashboard - Domain: " . $domain); error_log("Dashboard - Full redirect URL: " . $protocol . '://' . $domain . '/login.php'); header('Location: ' . $protocol . '://' . $domain . '/login.php'); exit(); } // Verify user data exists if (!isset($_SESSION['user_id']) || !isset($_SESSION['user_email']) || !isset($_SESSION['user_name'])) { error_log("Dashboard - Missing user data in session. Redirecting to login page."); // Get the current domain and protocol $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http'; $domain = $_SERVER['HTTP_HOST']; // Debug information error_log("Dashboard - Attempting redirect to login (missing data)"); error_log("Dashboard - Protocol: " . $protocol); error_log("Dashboard - Domain: " . $domain); error_log("Dashboard - Full redirect URL: " . $protocol . '://' . $domain . '/login.php'); header('Location: ' . $protocol . '://' . $domain . '/login.php'); exit(); } // Include database connection for any database operations require_once 'db_connect.php'; // Verify user still exists in database $stmt = $conn->prepare("SELECT user_id FROM users WHERE user_id = ?"); $stmt->bind_param("i", $_SESSION['user_id']); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 0) { error_log("Dashboard - User not found in database. Clearing session and redirecting to login page."); session_unset(); session_destroy(); header('Location: login.html'); exit(); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Dashboard - Ojas Punj</title> <link rel="shortcut icon" href="/favicon_io/favicon.ico" type="image/x-icon"> <link rel="icon" type="image/png" href="/image/logo.png"> <!-- SEO Meta Tags --> <meta name="description" content="Your personal dashboard for Ojas Punj Ayurvedic products. Manage your account, view orders, and explore exclusive offers." /> <!-- Local Fonts --> <link rel="stylesheet" href="fonts/poppins/poppins.css"> <link rel="stylesheet" href="fontawesome/css/all.min.css"> <link rel="stylesheet" href="css/dark.css"> <script src="js/particles.min.js"></script> <script src="js/sweetalert2.js"></script> <script src="js/lottie.min.js"></script> <script src="js/typed.js"></script> <script src="js/canvas-confetti.min.js"></script> <style> :root { --primary-color: #2E7D32; --accent-color: #4CAF50; --bg-color: #f8f9fa; --card-bg: #ffffff; --text-color: #2c3e50; --header-height: 80px; --gradient-primary: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%); --gradient-secondary: linear-gradient(135deg, #43A047 0%, #66BB6A 100%); } * { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: 'Poppins', sans-serif; background-color: var(--bg-color); color: var(--text-color); height: 100%; scroll-behavior: smooth; overflow-x: hidden; background: linear-gradient(135deg, #f8f9fa 60%, #e0f2f1 100%); background-attachment: fixed; } body.dark-mode { background: linear-gradient(135deg, #181a1b 60%, #232526 100%) !important; color: #f1f1f1; } .dark-mode .feature-card, .dark-mode .testimonial-card, .dark-mode .gallery-item, .dark-mode .offer-card, .dark-mode .stat-card { background: #232526 !important; color: #f1f1f1 !important; box-shadow: 0 8px 32px 0 rgba(0,0,0,0.25); border: 1px solid #333; } .dark-mode .footer { background: #111; color: #f1f1f1; } .dark-mode nav ul li a, .dark-mode .footer-links a { color: #f1f1f1; } .dark-mode .footer-links a:hover { color: #43e97b; } .dark-mode .cart-icon { background: linear-gradient(90deg, #232526 0%, #414345 100%); color: #fff; } .dark-mode .wave-divider svg path { fill: #232526; } .dark-mode .offers-section { background: linear-gradient(135deg, #232526 60%, #414345 100%) !important; } .dark-mode .gallery-title, .dark-mode .testimonials-title, .dark-mode .offers-title, .dark-mode .contact-title, .dark-mode .stat-label, .dark-mode .feature-title, .dark-mode .feature-description, .dark-mode .testimonial-text, .dark-mode .offer-title, .dark-mode .offer-description, .dark-mode .contact-title, .dark-mode .gallery-title, .dark-mode .testimonials-title, .dark-mode .offers-title { color: #f1f1f1 !important; -webkit-text-fill-color: #f1f1f1 !important; } .dark-mode .hero-section { color: #f1f1f1; } .dark-mode .hero-cta, .dark-mode .buy-button, .dark-mode .submit-btn, .dark-mode .video-popup-btn { background: linear-gradient(90deg, #232526 0%, #414345 100%) !important; color: #fff; border: 1px solid #333; } .dark-mode .hero-cta:hover, .dark-mode .buy-button:hover, .dark-mode .submit-btn:hover, .dark-mode .video-popup-btn:hover { background: linear-gradient(90deg, #414345 0%, #232526 100%) !important; color: #43e97b; } .dark-mode .form-group input, .dark-mode .form-group textarea { background: #181a1b; color: #f1f1f1; border: 1.5px solid #333; } .dark-mode .form-group input:focus, .dark-mode .form-group textarea:focus { border-color: #43e97b; box-shadow: 0 0 0 2px #43e97b44; } .dark-mode .stat-number { color: #43e97b; } .dark-mode .whatsapp-fab { background: #232526; color: #43e97b; border: 1.5px solid #43e97b; } .dark-mode .whatsapp-fab:hover { background: #43e97b; color: #232526; } .dark-mode .video-popup-content { background: #181a1b; } .dark-mode .video-popup-close { color: #43e97b; } .dark-mode #backToTop { background: #232526; color: #43e97b; border: 1.5px solid #43e97b; } .dark-mode #backToTop:hover { background: #43e97b; color: #232526; } /* Dark mode toggle button */ .dark-toggle { position: fixed; bottom: 30px; right: 30px; z-index: 2000; background: #fff; color: #222; border: none; border-radius: 50%; width: 48px; height: 48px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; cursor: pointer; transition: background 0.3s, color 0.3s; } .dark-mode .dark-toggle { background: #232526; color: #fff; } /* Hero animated background */ #particles-js { position: absolute; width: 100%; height: 100%; left: 0; top: 0; z-index: 0; } .hero-section { position: relative; overflow: hidden; } .hero-content { position: relative; z-index: 1; } /* Intro */ #intro-sequence { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: var(--bg-color); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10000; transition: opacity 0.8s ease-out; } #intro-logo-animated { width: 150px; height: auto; margin-bottom: 20px; animation: pulse 2s infinite; } #intro-tagline { font-size: 2rem; font-weight: 700; color: var(--text-color); text-align: center; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } } /* Header */ #main-header { position: fixed; top: 0; left: 0; width: 100%; height: var(--header-height); background: rgba(255,255,255,0.85); backdrop-filter: blur(12px); display: flex; justify-content: space-between; align-items: center; padding: 0 40px; z-index: 1000; opacity: 0; transform: translateY(-100%); transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 8px 32px 0 rgba(31,38,135,0.07), 0 2px 8px rgba(0,0,0,0.07); border-bottom: 1px solid rgba(255,255,255,0.18); } .header-logo { width: 50px; height: auto; transition: transform 0.3s ease; } .header-logo img { width: 100%; height: auto; } .header-logo:hover { transform: scale(1.05); } .header-right { display: flex; align-items: center; gap: 20px; } .logout-btn { padding: 8px 20px; border-radius: 20px; text-decoration: none; font-weight: 500; transition: all 0.3s ease; background: #e74c3c; color: white; } .logout-btn:hover { background: #c0392b; transform: translateY(-2px); } nav ul { list-style: none; display: flex; gap: 30px; } nav ul li a { color: var(--text-color); font-weight: 500; text-decoration: none; font-size: 1rem; padding: 8px 16px; border-radius: 20px; } /* Add styles for register and login buttons */ .register-btn, .login-btn { padding: 8px 20px; border-radius: 20px; text-decoration: none; font-weight: 500; transition: all 0.3s ease; } .register-btn { background: var(--primary-color); color: white; margin-right: 10px; } .register-btn:hover { background: var(--accent-color); transform: translateY(-2px); } .login-btn { border: 2px solid var(--primary-color); color: var(--primary-color); } .login-btn:hover { background: var(--primary-color); color: white; transform: translateY(-2px); } .dark-mode .login-btn { border-color: #43e97b; color: #43e97b; } .dark-mode .login-btn:hover { background: #43e97b; color: #232526; } /* Menu Icon Styles */ .menu-icon { display: flex !important; flex-direction: column; cursor: pointer; gap: 6px; padding: 10px; border-radius: 8px; transition: background 0.3s ease; z-index: 1002; margin-left: 20px; } .menu-icon div { width: 28px; height: 3px; background: var(--text-color); border-radius: 3px; transition: all 0.3s ease; } .menu-icon:hover { background: rgba(0,0,0,0.05); } /* Sidebar Styles */ .sidebar { position: fixed; top: 0; left: -300px; width: 300px; height: 100%; background: white; padding: 30px; box-shadow: 4px 0 20px rgba(0,0,0,0.1); display: flex; flex-direction: column; gap: 25px; transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1001; } .sidebar.active { left: 0; } /* Sidebar Overlay */ .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; } .sidebar-overlay.active { display: block; } /* Dark mode styles for sidebar */ .dark-mode .sidebar { background: #232526; color: #f1f1f1; } .dark-mode .menu-icon div { background: #f1f1f1; } .dark-mode .menu-icon:hover { background: rgba(255,255,255,0.1); } /* Main */ .fullpage-container { padding-top: var(--header-height); visibility: hidden; } .page-section { min-height: calc(100vh - var(--header-height)); display: flex; align-items: center; justify-content: center; padding: 60px 30px; background-color: var(--bg-color); position: relative; overflow: hidden; } .fullscreen-image { max-width: 90vw; max-height: 75vh; border-radius: 24px; object-fit: cover; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12); transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); } .fullscreen-image:hover { transform: scale(1.03) translateY(-10px); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15); } .buy-button { padding: 20px 60px; background: var(--gradient-primary); color: #fff; position: fixed; bottom: 40px; right: 40px; z-index: 990; font-size: 1.2rem; font-weight: 600; border: none; border-radius: 50px; cursor: pointer; box-shadow: 0 10px 30px rgba(46, 125, 50, 0.3); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); display: flex; align-items: center; gap: 10px; } .buy-button i { font-size: 1.1rem; } .buy-button:hover { transform: translateY(-5px) scale(1.05); box-shadow: 0 15px 40px rgba(46, 125, 50, 0.4); } @media (max-width: 768px) { :root { --header-height: 70px; } #main-header { padding: 0 20px; } .fullscreen-image { max-height: 65vh; } nav ul { display: none; } } @media (max-width: 500px) { :root { --header-height: 65px; } .buy-button { font-size: 1rem; padding: 14px 35px; bottom: 20px; right: 20px; } } /* Hero Section */ .hero-section { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; padding: 0 20px; text-align: center; color: white; } .hero-video-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; } .hero-video { width: 100%; height: 100%; object-fit: cover; object-position: top; } @media (max-width: 768px) { .hero-video { object-position: center; } } .hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1; } .hero-content { position: relative; z-index: 2; max-width: 800px; animation: fadeInUp 1s ease-out; } .hero-title { font-size: 3.5rem; font-weight: 800; margin-bottom: 20px; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); } .hero-subtitle { font-size: 1.5rem; margin-bottom: 30px; opacity: 0.9; } .hero-cta { display: inline-flex; align-items: center; gap: 10px; padding: 15px 40px; font-size: 1.2rem; background: var(--gradient-primary); color: white; border: none; border-radius: 50px; cursor: pointer; transition: all 0.3s ease; text-decoration: none; font-weight: 600; } .hero-cta:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); } /* Features Section */ .features-section { padding: 100px 20px; background: white; } .features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; max-width: 1200px; margin: 0 auto; } .feature-card { background: var(--bg-color); padding: 30px; border-radius: 20px; text-align: center; transition: all 0.3s ease; box-shadow: 0 10px 30px rgba(0,0,0,0.05); } .feature-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0,0,0,0.1); } .feature-icon { font-size: 2.5rem; color: var(--primary-color); margin-bottom: 20px; } .feature-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 15px; color: var(--text-color); } .feature-description { color: #666; line-height: 1.6; } /* Animations */ @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } @keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-10px); } 100% { transform: translateY(0px); } } .floating { animation: float 3s ease-in-out infinite; } /* Responsive Design */ @media (max-width: 768px) { .hero-title { font-size: 1.2rem; } .hero-subtitle { font-size: 1.2rem; } .features-grid { grid-template-columns: 1fr; } } /* Product Gallery */ .gallery-section { padding: 100px 20px; background: var(--bg-color); } .gallery-title { text-align: center; font-weight: 700; margin-bottom: 50px; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; max-width: 1200px; margin: 0 auto; } .gallery-item { position: relative; border-radius: 20px; overflow: hidden; box-shadow: 0 15px 30px rgba(0,0,0,0.1); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); } .gallery-item img { width: 100%; height: 400px; object-fit: cover; transition: transform 0.4s ease; } .gallery-item:hover img { transform: scale(1.1); } .gallery-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); padding: 30px; color: white; transition: transform 0.4s ease; } .gallery-item:hover .gallery-overlay { transform: translateY(0); } /* Testimonials */ .testimonials-section { padding: 100px 20px; background: white; } .testimonials-title { text-align: center; font-weight: 700; margin-bottom: 50px; color: var(--text-color); } .testimonials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; max-width: 1200px; margin: 0 auto; } .testimonial-card { background: var(--bg-color); padding: 30px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); transition: all 0.3s ease; } .testimonial-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0,0,0,0.1); } .testimonial-text { font-size: 1.1rem; line-height: 1.6; color: #666; margin-bottom: 20px; } .testimonial-author { display: flex; align-items: center; gap: 15px; } .author-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; } .author-info h4 { font-weight: 600; color: var(--text-color); } .author-info p { color: #666; font-size: 0.9rem; } /* Enhanced Animations */ .fade-in { opacity: 0; transform: translateY(20px); transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1); } .fade-in.visible { opacity: 1; transform: translateY(0); } @media (max-width: 768px) { .gallery-grid, .testimonials-grid { grid-template-columns: 1fr; } .contact-container { padding: 30px; } } /* Product Details Section */ .product-details { padding: 100px 20px; background: white; } .product-container { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; } .product-image { position: relative; border-radius: 30px; overflow: hidden; box-shadow: 0 20px 40px rgba(0,0,0,0.1); } .product-image img { height: 500px; object-fit: cover; transition: transform 0.5s ease; } .product-image:hover img { transform: scale(1.05); } .product-info { padding: 30px; opacity: 1 !important; /* Ensure product info is always visible */ transform: none !important; /* Remove any transform that might hide it */ animation: none !important; /* Disable any animation that might hide it */ } .product-title { font-size: 2.5rem; font-weight: 700; margin-bottom: 20px; color: var(--text-color); } .product-description { font-size: 1.1rem; line-height: 1.8; color: #666; margin-bottom: 30px; } .product-price { font-size: 2rem; font-weight: 700; color: var(--primary-color); margin-bottom: 30px; } .product-features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 30px; } .feature-item { display: flex; align-items: center; gap: 10px; } .feature-item i { color: var(--primary-color); font-size: 1.2rem; } .submit-btn { display: flex; /* Ensure button is always displayed */ align-items: center; justify-content: center; gap: 10px; padding: 10px 20px; border: 1px solid var(--primary-color); border-radius: 8px; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; box-shadow: none; } .submit-btn:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(46, 125, 50, 0.2); background: var(--gradient-primary); color: white; } @media (max-width: 768px) { .product-actions { display: flex; /* Explicitly set display flex for robustness */ flex-direction: row; /* Changed from column to row */ flex-wrap: wrap; /* Allows buttons to wrap if needed, though they should fit side-by-side */ justify-content: space-between; /* Space out items evenly */ gap: 10px; /* Adds space between the buttons */ width: 100%; /* Ensure it takes full width */ } .view-details-btn { width: calc(50% - 5px); /* Explicitly set width for two buttons with half the gap */ box-sizing: border-box; /* Include padding and border in the element's total width and height */ flex-shrink: 0; /* Prevent shrinking */ margin-bottom: 0; /* Ensure no extra bottom margin for stacking */ margin-right: 0; /* Ensure no extra right margin */ } .product-actions .add-to-cart-form { display: flex; /* Make form a flex item */ width: calc(50% - 5px); /* Explicitly set width for two buttons with half the gap */ box-sizing: border-box; /* Include padding and border in the element's total width and height */ flex-shrink: 0; /* Prevent shrinking */ margin-bottom: 0; /* Ensure no extra bottom margin */ } .product-actions .add-to-cart-form .submit-btn { width: 100%; /* Make button fill its parent form */ height: 100%; /* Make button fill its parent form height as well */ } .product-info { opacity: 1 !important; /* Ensure details are always visible on mobile */ transform: none !important; /* Reset any transform on mobile */ animation: none !important; /* Disable animation that hides it */ } } /* Shopping Cart */ .cart-icon { position: relative; background: var(--gradient-primary); color: white; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 5px 15px rgba(46, 125, 50, 0.3); transition: all 0.3s ease; margin-left: 20px; } .cart-icon:hover { transform: scale(1.1); } .cart-count { position: absolute; top: -5px; right: -5px; background: #ff4757; color: white; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 600; } .cart-sidebar { position: fixed; top: 0; right: -400px; width: 400px; height: 100vh; background: white; box-shadow: -2px 0 5px rgba(0,0,0,0.1); transition: right 0.3s ease; z-index: 1000; overflow-y: auto; padding: 20px; } .cart-sidebar.active { right: 0; } .cart-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid #eee; } .close-cart { background: none; border: none; font-size: 20px; cursor: pointer; color: #666; } .overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; display: none; } .cart-items { padding: 20px; } .cart-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid #eee; } .item-details h3 { margin: 0; font-size: 16px; } .item-details p { margin: 5px 0; color: #666; } .item-actions { display: flex; align-items: center; gap: 10px; } .quantity-btn { background: #2E7D32; color: white; border: none; width: 30px; height: 30px; border-radius: 5px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; } .quantity-btn:hover { background: #1B5E20; } .quantity-input { width: 50px; text-align: center; border: 1px solid #ddd; border-radius: 5px; padding: 5px; } .remove-btn { background: #dc3545; color: white; border: none; width: 30px; height: 30px; border-radius: 5px; cursor: pointer; display: flex; align-items: center; justify-content: center; } .remove-btn:hover { background: #c82333; } .cart-total { margin-top: 20px; padding: 15px; background: #f8f9fa; border-radius: 5px; font-weight: bold; text-align: right; } .cart-item-image { width: 50px; /* Adjust size as needed */ height: 50px; /* Adjust size as needed */ object-fit: cover; /* Ensures the image covers the area without stretching */ border-radius: 8px; /* Optional: adds rounded corners */ margin-right: 15px; /* Space between image and details */ } @media (max-width: 768px) { .cart-sidebar { width: 100%; right: -100%; } } /* Special Offers */ .offers-section { padding: 100px 20px; background: var(--gradient-primary); color: white; } .offers-container { max-width: 1200px; margin: 0 auto; text-align: center; } .offers-title { font-size: 2.5rem; font-weight: 700; margin-bottom: 50px; } .offers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; } .offer-card { background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); padding: 30px; border-radius: 20px; transition: all 0.3s ease; } .offer-card:hover { transform: translateY(-10px); background: rgba(255, 255, 255, 0.2); } .offer-icon { font-size: 3rem; margin-bottom: 20px; } .offer-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 15px; } .offer-description { font-size: 1.1rem; opacity: 0.9; } /* Enhanced Animations */ .scale-in { animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1); } @keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } } .slide-in { animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1); } @keyframes slideIn { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } } @media (max-width: 768px) { .product-container { grid-template-columns: 1fr; } .cart-sidebar { width: 100%; right: -100%; } .offers-grid { grid-template-columns: 1fr; } } /* Animated Counters Section */ .stats-section { padding: 80px 20px 60px 20px; background: transparent; text-align: center; } .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 40px; max-width: 900px; margin: 0 auto; } .stat-card { background: #fff; border-radius: 18px; box-shadow: 0 4px 24px rgba(31,38,135,0.07); padding: 30px 10px; transition: transform 0.3s; } .stat-card:hover { transform: translateY(-8px) scale(1.04); } .stat-number { font-size: 2.5rem; font-weight: 800; color: #43e97b; margin-bottom: 10px; transition: color 0.3s; } .stat-label { font-size: 1.1rem; color: #333; } .whatsapp-fab { position: fixed; bottom: 100px; right: 30px; background: #25d366; color: #fff; width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; box-shadow: 0 4px 16px rgba(37,211,102,0.2); z-index: 2000; transition: background 0.3s, transform 0.3s; animation: fabPop 1s; } .whatsapp-fab:hover { background: #128c7e; transform: scale(1.1) rotate(-10deg); } @keyframes fabPop { 0% { transform: scale(0); } 80% { transform: scale(1.1); } 100% { transform: scale(1); } } .video-popup-btn { position: fixed; bottom: 170px; right: 30px; z-index: 2000; background: #fff; color: #43e97b; border: none; border-radius: 50px; padding: 12px 24px; font-size: 1.1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.12); cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background 0.3s, color 0.3s; } .video-popup-btn:hover { background: #43e97b; color: #fff; } .video-popup { display: none; position: fixed; left: 0; top: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 4000; align-items: center; justify-content: center; } .video-popup.active { display: flex; } .video-popup-content { background: #000; border-radius: 18px; padding: 20px; position: relative; } .video-popup-close { position: absolute; top: 10px; right: 18px; font-size: 2rem; color: #fff; cursor: pointer; } /* Micro-interactions */ .footer-social a { transition: transform 0.2s; } .footer-social a:hover { transform: scale(1.2) rotate(-8deg); } /* Progress Bar */ #progress-bar { position: fixed; top: 0; left: 0; width: 0%; height: 4px; background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%); z-index: 3000; transition: width 0.2s; } /* Back to Top Button */ #backToTop { position: fixed; right: 30px; bottom: 90px; width: 48px; height: 48px; background: #43e97b; color: #fff; border: none; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.15); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; cursor: pointer; opacity: 0; pointer-events: none; z-index: 2000; transition: opacity 0.3s, background 0.3s; } #backToTop.show { opacity: 1; pointer-events: auto; } #backToTop:hover { background: #38f9d7; color: #222; } /* Typing effect in hero */ .typed-cursor { font-size: 2.5rem; color: #43e97b; animation: blink 0.7s infinite; } @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } } .floating-btn-group { position: fixed; right: 30px; bottom: 30px; z-index: 2100; display: flex; flex-direction: column; align-items: flex-end; gap: 16px; } .floating-btn-group > * { margin: 0; } .whatsapp-fab { position: static !important; margin-bottom: 0 !important; right: auto; bottom: auto; } #backToTop { position: static !important; margin-bottom: 0 !important; right: auto; bottom: auto; } .dark-toggle { position: static !important; margin-bottom: 0 !important; right: auto; bottom: auto; } .buy-button { position: static !important; margin-bottom: 0 !important; right: auto; bottom: auto; width: auto; min-width: 160px; justify-content: center; } @media (max-width: 600px) { .floating-btn-group { right: 10px; bottom: 10px; gap: 10px; } .buy-button { min-width: 120px; font-size: 1rem; } } /* Profile Section Styles */ .profile-section { padding: 20px; text-align: center; border-bottom: 1px solid rgba(0,0,0,0.1); margin-bottom: 20px; } .profile-image { width: 100px; height: 100px; margin: 0 auto 15px; border-radius: 50%; overflow: hidden; border: 3px solid var(--primary-color); } .profile-image img { width: 100%; height: 100%; object-fit: cover; } .profile-info h3 { font-size: 1.2rem; margin-bottom: 5px; color: var(--text-color); } .profile-info p { font-size: 0.9rem; color: #666; } .sidebar-menu { display: flex; flex-direction: column; gap: 10px; } .sidebar-menu a { padding: 12px 20px; color: var(--text-color); text-decoration: none; display: flex; align-items: center; gap: 10px; transition: all 0.3s ease; border-radius: 8px; } .sidebar-menu a:hover { background: var(--gradient-primary); color: white; } .sidebar-menu a.active { background: var(--gradient-primary); color: white; } .logout-link { margin-top: 20px; color: #e74c3c !important; } .logout-link:hover { background: #e74c3c !important; color: white !important; } /* Dark mode styles for profile section */ .dark-mode .profile-section { border-bottom-color: rgba(255,255,255,0.1); } .dark-mode .profile-info h3 { color: #f1f1f1; } .dark-mode .profile-info p { color: #aaa; } /* Update header styles */ .desktop-nav { display: none; } @media (min-width: 769px) { .desktop-nav { display: block; } } /* Profile Content Styles */ .content-section { padding: 100px 20px 40px; min-height: 100vh; background: var(--bg-color); } .profile-container { max-width: 800px; margin: 0 auto; background: white; border-radius: 20px; padding: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); } .profile-container h2 { font-size: 2rem; color: var(--text-color); margin-bottom: 30px; text-align: center; } .profile-header { display: flex; align-items: center; gap: 30px; margin-bottom: 40px; padding-bottom: 20px; border-bottom: 1px solid #eee; } .profile-image-large { width: 150px; height: 150px; border-radius: 50%; overflow: hidden; border: 4px solid var(--primary-color); } .profile-image-large img { width: 100%; height: 100%; object-fit: cover; } .profile-info-large h2 { font-size: 1.8rem; margin-bottom: 10px; text-align: left; } .profile-info-large p { color: #666; font-size: 1.1rem; } .profile-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 30px; } .field-group { background: #f8f9fa; padding: 15px; border-radius: 10px; } .field-group label { display: block; color: #666; font-size: 0.9rem; margin-bottom: 5px; } .field-group p { color: var(--text-color); font-size: 1.1rem; font-weight: 500; } .edit-profile-btn { background: var(--gradient-primary); color: white; border: none; padding: 12px 30px; border-radius: 25px; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; gap: 10px; margin: 0 auto; transition: all 0.3s ease; } .edit-profile-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(46, 125, 50, 0.3); } /* Dark mode styles */ .dark-mode .profile-container { background: #232526; } .dark-mode .field-group { background: #181a1b; } .dark-mode .field-group label { color: #aaa; } .dark-mode .field-group p { color: #f1f1f1; } .dark-mode .profile-header { border-bottom-color: #333; } /* Modal Styles */ .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); z-index: 2000; overflow-y: auto; } .modal-content { background-color: #fff; margin: 50px auto; padding: 30px; border-radius: 15px; width: 95%; /* Make it wider */ max-width: 800px; /* Increase max-width */ height: 90%; /* Make it taller */ max-height: 90vh; /* Cap max height relative to viewport */ position: relative; animation: modalSlideIn 0.3s ease-out; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); display: flex; /* Use flexbox for better layout control */ flex-direction: column; } .dark-mode .modal-content { background-color: #232526; color: #f1f1f1; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); } .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid #eee; flex-shrink: 0; /* Prevent header from shrinking */ } .dark-mode .modal-header { border-bottom-color: #333; } .modal-header h2 { font-size: 1.8rem; font-weight: 700; color: var(--text-color); } .dark-mode .modal-header h2 { color: #f1f1f1; } .close-modal { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; position: absolute; top: 10px; right: 15px; z-index: 1001; /* Ensure it's above the iframe and modal content */ background: #fefefe; border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.2); } .close-modal:hover { color: black; } @keyframes modalSlideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } .modal-body { flex-grow: 1; /* Allow body to take up remaining space */ overflow-y: auto; /* Keep scrolling for iframe content if needed */ padding: 0; /* Remove padding here */ } /* Add styles for the iframe */ .modal-body iframe { width: 100%; height: 100%; border: none; } /* Profile Section Styles based on Image */ /* Keep existing profile styles for the layout inside the iframe (from profile.php) */ /* Ensure styles here don't conflict heavily */ /* Responsive adjustments */ @media (max-width: 600px) { .modal-content { margin: 20px auto; padding: 15px; width: 98%; /* Slightly wider on small screens */ height: 95%; /* Taller on small screens */ max-height: 95vh; } .modal-header h2 { font-size: 1.5rem; } .close-modal { font-size: 24px; } /* Existing responsive styles for profile-container inside iframe will handle internal layout */ } /* Product Showcase Image Styles */ .product-showcase-image { padding: 40px 20px; background: var(--bg-color); text-align: center; } .product-showcase { width: 100%; max-width: 800px; /* Adjust max-width as needed */ height: auto; display: block; margin: 0 auto; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); transition: transform 0.3s ease; } .product-showcase:hover { transform: scale(1.02); } @media (max-width: 768px) { .product-showcase-image { padding: 20px 15px; } .product-showcase { border-radius: 15px; } } @media (max-width: 768px) { .hero-title { font-size: 1.2rem; } .hero-subtitle { font-size: 1.2rem; } .features-grid { grid-template-columns: 1fr; } .gallery-grid { grid-template-columns: 1fr; } .testimonials-grid { grid-template-columns: 1fr; gap: 15px; padding: 0 15px; } .product-container { grid-template-columns: repeat(2, 1fr); /* Ensure two columns */ gap: 4px; /* Even further reduce gap between products */ padding: 0 2px; /* Reduce padding for tighter fit */ } .offers-grid { grid-template-columns: 1fr; } .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; padding: 0 15px; } .feature-card, .gallery-item, .testimonial-card, .offer-card, .stat-card { margin-bottom: 15px; } .product-image { width: 100%; /* Ensure image takes full width of card */ max-width: 80%; /* Make image container significantly narrower */ margin: 0 auto; /* Center the narrower image container */ max-height: 120px; /* Increased height for 2 products per row, making it taller */ overflow: hidden; /* Ensure image overflow is hidden */ border-radius: 6px; /* Keep border-radius consistent */ display: flex; /* Use flexbox to center image within its container */ align-items: center; justify-content: center; } .product-image img { width: 100%; height: 100%; object-fit: contain; /* Use contain to ensure full image is visible without cropping */ } .product-card { padding: 1px; /* Minimal card padding for tightest fit */ display: flex; /* Ensure flex container */ flex-direction: column; /* Stack image and info vertically */ height: auto; /* Allow height to adjust */ box-sizing: border-box; /* Crucial for consistent sizing */ } .product-info { padding: 1px; /* Minimal padding */ opacity: 1 !important; /* Ensure details are always visible */ transform: none !important; /* Reset any transform */ animation: none !important; /* Disable animation that hides it */ text-align: center; /* Center align text for better appearance */ } .product-title { font-size: 0.75rem; /* Even smaller title */ margin-bottom: 2px; white-space: normal; /* Allow title to wrap */ overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; /* Limit to 2 lines */ -webkit-box-orient: vertical; min-height: 2.2em; /* Ensure consistent height for 2 lines */ } .product-description { display: none; /* Hide description on very small screens to save space */ } .product-price { font-size: 0.85rem; /* Even smaller price */ margin-bottom: 5px; font-weight: 700; } .product-price span { font-size: 1.2rem; /* Smaller for discounted price */ } .product-features { grid-template-columns: 1fr; /* Stack features */ gap: 5px; } .floating-btn-group { right: 15px; bottom: 15px; gap: 10px; } .buy-button { padding: 10px 20px; font-size: 0.9rem; } .whatsapp-fab { width: 45px; height: 45px; font-size: 1.5rem; } .dark-toggle { width: 40px; height: 40px; font-size: 1.2rem; } #backToTop { width: 40px; height: 40px; font-size: 1.2rem; } .cart-sidebar { width: 100%; right: -100%; } .cart-sidebar.active { right: 0; } .submit-btn { width: 100%; /* Ensure full width */ padding: 6px 8px; /* Very small padding for buttons */ font-size: 0.75rem; /* Smallest font size for buttons */ border-radius: 5px; /* Smaller border radius */ white-space: nowrap; /* Prevent word breaks within button text */ justify-content: center; /* Center content horizontally */ display: flex; align-items: center; gap: 5px; /* Small gap between icon and text */ } .submit-btn i { font-size: 0.75rem; /* Adjust icon size to match text */ } /* Product actions (buttons container) */ .product-actions { display: flex; flex-direction: column; /* Stack buttons vertically */ gap: 5px; /* Small gap between buttons */ width: 100%; /* Take full width of parent */ margin-top: 5px; /* Small margin from price */ } /* Specific styles for product detail button */ .product-detail-btn { background: #6c757d; /* A different color for detail button */ color: white; border: none; } .product-detail-btn:hover { background: #5a6268; color: white; transform: none; /* No transform on hover to keep it simple */ box-shadow: none; /* No shadow on hover */ } /* Specific styles for add to cart button */ .add-to-cart-btn { background: var(--gradient-primary); /* Primary color for add to cart */ color: white; border: none; } .add-to-cart-btn:hover { background: var(--gradient-secondary); color: white; transform: none; /* No transform on hover to keep it simple */ box-shadow: none; /* No shadow on hover */ } } @media (max-width: 480px) { .hero-title { font-size: 1.2rem; } .stats-grid { grid-template-columns: 1fr; } .product-features { grid-template-columns: 1fr; } .floating-btn-group { right: 10px; bottom: 10px; } .buy-button { padding: 8px 16px; font-size: 0.8rem; } .feature-card, .gallery-item, .testimonial-card, .offer-card, .stat-card { margin-bottom: 10px; } .product-image { max-height: 100px; /* Even smaller on very small screens, but taller than previous attempts */ } .product-title { font-size: 0.65rem; /* Even smaller title */ min-height: 1.5em; /* Adjusted height for 2 lines */ } .product-price { font-size: 0.75rem; /* Even smaller price */ } .product-price span { font-size: 1.4rem; /* Smaller for discounted price */ } .submit-btn { padding: 1px 2px; /* Even smaller padding for buttons */ font-size: 0.55rem; /* Even smaller font size for buttons */ } .submit-btn i { font-size: 0.55rem; /* Even smaller icon size */ } .product-actions { gap: 1px; /* Minimal gap between buttons */ margin-top: 1px; /* Reduce margin from price */ } } /* Premium Product Image Styles with Animation */ </style> <style> @import url('fonts/poppins/poppins.css'); @import url('fontawesome/css/all.min.css'); /* Variables */ :root { --primary-color: #2E7D32; --accent-color: #4CAF50; --text-color: #2c3e50; --bg-color: #f8f9fa; --card-bg: #ffffff; --gradient-primary: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%); } /* General Body Styles */ html, body { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; line-height: 1.8; color: white; /* Ensure text is white for dark background */ background-color: #2c3e50; /* Dark background as seen in image */ } /* Container for consistent content width */ .container { margin: 0 auto; padding: 0 20px; } /* Footer-like section styling for this page */ .contact-info-section { background-color: #2c3e50; /* Darker background for modern feel */ color: white; padding: 50px 0 30px; font-size: 1rem; border-top: 5px solid var(--primary-color); } .footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 40px; margin-bottom: 40px; text-align: center; } .footer-section { padding: 15px; } .footer-section h3 { color: var(--accent-color); /* Lighter green accent for headings */ margin-bottom: 20px; font-size: 1.4rem; position: relative; padding-bottom: 10px; } .footer-section h3::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 50px; height: 3px; background-color: var(--accent-color); border-radius: 5px; } .footer-section p, .footer-section ul { margin: 0; padding: 0; list-style: none; } .footer-section p { margin-bottom: 10px; line-height: 1.6; } .footer-section ul li { margin-bottom: 12px; } .footer-section a { color: #e0e0e0; text-decoration: none; transition: color 0.3s ease; } .footer-section a:hover { color: var(--accent-color); } .footer-section .social-links { margin-top: 15px; } .footer-section .social-links a { color: white; font-size: 1.8rem; margin: 0 10px; transition: color 0.3s ease, transform 0.3s ease; } .footer-section .social-links a:hover { color: var(--accent-color); transform: translateY(-3px); } .footer-bottom { text-align: center; padding-top: 25px; border-top: 1px solid #444; color: #aaa; font-size: 0.9rem; } /* Responsive Styles */ @media (max-width: 768px) { .footer-content { grid-template-columns: 1fr; } } /* Footer container override for index page only */ .main-footer .container { max-width: none; border: 2px solid var(--primary-color); border-radius: 10px; margin: 20px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); background-color: #2c3e50; } .main-footer { background-color: #2c3e50; color: white; padding: 30px 0; font-size: 1rem; border-top: 5px solid var(--primary-color); } </style> </head> <body> <!-- Intro Animation --> <div id="intro-sequence"> <img src="image/logo.png" alt="Ojas Punj Logo" id="intro-logo-animated"> <p id="intro-tagline">Dignify Your Health & Wellness</p> </div> <!-- Header --> <header id="main-header"> <a href="index.html" class="header-logo"> <img src="image/logo.png" alt="Ojas Punj Logo"> </a> <div class="header-right"> <nav class="desktop-nav"> <ul> <li><a href="about.php">About Us</a></li> <li><a href="contact.php">Contact</a></li> </ul> </nav> <div class="cart-icon" id="cartIcon" onclick="toggleCart()"> <i class="fas fa-shopping-cart"></i> <?php require_once 'db_connect.php'; $total_cart_quantity = 0; if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; $stmt = $conn->prepare("SELECT SUM(quantity) as total_qty FROM cart WHERE user_id = ?"); $stmt->bind_param("i", $user_id); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); $total_cart_quantity = $row['total_qty'] ?? 0; $stmt->close(); } ?> <span class="cart-count"><?php echo $total_cart_quantity; ?></span> </div> <div class="menu-icon" id="menuToggle"> <div></div> <div></div> <div></div> </div> </div> </header> <!-- Sidebar Menu --> <div class="sidebar-overlay" id="sidebarOverlay"></div> <div class="sidebar" id="sidebarMenu"> <div class="close-btn" id="closeSidebar"><i class="fas fa-times"></i></div> <!-- Profile Section --> <div class="profile-section"> <div class="profile-image"> <img src="image/default-avatar.png" alt="Profile Picture" id="userProfilePic"> </div> <div class="profile-info"> <h3 id="userName">User Name</h3> <p id="userEmail">user@email.com</p> </div> </div> <div class="sidebar-menu"> <a href="#dashboard" class="active"><i class="fas fa-home"></i> Dashboard</a> <a href="profile.php"><i class="fas fa-user"></i> My Profile</a> <a href="#orders"><i class="fas fa-shopping-bag"></i> My Orders</a> <a href="#bmi-calculator"><i class="fas fa-heart"></i> BMI Calculator</a> <a href="about.php" onclick="window.location.href='about.php'"><i class="fas fa-info-circle"></i> About Us</a> <a href="contact.php" onclick="window.location.href='contact.php'"><i class="fas fa-envelope"></i> Contact</a> <a href="logout.php" class="logout-link"><i class="fas fa-sign-out-alt"></i> Logout</a> </div> </div> <!-- Profile Content Section --> <div id="profile-content" class="content-section" style="display: none;"> <div class="profile-container"> <h2>My Profile</h2> <div class="profile-details"> <div class="profile-header"> <div class="profile-image-large"> <img src="image/default-avatar.png" alt="Profile Picture" id="userProfilePicLarge"> </div> <div class="profile-info-large"> <h2 id="userNameLarge">User Name</h2> <p id="userEmailLarge">user@email.com</p> </div> </div> <div class="profile-fields"> <div class="field-group"> <label>Full Name</label> <p id="userFullName">-</p> </div> <div class="field-group"> <label>Email</label> <p id="userEmailDetail">-</p> </div> <div class="field-group"> <label>Phone</label> <p id="userPhone">-</p> </div> <div class="field-group"> <label>Address</label> <p id="userAddress">-</p> </div> <div class="field-group"> <label>City</label> <p id="userCity">-</p> </div> <div class="field-group"> <label>State</label> <p id="userState">-</p> </div> <div class="field-group"> <label>Pincode</label> <p id="userPincode">-</p> </div> </div> <button class="edit-profile-btn"> <i class="fas fa-edit"></i> Edit Profile </button> </div> </div> </div> <!-- Hero Section --> <section class="hero-section"> <div class="hero-video-container"> <video class="hero-video" autoplay muted loop playsinline> <source src="image/ojaspunj.mp4" type="video/mp4"> </video> </div> <div class="hero-overlay"></div> <div id="particles-js"></div> <div class="hero-content"> <h1 class="hero-title"><span id="typed"></span></h1> <p class="hero-subtitle">Discover the power of natural wellness with our premium products</p> <a href="#" class="hero-cta"> <i class="fas fa-shopping-bag"></i> Explore Products </a> </div> </section> <!-- Features Section --> <section class="features-section"> <div class="features-grid"> <div class="feature-card"> <i class="fas fa-leaf feature-icon"></i> <h3 class="feature-title">100% Natural</h3> <p class="feature-description">Made with pure, natural ingredients for your well-being</p> </div> <div class="feature-card"> <i class="fas fa-certificate feature-icon"></i> <h3 class="feature-title">Premium Quality</h3> <p class="feature-description">Highest quality standards in every product we offer</p> </div> <div class="feature-card"> <i class="fas fa-heart feature-icon"></i> <h3 class="feature-title">Health First</h3> <p class="feature-description">Designed to enhance your health and vitality</p> </div> </div> </section> <!-- Main Sections --> <div class="floating-btn-group"> <button id="backToTop" title="Back to Top"><i class="fas fa-arrow-up"></i></button> <button class="buy-button"> <i class="fas fa-shopping-cart"></i> Buy Now </button> </div> <!-- Product Showcase Image --> <!-- Special Offers Section - Same design as specialoffer.php --> <style> :root { --primary: #2E7D32; --primary-dark: #1B5E20; --accent: #10B981; --ring: rgba(46, 125, 50, 0.25); --muted: #6b7280; --gold: #f59e0b; --purple: #8b5cf6; --pink: #ec4899; --orange: #f97316; --blue: #3b82f6; --red: #ef4444; --green: #22c55e; } .special-offers-container { max-width: 1400px; margin: 0 auto; padding: 20px 16px 60px; } .special-offers-title { text-align: center; margin: 28px 0 36px; } .special-offers-title h2 { margin: 0; font-weight: 900; font-size: clamp(28px, 5vw, 40px); color: #111827; letter-spacing: .5px; } .special-offers-title h2 i { color: var(--primary); } .special-offers-subtitle { color: #6b7280; font-size: 14px; margin-top: 8px; font-weight: 500; } .special-offers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); gap: 50px; align-items: start; } .special-offer-card { position: relative; background: #ffffff; border-radius: 16px; padding: 20px; box-shadow: 0 8px 24px rgba(0,0,0,0.08); border: 1px solid #e5e7eb; transition: transform .2s ease, box-shadow .2s ease; } .special-offer-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(0,0,0,0.1); } .special-offer-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #34d399, #60a5fa, #f59e0b, #ef4444); background-size: 300% 100%; animation: barShift 8s linear infinite; border-radius: 16px 16px 0 0; } @keyframes barShift { 0% { background-position: 0% 0; } 100% { background-position: 300% 0; } } .special-offer-badge { position: absolute; top: 12px; left: 12px; background: #ef4444; color: #fff; font-weight: 800; font-size: 12px; padding: 6px 12px; border-radius: 999px; box-shadow: 0 6px 14px rgba(239,68,68,.18); animation: badgePulse 2.8s ease-in-out infinite; } .special-offer-bogo-badge { position: absolute; top: 12px; right: 12px; background: #f59e0b; color: #fff; font-weight: 800; font-size: 12px; padding: 6px 12px; border-radius: 999px; box-shadow: 0 6px 14px rgba(245,158,11,.18); animation: badgePulse 2.8s ease-in-out infinite; } @keyframes badgePulse { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } } .special-offer-media { display: flex; align-items: center; justify-content: center; margin: 30px 0; position: relative; } .special-offer-media::after { content: ''; position: fixed; top: 0; left: -150%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent); transform: skewX(-15deg); animation: shine 7s linear infinite; pointer-events: none; } @keyframes shine { 0% { left: -150%; } 100% { left: 150%; } } .special-offer-img { display: block; width: auto; max-width: 100%; height: auto; max-height: clamp(320px, 60vh, 640px); object-fit: contain; object-position: center; margin: 0 auto; filter: drop-shadow(0 12px 24px rgba(0,0,0,.12)); transition: transform .2s ease; } .special-offer-img:hover { transform: scale(1.02); } .special-offer-content { padding: 0; display: flex; flex-direction: column; gap: 25px; } .special-offer-name { font-size: 20px; font-weight: 800; color: #111827; margin: 0; text-align: center; } .special-offer-desc { color: #475569; font-size: 17px; margin: 0; min-height: 50px; text-align: center; line-height: 1.7; font-weight: 600; } .special-offer-price { display: flex; gap: 25px; align-items: baseline; flex-wrap: wrap; justify-content: center; } .special-offer-price-new { color: #047857; font-weight: 900; font-size: 24px; } .special-offer-price-old { color: #ef4444; text-decoration: line-through; font-size: 14px; opacity: 0.8; } .special-offer-chip { border: 1px solid #e5e7eb; border-radius: 999px; padding: 6px 12px; font-size: 12px; color: #374151; background: #fff; } .special-offer-chip.blue { border-color: #dbeafe; background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #1d4ed8; } .special-offer-chip.gold { border-color: #fbbf24; background: #fef3c7; color: #92400e; animation: softPulse 3.6s ease-in-out infinite; } .special-offer-chip.deal { border-color: #fed7aa; background: #fff7ed; color: #b45309; animation: wiggle 4.5s ease-in-out infinite; } @keyframes softPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(251,191,36,0.0); } 50% { box-shadow: 0 0 0 10px rgba(251,191,36,0.12); } } @keyframes wiggle { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-1.5deg); } } .special-offer-actions { display: flex; gap: 12px; margin-top: 14px; justify-content: center; } .special-offer-btn { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: 0; padding: 12px 18px; border-radius: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 10px 22px var(--ring); display: flex; align-items: center; gap: 8px; font-size: 15px; text-decoration: none; transition: all 0.3s ease; } .special-offer-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 28px var(--ring); } .special-offer-btn.secondary { background: #6b7280; box-shadow: none; } .special-offer-btn.secondary:hover { background: #4b5563; } @media (max-width: 640px) { .special-offers-grid { grid-template-columns: 1fr; gap: 35px; } .special-offer-img { max-height: none; width: 100%; } .special-offer-card { padding: 30px; } .special-offer-actions { flex-direction: column; } .special-offer-btn { justify-content: center; } .special-offers-title h2 { font-size: clamp(28px, 9vw, 48px); } } </style> <section class="special-offers-container"> <div id="notification-container" style="position: fixed; top: 20px; right: 20px; z-index: 10000;"></div> <div class="special-offers-title fade-in"> <h2> <i class="fas fa-star" style="color: #ffd700;"></i> Special Offers <i class="fas fa-star" style="color: #ffd700;"></i> </h2> <p class="special-offers-subtitle">Amazing deals on premium products - Limited time offer!</p> </div> <div class="special-offers-grid"> <?php require_once 'db_connect.php'; $offer_result = $conn->query("SELECT * FROM offer_products ORDER BY created_at DESC"); $offer_image_folder = 'OFFER PRODUCT/'; if ($offer_result && $offer_result->num_rows > 0) { while($offer_row = $offer_result->fetch_assoc()) { $discount_percentage = $offer_row['discount_percentage'] ?? 0; $original_price = $offer_row['price'] ?? 0; $discounted_price = $original_price * (1 - $discount_percentage / 100); $savings = $original_price - $discounted_price; $has_bogo = !empty($offer_row['bogo_enabled']) && ((int)($offer_row['bogo_buy_qty'] ?? 0) > 0); ?> <div class="special-offer-card"> <?php if ($discount_percentage > 0): ?> <div class="special-offer-badge"><?php echo $discount_percentage; ?>% OFF</div> <?php endif; ?> <?php if ($has_bogo): ?> <div class="special-offer-bogo-badge">Festival Offer Buy 1 Get 1 Free</div> <?php endif; ?> <div class="special-offer-media"> <img class="special-offer-img" src="<?php echo $offer_image_folder . htmlspecialchars($offer_row['image']); ?>" alt="<?php echo htmlspecialchars($offer_row['name']); ?>"> </div> <div class="special-offer-content"> <h3 class="special-offer-name"><?php echo htmlspecialchars($offer_row['name']); ?></h3> <p class="special-offer-desc"><?php echo htmlspecialchars($offer_row['description']); ?></p> <div class="special-offer-price"> <?php if ($discount_percentage > 0): ?> <div class="special-offer-price-old">₹<?php echo number_format($original_price, 2); ?></div> <div class="special-offer-price-new">₹<?php echo number_format($discounted_price, 2); ?></div> <div class="special-offer-chip gold">Save ₹<?php echo number_format($savings, 2); ?></div> <?php else: ?> <div class="special-offer-price-new">₹<?php echo number_format($original_price, 2); ?></div> <?php endif; ?> <?php if ($has_bogo): ?> <div class="special-offer-chip deal">Buy <?php echo $offer_row['bogo_buy_qty'] ?? 1; ?> Get <?php echo $offer_row['bogo_get_qty'] ?? 1; ?> Free</div> <?php endif; ?> </div> <div class="special-offer-actions"> <button type="button" class="special-offer-btn secondary" onclick="showOfferProductDetails(<?php echo $offer_row['id']; ?>)"> <i class="fas fa-info-circle"></i> Details </button> <form method="POST" action="api/add_to_cart.php" style="margin: 0;" onsubmit="return handleAddToCart(event)"> <input type="hidden" name="product_id" value="<?php echo $offer_row['id']; ?>"> <input type="hidden" name="table_name" value="offer_products"> <button type="submit" class="special-offer-btn"> <i class="fas fa-shopping-cart"></i> Add to Cart </button> </form> </div> </div> </div> <?php } } else { // Show message if no special offers available ?> <div style="text-align: center; padding: 40px; grid-column: 1/-1;"> <i class="fas fa-gift" style="font-size: 3rem; color: #ccc; margin-bottom: 20px;"></i> <h3 style="color: #666;">No Special Offers Available</h3> <p style="color: #999;">Check back soon for amazing deals!</p> </div> <?php } ?> </div> </section> <!-- Product Details --> <section class="product-details"> <h2 class="gallery-title fade-in" style="text-align: center; margin-bottom: 80px;">Premium Products</h2> <div class="product-container"> <?php require_once 'db_connect.php'; $result = $conn->query("SELECT * FROM products"); $image_folder = 'upload product/'; while($row = $result->fetch_assoc()) { ?> <div class="product-card"> <div class="product-image scale-in"> <img src="<?php echo $image_folder . htmlspecialchars($row['image']); ?>" alt="<?php echo htmlspecialchars($row['name']); ?>"> </div> <div class="product-info"> <h2 class="product-title"><?php echo htmlspecialchars($row['name']); ?></h2> <p class="product-description"><?php echo htmlspecialchars($row['description']); ?></p> <?php $discounted_price = $row['price'] * (1 - $row['discount_percentage'] / 100); if ($row['discount_percentage'] > 0): ?> <div style="color: #2196f3; font-weight: bold; margin-bottom: 5px;"> <?php echo $row['discount_percentage']; ?>% OFF </div> <div class="product-price"> <span style="text-decoration: line-through; color: #f44336; font-size: 1.5rem;">₹<?php echo number_format($row['price'], 2); ?></span> <span style="color: #2E7D32; margin-left: 10px;">₹<?php echo number_format($discounted_price, 2); ?></span> </div> <?php else: ?> <div class="product-price" style="color: #2E7D32;">₹<?php echo number_format($row['price'], 2); ?></div> <?php endif; ?> <div class="product-actions"> <button type="button" class="submit-btn product-detail-btn" onclick="showProductDetails(<?php echo $row['id']; ?>)"> <i class="fas fa-info-circle"></i> Product Detail </button> <form method="POST" action="api/add_to_cart.php" onsubmit="return handleAddToCart(event)"> <input type="hidden" name="product_id" value="<?php echo $row['id']; ?>"> <input type="hidden" name="table_name" value="products"> <button type="submit" class="submit-btn add-to-cart-btn"> <i class="fas fa-shopping-cart"></i> Add to Cart </button> </form> </div> </div> </div> <?php } ?> </div> </section> <!-- Product Gallery --> <section class="gallery-section"> <h2 class="gallery-title fade-in">Our Products</h2> <?php include 'our_product.php'; ?> </section> <!-- Testimonials --> <section class="testimonials-section"> <h2 class="testimonials-title fade-in">What Our Customers Say</h2> <script src="https://cdn.commoninja.com/sdk/latest/commonninja.js" defer></script> <div class="commonninja_component pid-fbaf3f40-2c24-4e42-a57c-1f9b7a88d063"></div> </section> <!-- Special Offers --> <section class="offers-section"> <div class="offers-container"> <h2 class="offers-title">Special Offers</h2> <div class="offers-grid"> <div class="offer-card"> <i class="fas fa-gift offer-icon"></i> <h3 class="offer-title">First Purchase</h3> <p class="offer-description">Get 20% off on your first purchase</p> </div> <div class="offer-card"> <i class="fas fa-tags offer-icon"></i> <h3 class="offer-title">Bundle Deal</h3> <p class="offer-description">Buy 2 get 1 free on selected products</p> </div> <div class="offer-card"> <i class="fas fa-truck offer-icon"></i> <h3 class="offer-title">Free Shipping</h3> <p class="offer-description">Free shipping on orders above ₹2000</p> </div> </div> </div> </section> <!-- Animated Counters Section --> <section class="stats-section fade-in"> <div class="stats-grid"> <div class="stat-card"> <div class="stat-number" data-count="10000">0</div> <div class="stat-label">Happy Customers</div> </div> <div class="stat-card"> <div class="stat-number" data-count="100">0</div> <div class="stat-label">% Natural</div> </div> </div> </section> <div style="background: #fff; padding: 40px 0 30px 0; border-radius: 18px; margin: 0 auto; width: 100%; max-width: 100vw;"> <?php include 'our_certificate.php'; ?> </div> <!-- Partner Section --> <?php include 'x.php'; ?> <footer class="main-footer"> <div class="container"> <div class="footer-content"> <div class="footer-section"> <h3>Contact Us</h3> <p><i class="fab fa-whatsapp"></i> +91-7999554703 (Message/call 10:00AM-06:00PM)</p> <p><i class="fas fa-envelope"></i> support@ojaspunj.com</p> <p><i class="fas fa-envelope"></i> ojaspunjindia@gmail.com</p> </div> <div class="footer-section"> <h3>Technical Support</h3> <p><i class="fab fa-whatsapp"></i> +91-6264248799 (message 10:00AM-06:00PM)</p> </div> <div class="footer-section"> <h3>Quick Links</h3> <ul> <li><a href="https://www.ojaspunj.com">www.ojaspunj.com</a></li> </ul> </div> <div class="footer-section"> <h3>Follow Us</h3> <div class="social-links"> <a href="https://www.facebook.com/profile.php?id=61577533104821" target="_blank"><i class="fab fa-facebook"></i></a> <a href="https://www.instagram.com/ojaspunjindia?utm_source=ig_web_button_share_sheet&igsh=ZDNlZDc0MzIxNw==" target="_blank"><i class="fab fa-instagram"></i></a> <a href="#"><i class="fab fa-twitter"></i></a> </div> </div> </div> <div class="footer-bottom"> <p>© <?php echo date('Y'); ?> Ojas Punj. All rights reserved.</p> </div> </div> </footer> <!-- Floating WhatsApp FAB --> <a href="https://wa.me/919999999999" class="whatsapp-fab" target="_blank" title="Chat on WhatsApp"><i class="fab fa-whatsapp"></i></a> <button class="dark-toggle" id="darkToggle" title="Toggle dark mode"><i class="fas fa-moon"></i></button> <div id="progress-bar"></div> <button id="backToTop" title="Back to Top"><i class="fas fa-arrow-up"></i></button> <!-- Profile Modal --> <div id="profileModal" class="modal"> <div class="modal-content"> <div class="modal-header"> <h2>My Profile</h2> <span class="close-modal">×</span> </div> <div class="modal-body"> <div class="profile-container"> <div class="profile-header"> <div class="profile-image-large"> <img src="image/default-avatar.png" alt="Profile Picture" id="userProfilePicLarge"> </div> <div class="profile-info-large"> <h2 id="userNameLarge">User Name</h2> <p id="userEmailLarge">user@email.com</p> </div> </div> <div class="profile-fields"> <div class="field-group"> <label>Full Name</label> <p id="userFullName">-</p> </div> <div class="field-group"> <label>Email</label> <p id="userEmailDetail">-</p> </div> <div class="field-group"> <label>Phone</label> <p id="userPhone">-</p> </div> <div class="field-group"> <label>Address</label> <p id="userAddress">-</p> </div> <div class="field-group"> <label>City</label> <p id="userCity">-</p> </div> <div class="field-group"> <label>State</label> <p id="userState">-</p> </div> <div class="field-group"> <label>Pincode</label> <p id="userPincode">-</p> </div> </div> <button class="edit-profile-btn"> <i class="fas fa-edit"></i> Edit Profile </button> </div> </div> </div> </div> <!-- Orders Modal --> <div id="ordersModal" class="modal"> <div class="modal-content"> <div class="modal-header"> <h2>My Orders</h2> <span class="close-modal" onclick="closeOrdersModal()">×</span> </div> <div class="modal-body"> <iframe id="ordersFrame" style="width: 100%; height: 100%; border: none;"></iframe> </div> </div> </div> <!-- BMI Calculator Modal (NEW) --> <div id="bmiModal" class="modal"> <div class="modal-content"> <div class="modal-header"> <h2>BMI Calculator</h2> <span class="close-modal" onclick="closeBMIModal()">×</span> </div> <div class="modal-body"> <iframe id="bmiFrame" style="width: 100%; height: 100%; border: none;"></iframe> </div> </div> </div> <!-- Buy Modal --> <div id="buyModal" class="modal"> <div class="modal-content"> <div class="modal-header"> <h2>Buy Products</h2> <span class="close-modal" onclick="closeBuyModal()">×</span> </div> <div class="modal-body"> <iframe id="buyFrame" style="width: 100%; height: 100%; border: none;"></iframe> </div> </div> </div> <!-- Product Detail Modal (NEW) --> <div id="productDetailModal" class="modal"> <div class="modal-content"> <div class="modal-header"> <h2 id="productDetailModalTitle">Product Details</h2> <span class="close-modal" onclick="closeProductDetailModal()">×</span> </div> <div class="modal-body"> <iframe id="productDetailFrame" style="width: 100%; height: 100%; border: none;"></iframe> </div> </div> </div> <!-- Cart Sidebar --> <div id="cartSidebar" class="cart-sidebar"> <div class="cart-header"> <h3 class="cart-title">Your Cart</h3> <span class="close-cart" onclick="toggleCart()"><i class="fas fa-times"></i></span> </div> <div id="cartContent" class="cart-items"> <!-- Cart items will be loaded here --> </div> </div> <!-- Overlay --> <div id="overlay" class="overlay"></div> </div> <!-- Back to Top Button --> <button id="backToTop" title="Back to Top"><i class="fas fa-arrow-up"></i></button> <!-- WhatsApp FAB --> <script> const intro = document.getElementById('intro-sequence'); const header = document.getElementById('main-header'); const container = document.querySelector('.fullpage-container'); const menuToggle = document.getElementById('menuToggle'); const sidebar = document.getElementById('sidebarMenu'); const overlay = document.getElementById('sidebarOverlay'); const closeSidebar = document.getElementById('closeSidebar'); window.addEventListener('load', () => { setTimeout(() => { intro.style.opacity = '0'; setTimeout(() => { intro.style.display = 'none'; header.style.opacity = '1'; header.style.transform = 'translateY(0)'; container.style.visibility = 'visible'; }, 800); }, 1500); }); menuToggle.addEventListener('click', () => { sidebar.style.left = '0'; overlay.style.display = 'block'; }); closeSidebar.addEventListener('click', () => { sidebar.style.left = '-300px'; overlay.style.display = 'none'; }); overlay.addEventListener('click', (e) => { if (!sidebar.contains(e.target)) { sidebar.style.left = '-300px'; overlay.style.display = 'none'; } }); // Fade in animation on scroll const fadeElements = document.querySelectorAll('.fade-in'); const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('visible'); } }); }, { threshold: 0.1 }); fadeElements.forEach(element => { observer.observe(element); }); // Dark mode toggle const darkToggle = document.getElementById('darkToggle'); darkToggle.addEventListener('click', () => { document.body.classList.toggle('dark-mode'); if(document.body.classList.contains('dark-mode')) { darkToggle.innerHTML = '<i class="fas fa-sun"></i>'; } else { darkToggle.innerHTML = '<i class="fas fa-moon"></i>'; } }); // Particles.js init particlesJS('particles-js', { particles: { number: { value: 60 }, color: { value: '#43e97b' }, shape: { type: 'circle' }, opacity: { value: 0.3 }, size: { value: 4 }, line_linked: { enable: true, distance: 120, color: '#43e97b', opacity: 0.2, width: 1 }, move: { enable: true, speed: 2 } }, interactivity: { detect_on: 'canvas', events: { onhover: { enable: true, mode: 'repulse' } }, modes: { repulse: { distance: 80 } } }, retina_detect: true }); // Animated Counters function animateCounters() { document.querySelectorAll('.stat-number').forEach(el => { let count = 0; const target = +el.getAttribute('data-count'); const step = Math.ceil(target / 100); const update = () => { count += step; if(count > target) count = target; el.textContent = count.toLocaleString(); if(count < target) requestAnimationFrame(update); }; update(); }); } let statsVisible = false; window.addEventListener('scroll', () => { const stats = document.querySelector('.stats-section'); if(stats && !statsVisible && window.scrollY + window.innerHeight > stats.offsetTop + 100) { animateCounters(); statsVisible = true; } }); // WhatsApp FAB confetti const whatsappFab = document.querySelector('.whatsapp-fab'); if(whatsappFab) whatsappFab.addEventListener('click', e => { setTimeout(()=>{ if(window.confetti) window.confetti({ particleCount: 60, spread: 70, origin: { y: 0.7 } }); }, 500); }); // Scroll Progress Bar window.addEventListener('scroll', () => { const scrollTop = window.scrollY; const docHeight = document.body.scrollHeight - window.innerHeight; const progress = (scrollTop / docHeight) * 100; document.getElementById('progress-bar').style.width = progress + '%'; // Back to top button if(scrollTop > 300) { document.getElementById('backToTop').classList.add('show'); } else { document.getElementById('backToTop').classList.remove('show'); } }); document.getElementById('backToTop').onclick = () => { window.scrollTo({ top: 0, behavior: 'smooth' }); }; // Typed.js for hero new Typed('#typed', { strings: ['Welcome to Ojas Punj', 'Natural. Trusted. Effective.', 'Dignify Your Health and Wellness'], typeSpeed: 60, backSpeed: 30, backDelay: 1500, loop: true }); // Add this to your existing JavaScript document.addEventListener('DOMContentLoaded', function() { // Fetch user data from check_session.php fetch('check_session.php') .then(response => { // Log the response status and headers for debugging console.log('check_session.php response status:', response.status); response.headers.forEach((value, name) => { console.log(`${name}: ${value}`); }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(userData => { console.log('check_session.php response data:', userData); // Log the received data // Check if the user is logged in according to the response if (userData && userData.logged_in) { // Update profile information in the sidebar document.getElementById('userName').textContent = userData.name || 'User'; document.getElementById('userEmail').textContent = userData.email || 'No email'; if (userData.picture) { document.getElementById('userProfilePic').src = userData.picture; // Use the picture URL from response } else { document.getElementById('userProfilePic').src = 'image/default-avatar.png'; // Default avatar if not set or null } console.log('Sidebar user info updated.'); // Update profile page information (if the elements exist and are not in an iframe) // Note: If your profile page is in an iframe, this code won't directly update it. const userNameLarge = document.getElementById('userNameLarge'); const userEmailLarge = document.getElementById('userEmailLarge'); const userProfilePicLarge = document.getElementById('userProfilePicLarge'); const userFullName = document.getElementById('userFullName'); const userEmailDetail = document.getElementById('userEmailDetail'); if (userNameLarge) userNameLarge.textContent = userData.name || 'User'; if (userEmailLarge) userEmailLarge.textContent = userData.email || 'No email'; if (userProfilePicLarge) { userProfilePicLarge.src = userData.picture || 'image/default-avatar.png'; } if (userFullName) userFullName.textContent = userData.name || 'User'; if (userEmailDetail) userEmailDetail.textContent = userData.email || 'No email'; // These fields are not part of check_session.php by default // You'd need to add them to the session and check_session.php if you want to display them // document.getElementById('userPhone').textContent = userData.phone || 'Not set'; // document.getElementById('userAddress').textContent = userData.address || 'Not set'; // ... and so on for other fields } else { console.log('check_session.php returned not logged in or invalid data.'); // If check_session.php indicates not logged in, redirect to login page // window.location.href = 'login.html'; // Uncomment if you want to strictly enforce redirect } }) .catch(error => { console.error('Error fetching or processing session data:', error); // Log any errors // In case of error, you might want to redirect or show a message // window.location.href = 'login.html'; // Uncomment if you want to redirect on error }); // Handle sidebar menu active state const menuLinks = document.querySelectorAll('.sidebar-menu a'); menuLinks.forEach(link => { link.addEventListener('click', function(e) { // Don't prevent default for logout link if (!this.classList.contains('logout-link')) { e.preventDefault(); const target = this.getAttribute('href'); // Remove active class from all links menuLinks.forEach(l => l.classList.remove('active')); // Add active class to clicked link this.classList.add('active'); // Show/hide content based on clicked link if (target === 'profile.php') { profileModal.style.display = 'block'; document.body.style.overflow = 'hidden'; // Prevent background scrolling } else if (target.startsWith('#')) { profileModal.style.display = 'none'; } } }); }); }); // Update sidebar functionality function toggleSidebar() { sidebar.classList.toggle('active'); overlay.classList.toggle('active'); } menuToggle.addEventListener('click', toggleSidebar); closeSidebar.addEventListener('click', toggleSidebar); overlay.addEventListener('click', toggleSidebar); // Cart sidebar open/close functionality const cartIcon = document.getElementById('cartIcon'); const cartSidebar = document.querySelector('.cart-sidebar'); const closeCart = document.querySelector('.close-cart'); cartIcon.addEventListener('click', () => { cartSidebar.classList.add('active'); loadCartContent(); // Load content when opening }); closeCart.addEventListener('click', () => { cartSidebar.classList.remove('active'); // overlay.style.display = 'none'; // overlay handled by toggleCart }); // Handle Add to Cart with AJAX and notifications function handleAddToCart(event) { event.preventDefault(); const form = event.target; const formData = new FormData(form); const submitButton = form.querySelector('button[type="submit"]'); const originalButtonText = submitButton.innerHTML; // Show loading state submitButton.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Adding...'; submitButton.disabled = true; fetch('api/add_to_cart.php', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { // Reset button state submitButton.innerHTML = originalButtonText; submitButton.disabled = false; if (data.success) { // Show success notification showNotification('success', data.message || 'Product added to cart successfully!'); // Update cart count if (data.total_cart_quantity !== undefined) { const cartCount = document.querySelector('.cart-count'); if (cartCount) { cartCount.textContent = data.total_cart_quantity; } } // Trigger confetti animation if (window.confetti) { const rect = submitButton.getBoundingClientRect(); const origin = { x: (rect.left + rect.width/2) / window.innerWidth, y: (rect.top + rect.height/2) / window.innerHeight }; confetti({ particleCount: 60, spread: 60, origin: origin, scalar: 0.8, ticks: 120, colors: ['#34d399','#60a5fa','#f59e0b','#ef4444'] }); } // Reload cart content if sidebar is open if (document.getElementById('cartSidebar').classList.contains('active')) { loadCartContent(); } } else { // Show error notification showNotification('error', data.message || 'Failed to add product to cart'); } }) .catch(error => { // Reset button state submitButton.innerHTML = originalButtonText; submitButton.disabled = false; // Show error notification showNotification('error', 'Network error. Please try again.'); console.error('Error adding to cart:', error); }); return false; // Prevent form submission } // Show notification popup function showNotification(type, message) { const container = document.getElementById('notification-container'); if (!container) return; const notification = document.createElement('div'); notification.className = `notification notification-${type}`; notification.style.cssText = ` background: ${type === 'success' ? '#10b981' : '#ef4444'}; color: white; padding: 16px 24px; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); margin-bottom: 10px; transform: translateX(100%); transition: transform 0.3s ease; max-width: 300px; font-weight: 500; display: flex; align-items: center; gap: 12px; `; notification.innerHTML = ` <i class="fas fa-${type === 'success' ? 'check-circle' : 'exclamation-circle'}"></i> <span>${message}</span> `; container.appendChild(notification); // Animate in setTimeout(() => { notification.style.transform = 'translateX(0)'; }, 100); // Remove after 4 seconds setTimeout(() => { notification.style.transform = 'translateX(100%)'; setTimeout(() => { if (notification.parentNode) { notification.parentNode.removeChild(notification); } }, 300); }, 4000); } // Cart functionality (combined toggle and load) function toggleCart() { const sidebar = document.getElementById('cartSidebar'); const overlay = document.getElementById('overlay'); if (sidebar.classList.contains('active')) { sidebar.classList.remove('active'); overlay.style.display = 'none'; } else { sidebar.classList.add('active'); overlay.style.display = 'block'; loadCartContent(); // Load content when opening } } // Load cart content function loadCartContent() { fetch('api/cart.php') .then(response => response.json()) .then(data => { if (data.success) { const cartContent = document.getElementById('cartContent'); if (data.cart_items.length === 0) { cartContent.innerHTML = '<div style="padding: 20px; text-align: center;">Cart is empty.</div>'; } else { let html = ''; data.cart_items.forEach(item => { // Determine the correct image path based on the table_name let imagePath = 'upload product/'; if (item.table_name === 'our_products') { imagePath = 'our product/'; } else if (item.table_name === 'offer_products') { imagePath = 'OFFER PRODUCT/'; } html += ` <div class="cart-item" data-id="${item.id}"> <img src="${imagePath}${item.image}" alt="${item.name}" class="cart-item-image"> <div class="item-details"> <h3>${item.name}</h3> <p>₹${item.price} x ${item.quantity} = <span class="item-total" data-id="${item.id}">₹${item.item_total}</span></p> </div> <div class="item-actions"> <button class="quantity-btn minus" data-id="${item.id}" data-table="${item.table_name}">-</button> <input type="number" class="quantity-input" value="${item.quantity}" data-id="${item.id}" data-table="${item.table_name}" readonly> <button class="quantity-btn plus" data-id="${item.id}" data-table="${item.table_name}">+</button> <button class="remove-btn" data-id="${item.id}" data-table="${item.table_name}"><i class="fas fa-trash"></i></button> </div> </div> `; }); // Add the price breakdown html += ` <div class="cart-summary" style="padding: 20px; border-top: 1px solid #eee;"> <div style="display: flex; justify-content: space-between; margin-bottom: 5px;"> <span>Subtotal (Original Price):</span> <span>₹${data.total_original_price}</span> </div> ${data.total_discount_amount > 0 ? ` <div style="display: flex; justify-content: space-between; margin-bottom: 5px; color: #f44336;"> <span>Total Discount:</span> <span>- ₹${data.total_discount_amount}</span> </div> ` : ''} <div class="cart-total" style="display: flex; justify-content: space-between; font-size: 1.2em; font-weight: bold; margin-top: 10px;"> <span>Total:</span> <span>₹${data.total_price}</span> </div> </div> `; cartContent.innerHTML = html; attachCartEventListeners(); } // Update cart count badge on initial load const cartCount = document.querySelector('.cart-count'); if (cartCount && data.total_cart_quantity !== undefined) { cartCount.textContent = data.total_cart_quantity; } } else { console.error('Failed to load cart content:', data.message); const cartContent = document.getElementById('cartContent'); cartContent.innerHTML = '<div style="padding: 20px; text-align: center;">Error loading cart.</div>'; } }) .catch(error => { console.error('Error fetching cart content:', error); const cartContent = document.getElementById('cartContent'); cartContent.innerHTML = '<div style="padding: 20px; text-align: center;">Error loading cart.</div>'; }); } // Add event listeners for cart buttons (delegation might be better but this works for now) function attachCartEventListeners() { // Quantity buttons document.querySelectorAll('.quantity-btn').forEach(btn => { btn.removeEventListener('click', handleQuantityClick); // Prevent double listeners btn.addEventListener('click', handleQuantityClick); }); // Remove buttons document.querySelectorAll('.remove-btn').forEach(btn => { btn.removeEventListener('click', handleRemoveClick); // Prevent double listeners btn.addEventListener('click', handleRemoveClick); }); } // Quantity button click handler function handleQuantityClick() { const input = this.parentElement.querySelector('.quantity-input'); const currentValue = parseInt(input.value); const newValue = this.classList.contains('plus') ? currentValue + 1 : currentValue - 1; if (newValue >= 1) { updateQuantity(input.dataset.id, newValue, input.dataset.table); } } // Remove button click handler function handleRemoveClick() { const itemId = this.dataset.id; const tableName = this.dataset.table; removeItem(itemId, tableName); } // Update quantity function function updateQuantity(itemId, quantity, tableName) { const formData = new FormData(); formData.append('action', 'update_quantity'); formData.append('product_id', itemId); formData.append('quantity', quantity); formData.append('table_name', tableName); fetch('api/cart.php', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { // Update the quantity input const input = document.querySelector(`.quantity-input[data-id="${itemId}"]`); if (input) { input.value = quantity; } // Update the item total const itemTotal = document.querySelector(`.item-total[data-id="${itemId}"]`); if (itemTotal) { itemTotal.textContent = `₹${data.item_total}`; } // Update the cart total const cartTotal = document.querySelector('.cart-total'); if (cartTotal) { cartTotal.textContent = `Total: ₹${data.cart_total}`; } // Update cart count in header - Use total_cart_quantity const cartCount = document.querySelector('.cart-count'); if (cartCount && data.total_cart_quantity !== undefined) { cartCount.textContent = data.total_cart_quantity; } } else { console.error('Failed to update quantity:', data.message); } }) .catch(error => { console.error('Error updating quantity:', error); }); } // Remove item function function removeItem(itemId, tableName) { Swal.fire({ title: 'Remove Item', text: 'Are you sure you want to remove this item from your cart?', icon: 'warning', showCancelButton: true, confirmButtonColor: '#dc3545', cancelButtonColor: '#6c757d', confirmButtonText: 'Yes, remove it!' }).then((result) => { if (result.isConfirmed) { const formData = new FormData(); formData.append('action', 'remove_item'); formData.append('product_id', itemId); formData.append('table_name', tableName); fetch('api/cart.php', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { // Remove the item from DOM const item = document.querySelector(`.cart-item[data-id="${itemId}"]`); if (item) { item.remove(); } // Update the cart total const cartTotal = document.querySelector('.cart-total'); if (cartTotal) { cartTotal.textContent = `Total: ₹${data.cart_total}`; } // Update cart count in header - Use total_cart_quantity const cartCount = document.querySelector('.cart-count'); if (cartCount && data.total_cart_quantity !== undefined) { cartCount.textContent = data.total_cart_quantity; } // Show success message Swal.fire('Removed!', 'Item has been removed from your cart.', 'success'); // If cart is empty, show empty message if (data.total_cart_quantity === 0) { // Use total_cart_quantity here const cartContent = document.getElementById('cartContent'); cartContent.innerHTML = '<div style="padding: 20px; text-align: center;">Cart is empty.</div>'; } } else { console.error('Failed to remove item:', data.message); } }) .catch(error => { console.error('Error removing item:', error); }); } else { // If user cancels, hide the SweetAlert dialog Swal.close(); } }); } // Add overlay div if not exists if (!document.getElementById('overlay')) { const overlay = document.createElement('div'); overlay.id = 'overlay'; overlay.style.display = 'none'; document.body.appendChild(overlay); // Close cart when clicking overlay overlay.addEventListener('click', toggleCart); } // Add cart styles (Keep existing styles) const cartStyles = ` .cart-sidebar { position: fixed; top: 0; right: -400px; width: 400px; height: 100vh; background: white; box-shadow: -2px 0 5px rgba(0,0,0,0.1); transition: right 0.3s ease; z-index: 1000; overflow-y: auto; padding: 20px; } .cart-sidebar.active { right: 0; } .cart-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid #eee; } .close-cart { background: none; border: none; font-size: 20px; cursor: pointer; color: #666; } #overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; display: none; } .cart-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid #eee; } .item-details h3 { margin: 0; font-size: 16px; } .item-details p { margin: 5px 0; color: #666; } .item-actions { display: flex; align-items: center; gap: 10px; } .quantity-btn { background: #2E7D32; color: white; border: none; width: 30px; height: 30px; border-radius: 5px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; } .quantity-btn:hover { background: #1B5E20; } .quantity-input { width: 50px; text-align: center; border: 1px solid #ddd; border-radius: 5px; padding: 5px; } .remove-btn { background: #dc3545; color: white; border: none; width: 30px; height: 30px; border-radius: 5px; cursor: pointer; display: flex; align-items: center; justify-content: center; } .remove-btn:hover { background: #c82333; } .cart-total { margin-top: 20px; padding: 15px; background: #f8f9fa; border-radius: 5px; font-weight: bold; text-align: right; } .cart-item-image { width: 50px; /* Adjust size as needed */ height: 50px; /* Adjust size as needed */ object-fit: cover; /* Ensures the image covers the area without stretching */ border-radius: 8px; /* Optional: adds rounded corners */ margin-right: 15px; /* Space between image and details */ } @media (max-width: 768px) { .cart-sidebar { width: 100%; right: -100%; } } `; // Add styles to head if not already added if (!document.querySelector('style').textContent.includes('.cart-sidebar')) { const styleElement = document.createElement('style'); styleElement.textContent = cartStyles; document.head.appendChild(styleElement); } // Initial cart content load when the page is ready (optional, can be done on cart icon click) // document.addEventListener('DOMContentLoaded', function() { // loadCartContent(); // }); // Add this to your existing JavaScript const profileModal = document.getElementById('profileModal'); const closeModal = document.querySelector('.close-modal'); const modalBody = profileModal.querySelector('.modal-body'); // Function to load profile data (No longer needed for iframe approach, but keeping for reference or other uses) /* function loadProfileData() { fetch('profile.php') .then(response => response.json()) .then(data => { if (data.success) { const user = data.user; // Update profile information in the modal document.getElementById('userNameLarge').textContent = user.name || 'User'; document.getElementById('userEmailLarge').textContent = user.email || 'No email'; document.getElementById('userFullName').textContent = user.name || '-'; document.getElementById('userEmailDetail').textContent = user.email || '-'; document.getElementById('userPhone').textContent = user.mobile || '-'; document.getElementById('userAddress').textContent = user.address || '-'; document.getElementById('userCity').textContent = user.city || '-'; document.getElementById('userState').textContent = user.state || '-'; document.getElementById('userPincode').textContent = user.pincode || '-'; // Update profile picture if (user.profile_photo) { document.getElementById('userProfilePicLarge').src = user.profile_photo; } } }) .catch(error => { console.error('Error loading profile data:', error); }); } */ // Handle sidebar menu active state and profile modal display const menuLinks = document.querySelectorAll('.sidebar-menu a'); menuLinks.forEach(link => { link.addEventListener('click', function(e) { // Don't prevent default for logout link or other external links const targetUrl = this.getAttribute('href'); if (targetUrl !== 'logout.php' && !targetUrl.startsWith('#')) { // Check if it's profile.php or another external page e.preventDefault(); // Prevent default navigation } // Remove active class from all links menuLinks.forEach(l => l.classList.remove('active')); // Add active class to clicked link (if it's not logout/external) if (targetUrl !== 'logout.php' && !targetUrl.startsWith('#')) { this.classList.add('active'); } // Handle navigation or modal display if (targetUrl === 'profile.php') { // Load profile.php into an iframe in the modal modalBody.innerHTML = '<iframe src="profile.php" style="width: 100%; height: 100%; border: none;"></iframe>'; profileModal.style.display = 'block'; document.body.style.overflow = 'hidden'; // Prevent background scrolling toggleSidebar(); // Close sidebar } else if (targetUrl.startsWith('#')) { // Handle section scrolling within the dashboard (existing functionality) profileModal.style.display = 'none'; document.body.style.overflow = 'auto'; // Re-enable background scrolling toggleSidebar(); // Close sidebar // Add smooth scroll logic here if needed, or rely on default # behavior document.querySelector(targetUrl).scrollIntoView({ behavior: 'smooth' }); } else if (targetUrl === 'logout.php') { // Let the default link behavior happen for logout toggleSidebar(); // Close sidebar before navigating } // For other external links, default behavior will happen }); }); // Close modal when clicking the close button closeModal.addEventListener('click', () => { profileModal.style.display = 'none'; document.body.style.overflow = 'auto'; // Re-enable background scrolling }); // Close modal when clicking outside window.addEventListener('click', (e) => { if (e.target === profileModal) { profileModal.style.display = 'none'; document.body.style.overflow = 'auto'; } }); // Close modal with Escape key document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && profileModal.style.display === 'block') { profileModal.style.display = 'none'; document.body.style.overflow = 'auto'; } }); // Add these new functions for orders modal function openOrdersModal() { const ordersModal = document.getElementById('ordersModal'); const ordersFrame = document.getElementById('ordersFrame'); ordersFrame.src = 'my_orders.php'; ordersModal.style.display = 'block'; document.body.style.overflow = 'hidden'; } function closeOrdersModal() { const ordersModal = document.getElementById('ordersModal'); ordersModal.style.display = 'none'; document.body.style.overflow = 'auto'; } // Update the sidebar menu click handler document.querySelectorAll('.sidebar-menu a').forEach(link => { link.addEventListener('click', function(e) { const targetUrl = this.getAttribute('href'); console.log(`Sidebar link clicked: ${targetUrl}`); // Debug log // Don't prevent default for logout link if (targetUrl === 'logout.php') { return; // Let default link behavior happen } e.preventDefault(); // Prevent default behavior for all other sidebar links initially // Remove active class from all links document.querySelectorAll('.sidebar-menu a').forEach(l => l.classList.remove('active')); // Add active class to clicked link (unless it's logout) this.classList.add('active'); // Add active class here // Handle different links if (targetUrl === 'profile.php') { openProfileModal(); } else if (targetUrl === '#orders') { openOrdersModal(); } else if (targetUrl === '#bmi-calculator') { openBMICalculatorModal(); } else if (targetUrl === '#settings') { // Handle settings modal or section scroll if exists // openSettingsModal(); // Uncomment if you have a settings modal function const settingsElement = document.querySelector(targetUrl); if (settingsElement) { settingsElement.scrollIntoView({ behavior: 'smooth' }); console.log(`Scrolling to settings section: ${targetUrl}`); } else { console.warn(`Settings element ${targetUrl} not found.`); // Optionally, handle if settings section/modal is not implemented } } else if (targetUrl.startsWith('#')) { // Handle other internal section links (if any, e.g., #about, #contact) const targetElement = document.querySelector(targetUrl); if (targetElement !== null && targetElement !== undefined) { targetElement.scrollIntoView({ behavior: 'smooth' }); console.log(`Scrolling to internal section: ${targetUrl}`); } else { console.warn(`Internal section element ${targetUrl} not found. Cannot scroll.`); } } // Note: Links like profile.php, #orders, #bmi-calculator, #settings are handled above. // If there are other '#' links meant for scrolling to sections, they fall into the last else if. // Close sidebar after clicking (for links that don't navigate away) if (targetUrl !== 'logout.php') { toggleSidebar(); } }); }); // Close orders modal when clicking outside window.addEventListener('click', (e) => { const ordersModal = document.getElementById('ordersModal'); if (e.target === ordersModal) { closeOrdersModal(); } }); // Close orders modal with Escape key document.addEventListener('keydown', (e) => { if (e.key === 'Escape') { const ordersModal = document.getElementById('ordersModal'); if (ordersModal.style.display === 'block') { closeOrdersModal(); } } }); // Add these new functions for buy modal function openBuyModal() { const buyModal = document.getElementById('buyModal'); const buyFrame = document.getElementById('buyFrame'); buyFrame.src = 'buy.php'; buyModal.style.display = 'block'; document.body.style.overflow = 'hidden'; } function closeBuyModal() { const buyModal = document.getElementById('buyModal'); buyModal.style.display = 'none'; document.body.style.overflow = 'auto'; } // Update the Buy Now button click handler document.querySelectorAll('.buy-button').forEach(button => { button.addEventListener('click', function(e) { e.preventDefault(); openBuyModal(); }); }); // Close buy modal when clicking outside window.addEventListener('click', (e) => { const buyModal = document.getElementById('buyModal'); if (e.target === buyModal) { closeBuyModal(); } }); // Close buy modal with Escape key document.addEventListener('keydown', (e) => { if (e.key === 'Escape') { const buyModal = document.getElementById('buyModal'); if (buyModal.style.display === 'block') { closeBuyModal(); } } }); // Add this function for profile modal function openProfileModal() { const profileModal = document.getElementById('profileModal'); const profileFrame = document.createElement('iframe'); profileFrame.src = 'profile.php'; profileFrame.style.width = '100%'; profileFrame.style.height = '100%'; profileFrame.style.border = 'none'; const modalBody = profileModal.querySelector('.modal-body'); modalBody.innerHTML = ''; modalBody.appendChild(profileFrame); profileModal.style.display = 'block'; document.body.style.overflow = 'hidden'; } // Add this function for BMI Calculator modal function openBMICalculatorModal() { const bmiModal = document.getElementById('bmiModal'); const bmiFrame = document.getElementById('bmiFrame'); bmiFrame.src = 'bmi.html'; bmiModal.style.display = 'block'; document.body.style.overflow = 'hidden'; } function closeBMIModal() { const bmiModal = document.getElementById('bmiModal'); bmiModal.style.display = 'none'; document.body.style.overflow = 'auto'; } // Update the sidebar menu click handler document.querySelectorAll('.sidebar-menu a').forEach(link => { link.addEventListener('click', function(e) { const targetUrl = this.getAttribute('href'); // Don't prevent default for logout link and external pages if (targetUrl === 'logout.php' || targetUrl === 'about.php' || targetUrl === 'contact.php') { return; } e.preventDefault(); // Remove active class from all links document.querySelectorAll('.sidebar-menu a').forEach(l => l.classList.remove('active')); // Add active class to clicked link this.classList.add('active'); // Handle different menu items if (targetUrl === 'profile.php') { openProfileModal(); } else if (targetUrl === '#orders') { openOrdersModal(); } else if (targetUrl === '#bmi-calculator') { openBMICalculatorModal(); } else if (targetUrl.startsWith('#')) { // Handle other section navigation document.querySelector(targetUrl).scrollIntoView({ behavior: 'smooth' }); } // Close sidebar after clicking toggleSidebar(); }); }); document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const element = document.querySelector(this.getAttribute('href')); if (element) { // Check if element exists before scrolling element.scrollIntoView({ behavior: 'smooth' }); } }); }); // REMOVE ALL DUPLICATE SIDEBAR CLICK HANDLERS ABOVE THIS POINT // SINGLE CLEAN SIDEBAR CLICK HANDLER BELOW: (function() { // Remove all previous event listeners by cloning the sidebar menu var sidebarMenu = document.querySelector('.sidebar-menu'); if (sidebarMenu) { var newSidebarMenu = sidebarMenu.cloneNode(true); sidebarMenu.parentNode.replaceChild(newSidebarMenu, sidebarMenu); } // Add a single clean handler for all sidebar links document.querySelectorAll('.sidebar-menu a').forEach(link => { link.addEventListener('click', function(e) { const targetUrl = this.getAttribute('href'); // Allow direct navigation for these links if (targetUrl === 'logout.php' || targetUrl === 'about.php' || targetUrl === 'contact.php') { return true; // Let the default link behavior happen } e.preventDefault(); // Remove active class from all links document.querySelectorAll('.sidebar-menu a').forEach(l => l.classList.remove('active')); this.classList.add('active'); // Handle modal openings if (targetUrl === '#orders') { openOrdersModal(); } else if (targetUrl === '#bmi-calculator') { openBMICalculatorModal(); } else if (targetUrl === 'profile.php') { openProfileModal(); } // Close sidebar after clicking toggleSidebar(); }); }); })(); </script> <script src="js/canvas-confetti.min.js"></script> <script> // Handle back button and prevent refresh window.addEventListener('pageshow', function(event) { if (event.persisted) { // Page was loaded from cache (back button) window.location.reload(); } }); // Save scroll position before leaving the page window.addEventListener('beforeunload', function() { sessionStorage.setItem('scrollPosition', window.scrollY); }); // Restore scroll position when returning to the page window.addEventListener('load', function() { const scrollPosition = sessionStorage.getItem('scrollPosition'); if (scrollPosition) { window.scrollTo(0, parseInt(scrollPosition)); sessionStorage.removeItem('scrollPosition'); } }); // Add this new code for handling About and Contact links document.addEventListener('DOMContentLoaded', function() { const aboutLink = document.querySelector('a[href="about.php"]'); const contactLink = document.querySelector('a[href="contact.php"]'); if (aboutLink) { aboutLink.addEventListener('click', function(e) { // Let the default link behavior happen return true; }); } if (contactLink) { contactLink.addEventListener('click', function(e) { // Let the default link behavior happen return true; }); } }); </script> </body> </html> <!-- Add this before closing body tag --> <div id="productModal" class="modal"> <div class="modal-content"> <div class="modal-header"> <h2>Product Details</h2> <!-- Re-added the title --> <!-- <button class="back-button" onclick="window.history.back()"> <i class="fas fa-arrow-left"></i> Back </button> --> <span class="close-modal" onclick="closeProductModal()">×</span> </div> <div class="modal-body"> <iframe id="productDetailIframe" src="" frameborder="0" onload="handleIframeLoad()"></iframe> </div> </div> </div> <style> /* Add this CSS */ .view-details-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 20px; border: 1px solid var(--primary-color); border-radius: 8px; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; background: white; /* Default background */ color: var(--primary-color); /* Default text color */ box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-right: 15px; /* Space between buttons */ } .view-details-btn:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(46, 125, 50, 0.2); background: var(--gradient-primary); /* Gradient on hover */ color: white; /* Text color on hover */ } @media (max-width: 768px) { .view-details-btn { width: 100%; /* Full width on smaller screens */ margin-right: 0; /* Remove right margin */ margin-bottom: 10px; /* Add bottom margin for stacking */ } } .modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); } .modal-content { background-color: #fefefe; margin: 5% auto; padding: 0; border: 1px solid #888; width: 90%; max-width: 1000px; height: 90%; max-height: 90vh; border-radius: 8px; position: relative; overflow: hidden; display: flex; flex-direction: column; } .modal-header { padding: 15px 20px; background: #f8f9fa; border-bottom: 1px solid #dee2e6; display: flex; justify-content: space-between; /* Changed from flex-end to space-between */ align-items: center; } .back-button { background: #2E7D32; color: white; border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; display: none; /* Hide the back button */ align-items: center; gap: 5px; font-size: 14px; transition: all 0.3s ease; } .back-button:hover { background: #1B5E20; transform: translateX(-3px); } .close-modal { color: #666; font-size: 24px; font-weight: bold; cursor: pointer; background: transparent; border: none; padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; } .close-modal:hover { color: #000; transform: scale(1.1); } .modal-body { flex: 1; overflow: hidden; position: relative; } #productDetailIframe { width: 100%; height: 100%; border: none; background-color: #fefefe; display: block; } @media (max-width: 768px) { .modal-content { width: 95%; height: 95%; margin: 2.5% auto; } .modal-header { padding: 10px 15px; } .back-button { display: none; /* Ensure back button is hidden on mobile too */ } .close-modal { font-size: 20px; width: 25px; height: 25px; } } </style> <script> // Store the previous URL when opening the modal let previousUrl = ''; function closeProductModal() { const modal = document.getElementById('productModal'); const iframe = document.getElementById('productDetailIframe'); if (modal && iframe) { modal.style.display = "none"; iframe.src = ''; // Restore the previous URL if (previousUrl) { window.history.pushState({}, '', previousUrl); } } } function handleIframeLoad() { const iframe = document.getElementById('productDetailIframe'); try { // Try to access iframe content const iframeContent = iframe.contentWindow.document; // Add back button event listener to iframe content (only for the close-modal, not the back-button) const closeButtonInIframe = iframeContent.querySelector('.close-modal'); if(closeButtonInIframe) { closeButtonInIframe.addEventListener('click', function(e) { e.preventDefault(); closeProductModal(); }); } } catch (e) { console.log('Could not access iframe content due to same-origin policy'); } } function showProductDetails(productId) { const modal = document.getElementById('productModal'); const iframe = document.getElementById('productDetailIframe'); if (!modal || !iframe) return; // Store current URL before opening modal previousUrl = window.location.href; // Show loading state and open modal iframe.src = 'loading.html'; modal.style.display = "block"; // Fetch the product detail file name fetch(`get_product_detail_filename.php?id=${productId}`) .then(response => response.text()) .then(filename => { if (filename && filename.trim() !== '' && filename.includes('.php')) { iframe.src = `productdetail/${filename.trim()}`; } else { iframe.src = 'error.html'; } }) .catch(() => { iframe.src = 'error.html'; }); } // Close modal when clicking outside document.addEventListener('click', function(event) { const modal = document.getElementById('productModal'); if (event.target === modal) { closeProductModal(); } }); // Close modal with Escape key document.addEventListener('keydown', function(event) { if (event.key === 'Escape') { closeProductModal(); } }); // Handle browser back button window.addEventListener('popstate', function(event) { const modal = document.getElementById('productModal'); if (modal && modal.style.display === 'block') { closeProductModal(); } }); </script> <script> // New Product Detail Modal Functions function showProductDetails(productId) { const productDetailModal = document.getElementById('productDetailModal'); const productDetailFrame = document.getElementById('productDetailFrame'); fetch('get_product_detail_filename.php?id=' + productId) .then(response => response.text()) .then(filename => { if (filename) { productDetailFrame.src = filename; // Set the iframe source to the dynamic filename productDetailModal.style.display = 'block'; document.body.style.overflow = 'hidden'; // Prevent background scrolling } else { Swal.fire('Error', 'Product detail page not found.', 'error'); } }) .catch(error => { console.error('Error fetching product detail filename:', error); Swal.fire('Error', 'Could not load product details.', 'error'); }); } function closeProductDetailModal() { const productDetailModal = document.getElementById('productDetailModal'); productDetailModal.style.display = 'none'; document.body.style.overflow = 'auto'; // Re-enable background scrolling // Clear iframe src to stop any media/scripts document.getElementById('productDetailFrame').src = ''; } // Close modal when clicking outside window.addEventListener('click', (e) => { const productDetailModal = document.getElementById('productDetailModal'); if (e.target === productDetailModal) { closeProductDetailModal(); } }); // Close modal with Escape key document.addEventListener('keydown', (e) => { const productDetailModal = document.getElementById('productDetailModal'); if (e.key === 'Escape' && productDetailModal.style.display === 'block') { closeProductDetailModal(); } }); // Function to show offer product details function showOfferProductDetails(productId) { // Use the same modal as regular products for consistency const productDetailModal = document.getElementById('productDetailModal'); const productDetailFrame = document.getElementById('productDetailFrame'); if (!productDetailModal || !productDetailFrame) { console.error('Product detail modal elements not found'); return; } // Show loading state first productDetailFrame.src = 'loading.html'; productDetailModal.style.display = 'block'; document.body.style.overflow = 'hidden'; // Load the default offer detail page productDetailFrame.src = `OFFER PRODUCT/detail/product1.php?id=${productId}`; } // ... existing code ... </script>
Save
cmd:
run