<?php

namespace OxygenApp\Views\Frontend\Content;
if (!defined('ABSPATH')) exit;

use OxygenApp\Views\IView;
use OxygenApp\Views\BaseView;
use OxygenApp\Utils\FrontendData;
use OxygenApp\Enums\FrontendDataType;
use OxygenApp\Utils\LanguagesHelper;

class Success extends BaseView implements IView
{
    public function render(): void
    {
        $routes = FrontendData::getInstance()->getDefaultSettings(FrontendDataType::ARRAY)['routes'] ?? [];

        $back_to_login = LanguagesHelper::getInstance()->getLangLabel('back_to_login');
        $general_success_title = LanguagesHelper::getInstance()->getLangLabel('general_success_title');
        $account_acctivated_info = LanguagesHelper::getInstance()->getLangLabel('account_acctivated_info');

        ?>
        <div class="absolute inset-0 w-full h-full top-0 left-0 z-10 flex items-center justify-center hidden p-4 white-popup success-ui">
            <div class="absolute inset-0 w-full h-full top-0 left-0 z-10 bg-black/20 flex items-center justify-center p-4 white-popup pupup-background-ui">
            </div>
            
            <div class="bg-white z-20 rounded-2xl w-full max-w-md md:max-w-lg lg:max-w-md xl:max-w-sm max-h-full shadow-lg flex flex-col opacity-0 transition-opacity duration-150 popup-content">
                <div class="relative flex items-center justify-center px-4 py-3 border-b">
                    <h2 class="text-xl font-semibold text-gray-600"><?php echo esc_html($general_success_title) ?></h2>
                    
                    <a href="#" class="text-gray-600 absolute right-6 text-clack text-xl leading-none close-btn">
                        <img class="w-[20px]" src="<?php echo esc_url(OXYLEAF_APP_PUBLIC_URL . '/app/Views/Frontend/assets/img/close-black.svg'); ?>" alt="">
                    </a>
                </div>
                
                <div class="overflow-y-auto px-6 py-4 text-gray-600" style="max-height: 70vh;">
                    <div class="form-success">
                        <div class="p-4 mb-4 text-sm text-green-800 border border-green-300 rounded-lg bg-green-50" role="alert">
                            <?php echo esc_html($account_acctivated_info) ?>
                        </div>

                        <div class="my-6 flex justify-center items-center text-sm">
                            <strong><a class="app-default-link" href="#<?php echo esc_attr($routes['login']['hash'] ?? '') ?>"><?php echo esc_html($back_to_login) ?></a></strong>
                        </div>
                    </div>


                </div>
            </div>

        </div>


        <?php
    }
}