<?php
/**
 * Valentine's Day Web App - Configuration File
 * Edit these variables to personalize the app
 */

// ============================================
// 🎯 PERSONALIZATION SETTINGS
// ============================================

define('HER_NAME', 'Sweta');           // Her name
define('MY_NAME', 'Shashwat');              // Your name
define('MY_EMAIL', 'shashwat.gaire@gmail.com');  // Your email (for YES notification)

// ============================================
// 🎨 COLOR SCHEME
// ============================================

define('COLOR_BLUSH', '#ffb6c1');      // Blush pink
define('COLOR_ROSE', '#ff4d6d');       // Soft red
define('COLOR_DEEP_ROSE', '#c9184a');  // Deep rose
define('COLOR_LIGHT', '#fff5f7');      // Light background

// ============================================
// 🎵 MEDIA PATHS (Update these with your URLs)
// ============================================

define('MUSIC_LANDING', 'assets/music/Landing.mp3');
define('MUSIC_SLIDESHOW', 'assets/music/Slideshow.mp3');
define('MUSIC_SUCCESS', 'assets/music/Yes.mp3');

// Sample images for slideshow - Replace with your own
$slideshow_data = [
    [
        'image' => 'assets/images/memory1.jpg',
        'caption' => 'didn’t know it then, but that first conversation was the start of something I’d never want to lose.'
    ],
    [
        'image' => 'assets/images/memory2.jpg',
        'caption' => 'Somewhere between random laughs and late-night talks, you quietly became my favorite part of every day'
    ],
    [
        'image' => 'assets/images/memory3.jpg',
        'caption' => 'You turned ordinary moments into memories I catch myself replaying'
    ],
    [
        'image' => 'assets/images/memory4.jpg',
        'caption' => 'With you, silence feels peaceful, chaos feels manageable, and everything just feels right.'
    ],
    [
        'image' => 'assets/images/memory5.jpg',
        'caption' => 'I stopped wondering where this was going the moment I realized I didn’t want it going anywhere without you.'
    ],
    [
        'image' => 'assets/images/memory6.jpg',
        'caption' => 'You\'re my favorite'
    ]
];

// ============================================
// 💕 ROMANTIC MESSAGES
// ============================================

$love_quotes = [
    'You make my heart skip a beat.',
    'Every day with you is a gift.',
    'You\'re my favorite person in the world.',
    'I love the way you laugh.',
    'You make ordinary moments magical.',
    'My heart chose you.',
    'You\'re my sunshine on cloudy days.',
    'Forever starts with you.',
    'You\'re the love of my life.',
    'I fall for you more each day.'
];

// ============================================
// 📊 DATABASE CONFIGURATION
// ============================================

define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');                 // Empty for XAMPP default
define('DB_NAME', 'valentine_app');

// Database connection function
function getDBConnection() {
    try {
        $pdo = new PDO(
            'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8mb4',
            DB_USER,
            DB_PASS,
            [
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
            ]
        );
        return $pdo;
    } catch (PDOException $e) {
        die('Database connection failed: ' . $e->getMessage());
    }
}

// ============================================
// 🔧 UTILITY FUNCTIONS
// ============================================

/**
 * Sanitize input
 */
function sanitize($input) {
    return htmlspecialchars(trim($input), ENT_QUOTES, 'UTF-8');
}

/**
 * Get client IP address
 */
function getClientIP() {
    $ip = '';
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0];
    } else {
        $ip = $_SERVER['REMOTE_ADDR'];
    }
    return filter_var($ip, FILTER_VALIDATE_IP) ? $ip : 'Unknown';
}

/**
 * Get random love quote
 */
function getRandomQuote() {
    global $love_quotes;
    return $love_quotes[array_rand($love_quotes)];
}

/**
 * Send email notification
 */
function sendYESNotification($name, $timestamp, $ip) {
    $to = MY_EMAIL;
    $subject = "She Said YES! 💖 - Valentine's App";
    
    $message = "
    <html>
    <head>
        <style>
            body { font-family: Arial, sans-serif; color: #333; }
            .container { max-width: 600px; margin: 0 auto; padding: 20px; background: #fff5f7; border-radius: 10px; }
            .header { color: #ff4d6d; font-size: 28px; font-weight: bold; }
            .content { margin: 20px 0; }
            .detail { margin: 10px 0; font-size: 16px; }
            .label { font-weight: bold; color: #c9184a; }
        </style>
    </head>
    <body>
        <div class='container'>
            <div class='header'>🎉 She Said YES!!! 💖</div>
            <div class='content'>
                <div class='detail'>
                    <span class='label'>Name:</span> " . sanitize($name) . "
                </div>
                <div class='detail'>
                    <span class='label'>Response:</span> YES ✓
                </div>
                <div class='detail'>
                    <span class='label'>Timestamp:</span> " . $timestamp . "
                </div>
                <div class='detail'>
                    <span class='label'>IP Address:</span> " . $ip . "
                </div>
                <div style='margin-top: 30px; font-size: 14px; color: #666;'>
                    Best Valentine Ever! 💕
                </div>
            </div>
        </div>
    </body>
    </html>
    ";
    
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
    
    return mail($to, $subject, $message, $headers);
}

?>
