<?php
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
// Load saved options
$bg_color    = get_option('ucm_bg_color', '#f0f0f0');
$font_size   = get_option('ucm_font_size', '18');
$font_family = get_option('ucm_font_family', 'Arial');
$image_url   = '';
// Get image URL from attachment ID
$image_id = absint(get_option('ucm_bg_image_id'));
if ($image_id) {
$img = wp_get_attachment_image_src($image_id, 'full');
if (!empty($img[0])) {
$image_url = esc_url($img[0]);
}
}
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>

<head>
    <meta charset="<?php bloginfo('charset'); ?>" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php esc_html_e('Coming Soon', 'kamran-under-construction-mode'); ?></title>
    <style>
        body {
            <?php if ($image_url): ?> background: url('<?php echo  esc_url( $image_url ); ?>') no-repeat center center fixed;
            background-size: cover;
            <?php else: ?> background-color: <?php echo esc_attr($bg_color);
            ?>;
            <?php endif;
            ?>font-family: <?php echo esc_attr($font_family);
            ?>;
            font-size: <?php echo esc_attr($font_size);
            ?>px;
            color: #333;
            text-align: center;
            padding: 100px 20px;
            margin: 0;

        }

        .coming-soon-wrapper {
            max-width: 600px;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.85);
            padding: 40px;
            border-radius: 10px;
        }

        h1 {
            margin-top: 0;
            font-size: 36px;
        }

        p {
            font-size: 18px;
        }
    </style>
</head>

<body>

    <div class="coming-soon-wrapper">
        <?php
$logo_id = get_option('ucm_logo_id'); // Use the stored attachment ID
if ($logo_id):
?>
        <div class="ucm-logo" style="margin-bottom: 30px;">
            <?php
        echo wp_get_attachment_image($logo_id, 'medium', false, [
            'alt' => esc_attr__('Company Logo', 'kamran-under-construction-mode'),
            'style' => 'max-width: 200px; height: auto;',
        ]);
        ?>
        </div>
        <?php endif; ?>

        <h1><?php echo esc_html(get_option('ucm_heading_text', 'Coming Soon')); ?></h1>
        <p><?php echo esc_html(get_option('ucm_message_text', 'We are working on something awesome. Stay tuned!')); ?>
        </p>
    </div>
</body>

</html>