T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/soundstudiopro.com/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/public_html/event_details_pro.php
<?php
session_start();
require_once 'config/database.php';

$event_id = $_GET['id'] ?? null;

if (!$event_id) {
    header('Location: /events.php');
    exit;
}

$pdo = getDBConnection();
$user_id = $_SESSION['user_id'] ?? null;

// Get event details with enhanced query
$stmt = $pdo->prepare("
    SELECT 
        e.*,
        u.name as creator_name,
        u.profile_image as creator_image,
        u.bio as creator_bio,
        COUNT(DISTINCT ea.user_id) as attendee_count,
        COUNT(DISTINCT el.user_id) as like_count,
        COUNT(DISTINCT ec.id) as comment_count,
        CASE WHEN ea2.user_id IS NOT NULL THEN ea2.status ELSE NULL END as user_rsvp_status,
        CASE WHEN el2.user_id IS NOT NULL THEN 1 ELSE 0 END as user_has_liked
    FROM events e
    JOIN users u ON e.creator_id = u.id
    LEFT JOIN event_attendees ea ON e.id = ea.event_id AND ea.status = 'attending'
    LEFT JOIN event_likes el ON e.id = el.event_id
    LEFT JOIN event_comments ec ON e.id = ec.event_id
    LEFT JOIN event_attendees ea2 ON e.id = ea2.event_id AND ea2.user_id = ?
    LEFT JOIN event_likes el2 ON e.id = el2.event_id AND el2.user_id = ?
    WHERE e.id = ? AND e.status = 'published'
    GROUP BY e.id
");

$stmt->execute([$user_id, $user_id, $event_id]);
$event = $stmt->fetch();

if (!$event) {
    header('Location: /events.php');
    exit;
}

// Get attendees
$stmt = $pdo->prepare("
    SELECT 
        ea.*,
        u.name,
        u.profile_image,
        u.bio
    FROM event_attendees ea
    JOIN users u ON ea.user_id = u.id
    WHERE ea.event_id = ?
    ORDER BY ea.rsvp_date DESC
    LIMIT 12
");
$stmt->execute([$event_id]);
$attendees = $stmt->fetchAll();

// Get comments
$stmt = $pdo->prepare("
    SELECT 
        ec.*,
        u.name,
        u.profile_image
    FROM event_comments ec
    JOIN users u ON ec.user_id = u.id
    WHERE ec.event_id = ?
    ORDER BY ec.created_at DESC
    LIMIT 20
");
$stmt->execute([$event_id]);
$comments = $stmt->fetchAll();

// Calculate event stats
$days_until = ceil((strtotime($event['start_date']) - time()) / 86400);
$event_duration = ceil((strtotime($event['end_date']) - strtotime($event['start_date'])) / 3600);

// Set page variables
$current_page = 'events';
$page_title = $event['title'] . ' - SoundStudioPro Events';
$page_description = substr($event['description'], 0, 160);

include 'includes/header.php';

// Helper functions
function formatEventDate($start_date, $end_date) {
    $start = new DateTime($start_date);
    $end = new DateTime($end_date);
    
    if ($start->format('Y-m-d') === $end->format('Y-m-d')) {
        return $start->format('l, F j, Y') . ' • ' . $start->format('g:i A');
    } else {
        return $start->format('M j') . ' - ' . $end->format('M j, Y');
    }
}

function getEventTypeConfig($event_type) {
    $configs = [
        'live_music' => ['icon' => 'fas fa-music', 'color' => '#667eea', 'label' => 'Live Music'],
        'workshop' => ['icon' => 'fas fa-graduation-cap', 'color' => '#48bb78', 'label' => 'Workshop'],
        'networking' => ['icon' => 'fas fa-users', 'color' => '#ed8936', 'label' => 'Networking'],
        'release_party' => ['icon' => 'fas fa-champagne-glasses', 'color' => '#9f7aea', 'label' => 'Release Party'],
        'battle' => ['icon' => 'fas fa-trophy', 'color' => '#f56565', 'label' => 'Battle'],
        'open_mic' => ['icon' => 'fas fa-microphone', 'color' => '#38b2ac', 'label' => 'Open Mic'],
        'studio_session' => ['icon' => 'fas fa-record-vinyl', 'color' => '#ed64a6', 'label' => 'Studio Session'],
        'other' => ['icon' => 'fas fa-calendar', 'color' => '#a0aec0', 'label' => 'Other Event']
    ];
    return $configs[$event_type] ?? $configs['other'];
}

$event_config = getEventTypeConfig($event['event_type']);
?>

<style>
/* Event Details Premium Design */
.event-details-premium {
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
    position: relative;
}

.event-details-premium::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(79, 172, 254, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Navigation Bar */
.event-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 0;
}

.event-topbar .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #4facfe;
    text-decoration: none;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    background: rgba(79, 172, 254, 0.08);
    border: 1px solid rgba(79, 172, 254, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.back-link:hover {
    background: rgba(79, 172, 254, 0.15);
    border-color: rgba(79, 172, 254, 0.4);
    transform: translateX(-3px);
}

.event-meta-quick {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: #a0aec0;
    font-size: 0.9rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-item i {
    color: #4facfe;
}

.topbar-actions {
    display: flex;
    gap: 1rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.action-btn-primary {
    background: linear-gradient(135deg, #4facfe, #667eea);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.action-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.action-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Hero Section */
.event-hero-premium {
    position: relative;
    padding: 4rem 0 6rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(79, 172, 254, 0.15) 100%);
    overflow: hidden;
}

.hero-content-premium {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

.event-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.event-title-premium {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 2rem;
    line-height: 1.1;
    background: linear-gradient(135deg, #ffffff 0%, #4facfe 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.event-subtitle {
    font-size: 1.3rem;
    color: #cbd5e0;
    margin-bottom: 3rem;
    line-height: 1.6;
}

.event-meta-hero {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
}

.meta-hero-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.meta-hero-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    background: linear-gradient(135deg, #4facfe, #667eea);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.meta-hero-content h4 {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-hero-content p {
    font-size: 1.1rem;
    color: white;
    font-weight: 600;
}

/* Main Container */
.event-container-premium {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
    position: relative;
    z-index: 1;
}

.event-grid-premium {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 3rem;
    align-items: start;
}

/* Main Content Area */
.event-main-content-premium {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.content-section-premium {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.content-section-premium:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(79, 172, 254, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-title-premium {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.section-badge {
    padding: 0.5rem 1rem;
    background: rgba(79, 172, 254, 0.15);
    color: #4facfe;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.event-description-premium {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #e2e8f0;
}

/* Event Details Grid */
.details-grid-premium {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.detail-item-premium {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.08) 0%, rgba(102, 126, 234, 0.08) 100%);
    border: 1px solid rgba(79, 172, 254, 0.15);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.detail-item-premium:hover {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.12) 0%, rgba(102, 126, 234, 0.12) 100%);
    border-color: rgba(79, 172, 254, 0.3);
    transform: translateY(-2px);
}

.detail-icon-premium {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4facfe, #667eea);
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.detail-info-premium h3 {
    font-size: 0.9rem;
    color: #a0aec0;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-info-premium p {
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 600;
    margin: 0;
}

/* Comments Section */
.comment-form-premium {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.comment-form-premium textarea {
    flex: 1;
    min-height: 100px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

.comment-form-premium textarea:focus {
    outline: none;
    border-color: #4facfe;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.15);
}

.comment-form-premium textarea::placeholder {
    color: #718096;
}

.comment-submit-premium {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #4facfe, #667eea);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-end;
}

.comment-submit-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.comments-list-premium {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comment-item-premium {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.comment-item-premium:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.comment-avatar-premium {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4facfe, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.comment-body-premium {
    flex: 1;
}

.comment-header-premium {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.comment-author-premium {
    color: #4facfe;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
}

.comment-author-premium:hover {
    text-decoration: underline;
}

.comment-date-premium {
    font-size: 0.85rem;
    color: #718096;
}

.comment-text-premium {
    color: #e2e8f0;
    line-height: 1.6;
    margin: 0;
}

.no-content-premium {
    text-align: center;
    padding: 4rem 2rem;
    color: #718096;
}

.no-content-premium i {
    font-size: 3rem;
    color: #4facfe;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-content-premium h3 {
    font-size: 1.3rem;
    color: #a0aec0;
    margin-bottom: 0.5rem;
}

/* Sidebar */
.event-sidebar-premium {
    position: sticky;
    top: 120px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-card-premium {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(20px);
}

.sidebar-title-premium {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1.5rem;
}

/* Quick Actions */
.quick-actions-premium {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-btn-large {
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    justify-content: center;
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Stats Grid */
.stats-grid-premium {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card-premium {
    text-align: center;
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.08) 0%, rgba(102, 126, 234, 0.08) 100%);
    border: 1px solid rgba(79, 172, 254, 0.15);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.stat-card-premium:hover {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.12) 0%, rgba(102, 126, 234, 0.12) 100%);
    border-color: rgba(79, 172, 254, 0.3);
    transform: translateY(-2px);
}

.stat-icon-premium {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.75rem;
    border-radius: 10px;
    background: linear-gradient(135deg, #4facfe, #667eea);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-number-premium {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label-premium {
    font-size: 0.85rem;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Creator Card */
.creator-card-premium {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.08) 0%, rgba(102, 126, 234, 0.08) 100%);
    border: 1px solid rgba(79, 172, 254, 0.15);
    border-radius: 16px;
    margin-bottom: 2rem;
}

.creator-avatar-premium {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4facfe, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.creator-info-premium h4 {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.creator-info-premium a {
    color: #4facfe;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.creator-info-premium a:hover {
    text-decoration: underline;
}

/* Attendees Grid */
.attendees-grid-premium {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.attendee-item-premium {
    text-align: center;
}

.attendee-avatar-premium {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #4facfe, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
    transition: all 0.3s ease;
}

.attendee-item-premium:hover .attendee-avatar-premium {
    transform: scale(1.1);
}

.attendee-name-premium {
    font-size: 0.75rem;
    color: #a0aec0;
    text-decoration: none;
    display: block;
}

.attendee-name-premium:hover {
    color: #4facfe;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .event-grid-premium {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .event-sidebar-premium {
        position: static;
    }
}

@media (max-width: 768px) {
    .event-title-premium {
        font-size: 2.5rem;
    }
    
    .event-meta-hero {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .event-topbar .topbar-actions {
        display: none;
    }
    
    .details-grid-premium {
        grid-template-columns: 1fr;
    }
    
    .stats-grid-premium {
        grid-template-columns: 1fr;
    }
    
    .attendees-grid-premium {
        grid-template-columns: repeat(3, 1fr);
    }
}
</style>

<div class="event-details-premium">
    <!-- Top Navigation Bar -->
    <div class="event-topbar">
        <div class="container">
            <div class="topbar-left">
                <a href="/events.php" class="back-link">
                    <i class="fas fa-arrow-left"></i>
                    <span>Back to Events</span>
                </a>
                
                <div class="event-meta-quick">
                    <div class="meta-item">
                        <i class="fas fa-users"></i>
                        <span><?= $event['attendee_count'] ?> attending</span>
                    </div>
                    <div class="meta-item">
                        <i class="fas fa-heart"></i>
                        <span><?= $event['like_count'] ?> likes</span>
                    </div>
                </div>
            </div>
            
            <div class="topbar-actions">
                <?php if ($user_id): ?>
                    <button class="action-btn action-btn-secondary" onclick="shareEvent(<?= $event['id'] ?>)">
                        <i class="fas fa-share"></i>
                        Share
                    </button>
                    <button class="action-btn action-btn-primary" onclick="rsvpEvent(<?= $event['id'] ?>, 'attending')" 
                            <?= $event['user_rsvp_status'] === 'attending' ? 'disabled' : '' ?>>
                        <i class="fas fa-check"></i>
                        <?= $event['user_rsvp_status'] === 'attending' ? 'Attending' : 'Attend Event' ?>
                    </button>
                <?php endif; ?>
            </div>
        </div>
    </div>

    <!-- Hero Section -->
    <div class="event-hero-premium">
        <div class="hero-content-premium">
            <div class="event-type-badge" style="background: <?= $event_config['color'] ?>">
                <i class="<?= $event_config['icon'] ?>"></i>
                <?= $event_config['label'] ?>
            </div>
            
            <h1 class="event-title-premium"><?= htmlspecialchars($event['title']) ?></h1>
            
            <p class="event-subtitle"><?= htmlspecialchars(substr($event['description'], 0, 200)) ?>...</p>
            
            <div class="event-meta-hero">
                <div class="meta-hero-item">
                    <div class="meta-hero-icon">
                        <i class="fas fa-calendar"></i>
                    </div>
                    <div class="meta-hero-content">
                        <h4>Date</h4>
                        <p><?= formatEventDate($event['start_date'], $event['end_date']) ?></p>
                    </div>
                </div>
                
                <?php if ($event['location']): ?>
                <div class="meta-hero-item">
                    <div class="meta-hero-icon">
                        <i class="fas fa-map-marker-alt"></i>
                    </div>
                    <div class="meta-hero-content">
                        <h4>Location</h4>
                        <p><?= htmlspecialchars($event['location']) ?></p>
                    </div>
                </div>
                <?php endif; ?>
                
                <div class="meta-hero-item">
                    <div class="meta-hero-icon">
                        <i class="fas fa-ticket-alt"></i>
                    </div>
                    <div class="meta-hero-content">
                        <h4>Price</h4>
                        <p><?= $event['is_free'] ? 'Free Entry' : '$' . number_format($event['ticket_price'], 2) ?></p>
                    </div>
                </div>
                
                <?php if ($days_until > 0): ?>
                <div class="meta-hero-item">
                    <div class="meta-hero-icon">
                        <i class="fas fa-clock"></i>
                    </div>
                    <div class="meta-hero-content">
                        <h4>Starts In</h4>
                        <p><?= $days_until ?> day<?= $days_until != 1 ? 's' : '' ?></p>
                    </div>
                </div>
                <?php endif; ?>
            </div>
        </div>
    </div>

    <!-- Main Container -->
    <div class="event-container-premium">
        <div class="event-grid-premium">
            <!-- Main Content -->
            <div class="event-main-content-premium">
                <!-- About Section -->
                <div class="content-section-premium">
                    <div class="section-header">
                        <h2 class="section-title-premium">About This Event</h2>
                    </div>
                    <div class="event-description-premium">
                        <?= nl2br(htmlspecialchars($event['description'])) ?>
                    </div>
                </div>

                <!-- Event Details -->
                <div class="content-section-premium">
                    <div class="section-header">
                        <h2 class="section-title-premium">Event Details</h2>
                    </div>
                    <div class="details-grid-premium">
                        <div class="detail-item-premium">
                            <div class="detail-icon-premium">
                                <i class="fas fa-calendar-alt"></i>
                            </div>
                            <div class="detail-info-premium">
                                <h3>Full Date</h3>
                                <p><?= date('M j, Y g:i A', strtotime($event['start_date'])) ?></p>
                            </div>
                        </div>
                        
                        <?php if ($event['venue_name']): ?>
                        <div class="detail-item-premium">
                            <div class="detail-icon-premium">
                                <i class="fas fa-building"></i>
                            </div>
                            <div class="detail-info-premium">
                                <h3>Venue</h3>
                                <p><?= htmlspecialchars($event['venue_name']) ?></p>
                            </div>
                        </div>
                        <?php endif; ?>
                        
                        <div class="detail-item-premium">
                            <div class="detail-icon-premium">
                                <i class="fas fa-hourglass-half"></i>
                            </div>
                            <div class="detail-info-premium">
                                <h3>Duration</h3>
                                <p><?= $event_duration ?> hour<?= $event_duration != 1 ? 's' : '' ?></p>
                            </div>
                        </div>
                        
                        <?php if ($event['max_attendees']): ?>
                        <div class="detail-item-premium">
                            <div class="detail-icon-premium">
                                <i class="fas fa-users"></i>
                            </div>
                            <div class="detail-info-premium">
                                <h3>Capacity</h3>
                                <p><?= $event['attendee_count'] ?> / <?= $event['max_attendees'] ?></p>
                            </div>
                        </div>
                        <?php endif; ?>
                    </div>
                </div>

                <!-- Comments Section -->
                <div class="content-section-premium">
                    <div class="section-header">
                        <h2 class="section-title-premium">Discussion</h2>
                        <span class="section-badge"><?= count($comments) ?> comments</span>
                    </div>
                    
                    <?php if ($user_id): ?>
                        <div class="comment-form-premium">
                            <textarea id="commentText" placeholder="Share your thoughts about this event..."></textarea>
                            <button onclick="addComment(<?= $event['id'] ?>)" class="comment-submit-premium">
                                <i class="fas fa-paper-plane"></i>
                                Post
                            </button>
                        </div>
                    <?php endif; ?>
                    
                    <div class="comments-list-premium">
                        <?php if (empty($comments)): ?>
                            <div class="no-content-premium">
                                <i class="fas fa-comment-slash"></i>
                                <h3>No comments yet</h3>
                                <p>Be the first to share your thoughts about this event!</p>
                            </div>
                        <?php else: ?>
                            <?php foreach ($comments as $comment): ?>
                                <div class="comment-item-premium">
                                    <div class="comment-avatar-premium">
                                        <?= strtoupper(substr($comment['name'], 0, 1)) ?>
                                    </div>
                                    <div class="comment-body-premium">
                                        <div class="comment-header-premium">
                                            <a href="/artist_profile.php?id=<?= $comment['user_id'] ?>" class="comment-author-premium">
                                                <?= htmlspecialchars($comment['name']) ?>
                                            </a>
                                            <span class="comment-date-premium"><?= date('M j, Y g:i A', strtotime($comment['created_at'])) ?></span>
                                        </div>
                                        <p class="comment-text-premium"><?= nl2br(htmlspecialchars($comment['comment'])) ?></p>
                                    </div>
                                </div>
                            <?php endforeach; ?>
                        <?php endif; ?>
                    </div>
                </div>
            </div>

            <!-- Sidebar -->
            <aside class="event-sidebar-premium">
                <!-- Quick Actions -->
                <div class="sidebar-card-premium">
                    <h3 class="sidebar-title-premium">Quick Actions</h3>
                    <div class="quick-actions-premium">
                        <?php if ($user_id): ?>
                            <button class="action-btn action-btn-primary action-btn-large" onclick="rsvpEvent(<?= $event['id'] ?>, 'attending')" 
                                    <?= $event['user_rsvp_status'] === 'attending' ? 'disabled' : '' ?>>
                                <i class="fas fa-check"></i>
                                <?= $event['user_rsvp_status'] === 'attending' ? 'Attending' : 'Attend Event' ?>
                            </button>
                            
                            <button class="action-btn action-btn-secondary" onclick="rsvpEvent(<?= $event['id'] ?>, 'maybe')"
                                    <?= $event['user_rsvp_status'] === 'maybe' ? 'disabled' : '' ?>>
                                <i class="fas fa-question"></i>
                                <?= $event['user_rsvp_status'] === 'maybe' ? 'Marked as Maybe' : 'Maybe' ?>
                            </button>
                            
                            <button class="action-btn action-btn-secondary" onclick="likeEvent(<?= $event['id'] ?>)"
                                    <?= $event['user_has_liked'] ? 'disabled' : '' ?>>
                                <i class="fas fa-heart"></i>
                                <?= $event['user_has_liked'] ? 'Liked' : 'Like Event' ?>
                            </button>
                            
                            <button class="action-btn action-btn-secondary" onclick="shareEvent(<?= $event['id'] ?>)">
                                <i class="fas fa-share"></i>
                                Share Event
                            </button>
                        <?php else: ?>
                            <a href="/auth/login_new.php" class="action-btn action-btn-primary action-btn-large">
                                <i class="fas fa-sign-in-alt"></i>
                                Login to Join
                            </a>
                        <?php endif; ?>
                    </div>
                </div>

                <!-- Stats -->
                <div class="sidebar-card-premium">
                    <h3 class="sidebar-title-premium">Event Stats</h3>
                    <div class="stats-grid-premium">
                        <div class="stat-card-premium">
                            <div class="stat-icon-premium">
                                <i class="fas fa-users"></i>
                            </div>
                            <div class="stat-number-premium"><?= $event['attendee_count'] ?></div>
                            <div class="stat-label-premium">Attending</div>
                        </div>
                        
                        <div class="stat-card-premium">
                            <div class="stat-icon-premium">
                                <i class="fas fa-heart"></i>
                            </div>
                            <div class="stat-number-premium"><?= $event['like_count'] ?></div>
                            <div class="stat-label-premium">Likes</div>
                        </div>
                        
                        <div class="stat-card-premium">
                            <div class="stat-icon-premium">
                                <i class="fas fa-comment"></i>
                            </div>
                            <div class="stat-number-premium"><?= $event['comment_count'] ?></div>
                            <div class="stat-label-premium">Comments</div>
                        </div>
                    </div>
                </div>

                <!-- Creator Info -->
                <div class="sidebar-card-premium">
                    <h3 class="sidebar-title-premium">Event Host</h3>
                    <div class="creator-card-premium">
                        <div class="creator-avatar-premium">
                            <?= strtoupper(substr($event['creator_name'], 0, 1)) ?>
                        </div>
                        <div class="creator-info-premium">
                            <h4>Hosted by</h4>
                            <a href="/artist_profile.php?id=<?= $event['creator_id'] ?>">
                                <?= htmlspecialchars($event['creator_name']) ?>
                            </a>
                        </div>
                    </div>
                </div>

                <!-- Attendees -->
                <?php if (!empty($attendees)): ?>
                <div class="sidebar-card-premium">
                    <h3 class="sidebar-title-premium">Attendees (<?= $event['attendee_count'] ?>)</h3>
                    <div class="attendees-grid-premium">
                        <?php foreach (array_slice($attendees, 0, 12) as $attendee): ?>
                            <div class="attendee-item-premium">
                                <div class="attendee-avatar-premium">
                                    <?= strtoupper(substr($attendee['name'], 0, 1)) ?>
                                </div>
                                <a href="/artist_profile.php?id=<?= $attendee['user_id'] ?>" class="attendee-name-premium">
                                    <?= htmlspecialchars(substr($attendee['name'], 0, 10)) ?>
                                </a>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
                <?php endif; ?>
            </aside>
        </div>
    </div>
</div>

<script>
function rsvpEvent(eventId, status) {
    if (!<?= $user_id ? 'true' : 'false' ?>) {
        if (window.ajaxNavigation) {
            window.ajaxNavigation.navigateToPage('/auth/login_new.php');
        } else {
            window.location.href = '/auth/login_new.php';
        }
        return;
    }
    
    fetch('/api_events.php', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ action: 'rsvp', event_id: eventId, status: status })
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            location.reload();
        } else {
            alert('Error: ' + data.message);
        }
    })
    .catch(error => {
        console.error('Error:', error);
        alert('An error occurred. Please try again.');
    });
}

function likeEvent(eventId) {
    if (!<?= $user_id ? 'true' : 'false' ?>) {
        if (window.ajaxNavigation) {
            window.ajaxNavigation.navigateToPage('/auth/login_new.php');
        } else {
            window.location.href = '/auth/login_new.php';
        }
        return;
    }
    
    fetch('/api_events.php', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ action: 'like', event_id: eventId })
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            location.reload();
        } else {
            alert('Error: ' + data.message);
        }
    })
    .catch(error => {
        console.error('Error:', error);
        alert('An error occurred. Please try again.');
    });
}

function shareEvent(eventId) {
    const url = window.location.href;
    const title = '<?= htmlspecialchars($event['title']) ?>';
    
    if (navigator.share) {
        navigator.share({ title: title, url: url });
    } else {
        navigator.clipboard.writeText(url).then(() => {
            alert('Event link copied to clipboard!');
        });
    }
}

function addComment(eventId) {
    const commentText = document.getElementById('commentText').value.trim();
    
    if (!commentText) {
        alert('Please enter a comment');
        return;
    }
    
    fetch('/api_events.php', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ action: 'comment', event_id: eventId, comment: commentText })
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            location.reload();
        } else {
            alert('Error: ' + data.message);
        }
    })
    .catch(error => {
        console.error('Error:', error);
        alert('An error occurred. Please try again.');
    });
}
</script>

<?php include 'includes/footer.php'; ?>


CasperSecurity Mini