<!doctype html>

<html>

<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>PHPJabbers - Setup</title>

    <link rel="icon" href="<?php echo PJ_INSTALL_URL;?>app/web/img/favicons/favicon.svg" type="image/svg+xml">

    <link rel="icon" href="<?php echo PJ_INSTALL_URL;?>app/web/img/favicons/favicon-32x32.png" type="image/png" sizes="32x32">

    <link rel="shortcut icon" href="<?php echo PJ_INSTALL_URL;?>app/web/img/favicons/favicon.ico">

    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">

    <link rel="stylesheet" href="<?php echo PJ_INSTALL_URL . PJ_CSS_PATH; ?>admin-datagrid-listings.css?v=2">

    <?php

    foreach ($controller->getCss() as $css) {

        if ($css['file'] === 'admin-datagrid-listings.css') { continue; } // already linked above (versioned)

        echo '<link rel="stylesheet" href="' . (isset($css['remote']) && $css['remote'] ? '' : PJ_INSTALL_URL) . $css['path'] . $css['file'] . '">' . "\n";

    }

    ?>

    <style>

    /* Theme from admin-datagrid-listings.css (--admin-primary, --pj-primary, …) */

    :root {

        --pj-bg: #f3f3f4;

        --pj-card-bg: #ffffff;

        --pj-radius: 16px;

        --pj-success: var(--admin-success, #22c55e);

        --pj-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);

        --pj-shadow-hover: 0 12px 32px rgba(249, 115, 22, 0.12);

    }

    * { box-sizing: border-box; margin: 0; padding: 0; }

    body {

        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

        background: var(--pj-bg);

        color: var(--pj-text);

        min-height: 100vh;

        display: flex;

        align-items: center;

        justify-content: center;

        padding: 24px 16px;

    }

    .pj-setup { max-width: 920px; width: 100%; }

    .pj-setup-brand-wrap {
        text-align: center;
        padding: 20px 32px 0;
    }

    .pj-setup-brand {
        display: inline-block;
        font-size: 14px;
        font-weight: 700;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        color: var(--pj-text-muted, #636e72);
        text-decoration: none;
    }

    .pj-setup-brand:hover {
        color: var(--pj-primary, #c2570c);
    }

    .pj-setup-shell {

        background: var(--pj-card-bg);

        border-radius: 20px;

        box-shadow: var(--pj-shadow);

        border: 1px solid var(--pj-border, #e8e8e8);

        overflow: hidden;

    }



    /* Stepper */

    .pj-setup-stepper {

        display: flex;

        align-items: flex-start;

        justify-content: center;

        padding: 28px 32px 24px;

        background: linear-gradient(180deg, var(--admin-primary-lighter, var(--pj-primary-light)) 0%, var(--pj-card-bg) 100%);

        border-bottom: 1px solid var(--pj-border, #e8e8e8);

        gap: 0;

    }

    .pj-step {

        display: flex;

        flex-direction: column;

        align-items: center;

        gap: 8px;

        min-width: 72px;

        flex-shrink: 0;

    }

    .pj-step-circle {

        width: 40px;

        height: 40px;

        border-radius: 50%;

        display: flex;

        align-items: center;

        justify-content: center;

        font-size: 15px;

        font-weight: 700;

        background: var(--pj-card-bg);

        border: 2px solid var(--pj-border, #dde1e4);

        color: var(--pj-text-muted);

        transition: all 0.3s ease;

    }

    .pj-step-label {

        font-size: 12px;

        font-weight: 600;

        color: var(--pj-text-muted);

        text-align: center;

        max-width: 80px;

        line-height: 1.3;

        transition: color 0.3s ease;

    }

    .pj-step-label:empty,
    .pj-step-label[aria-hidden="true"] {
        display: none;
    }

    .pj-setup-header {
        text-align: center;
        margin-bottom: 28px;
    }

    .pj-step-line {

        flex: 1;

        min-width: 24px;

        max-width: 64px;

        height: 2px;

        background: var(--pj-border, #dde1e4);

        margin-top: 19px;

        transition: background 0.3s ease;

    }

    .pj-step--active .pj-step-circle {

        background: var(--pj-primary);

        border-color: var(--pj-primary);

        color: #fff;

        box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);

    }

    .pj-step--active .pj-step-label { color: var(--pj-primary); }

    .pj-step--done .pj-step-circle {

        background: var(--pj-primary);

        border-color: var(--pj-primary);

        color: #fff;

    }

    .pj-step--done .pj-step-circle::after {

        content: '';

        width: 14px;

        height: 8px;

        border-left: 2.5px solid #fff;

        border-bottom: 2.5px solid #fff;

        transform: rotate(-45deg) translateY(-1px);

        margin-top: -2px;

    }

    .pj-step--done .pj-step-circle { font-size: 0; }

    .pj-step--done .pj-step-label { color: var(--pj-text); }

    .pj-step-line--done { background: var(--pj-primary); }



    /* Panel — single screen */

    .pj-setup-panel { padding: 36px 40px 40px; min-height: 420px; position: relative; }

    .pj-setup-main { transition: opacity 0.25s ease; }

    .pj-setup-main--busy { opacity: 0.35; pointer-events: none; }

    .pj-setup-overlay {
        position: absolute;
        inset: 0;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 40px;
        background: rgba(255, 255, 255, 0.92);
        z-index: 10;
        text-align: center;
    }

    .pj-setup-overlay--visible { display: flex; }

    .pj-setup-overlay-view { width: 100%; max-width: 400px; }

    .pj-setup-overlay-view[hidden] { display: none !important; }

    @keyframes pj-fade-in {

        from { opacity: 0; transform: translateY(8px); }

        to { opacity: 1; transform: translateY(0); }

    }

    .pj-setup-step-head { text-align: center; margin-bottom: 28px; }

    .pj-setup-step-head--compact { margin-bottom: 20px; }

    .pj-setup-step-icon {

        width: 64px; height: 64px; border-radius: 16px;

        background: var(--admin-primary-lighter, var(--pj-primary-light));

        color: var(--pj-primary);

        display: flex; align-items: center; justify-content: center;

        margin: 0 auto 20px;

    }

    .pj-setup-title { font-size: 26px; font-weight: 800; margin-bottom: 10px; color: var(--pj-text); }

    .pj-setup-step-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; color: var(--pj-text); }

    .pj-setup-subtitle { font-size: 15px; color: var(--pj-text-muted); max-width: 520px; margin: 0 auto; line-height: 1.65; }

    .pj-setup-highlights {

        list-style: none; max-width: 480px; margin: 0 auto; padding: 0;

    }

    .pj-setup-highlights li {

        font-size: 14px; padding: 12px 16px; margin-bottom: 10px;

        background: var(--admin-primary-lighter, var(--pj-primary-light));

        border-radius: 12px; color: var(--pj-text);

        display: flex; align-items: flex-start; gap: 12px; line-height: 1.5;

    }

    .pj-setup-highlights li::before {

        content: ''; width: 8px; height: 8px; border-radius: 50%;

        background: var(--pj-primary); flex-shrink: 0; margin-top: 6px;

    }



    /* Choice cards */

    .pj-setup-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

    @media (max-width: 700px) {

        .pj-setup-stepper { padding: 20px 16px; flex-wrap: wrap; gap: 8px; }

        .pj-step-line { display: none; }

        .pj-setup-panel { padding: 24px 20px; }

        .pj-setup-cards { grid-template-columns: 1fr; }

        .pj-setup-title { font-size: 22px; }

    }

    .pj-setup-card {

        background: var(--pj-card-bg);

        border: 2px solid var(--pj-border, #e8e8e8);

        border-radius: var(--pj-radius);

        padding: 24px 22px;

        transition: all 0.25s ease;

        position: relative;

    }

    .pj-setup-card:hover { border-color: var(--pj-primary); box-shadow: var(--pj-shadow-hover); }

    .pj-setup-card.pj-card--demo { border-color: var(--pj-primary); }

    .pj-card-icon {

        width: 52px; height: 52px; border-radius: 14px;

        display: flex; align-items: center; justify-content: center; margin-bottom: 16px;

    }

    .pj-card--demo .pj-card-icon { background: var(--admin-primary-lighter, var(--pj-primary-light)); color: var(--pj-primary); }

    .pj-card--empty .pj-card-icon { background: #f3f4f6; color: var(--pj-text-muted); }

    .pj-card-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }

    .pj-card-desc { font-size: 13px; color: var(--pj-text-muted); line-height: 1.55; margin-bottom: 12px; }

    .pj-card-features { list-style: none; padding: 0; margin: 0; }

    .pj-card-features li {

        font-size: 12px; padding: 3px 0; display: flex; align-items: center; gap: 8px;

    }

    .pj-card-features li::before {

        content: ''; width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;

        background: var(--pj-success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center no-repeat;

    }

    .pj-card-badge {

        display: inline-block; font-size: 10px; font-weight: 600; color: #fff;

        background: var(--pj-primary); padding: 3px 10px; border-radius: 20px; margin-bottom: 12px;

    }



    /* Footer nav */

    .pj-setup-nav {

        display: flex;

        align-items: center;

        justify-content: space-between;

        gap: 16px;

        padding: 20px 40px 28px;

        border-top: 1px solid var(--pj-border, #e8e8e8);

        background: #fafafa;

    }

    .pj-setup-nav.pj-setup-nav--hidden { display: none; }

    .pj-setup-nav-continue { margin-left: auto; min-width: 160px; }

    .pj-setup-btn {

        padding: 13px 28px; border: none; border-radius: 50px;

        font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;

        transition: all 0.2s ease;

    }

    .pj-setup-btn--primary { background: var(--pj-primary); color: #fff; }

    .pj-setup-btn--primary:hover { background: var(--pj-primary-dark); }

    .pj-setup-btn--secondary {
        background: #fff;
        color: var(--pj-text);
        border: 2px solid var(--pj-border, #dde1e4);
    }

    .pj-setup-btn--secondary:hover {
        border-color: var(--pj-primary);
        color: var(--pj-primary);
    }

    .pj-setup-btn--block {
        display: block;
        width: 100%;
        margin-top: 16px;
        text-align: center;
    }

    .pj-setup-btn--ghost {

        background: transparent; color: var(--pj-text-muted);

        border: 2px solid var(--pj-border, #dde1e4);

    }

    .pj-setup-btn--ghost:hover { border-color: var(--pj-primary); color: var(--pj-primary); }

    .pj-setup-btn:disabled { opacity: 0.55; cursor: not-allowed; }



    /* Loading & success */

    .pj-spinner {

        width: 48px; height: 48px; border: 4px solid var(--admin-primary-lighter, var(--pj-primary-light));

        border-top-color: var(--pj-primary); border-radius: 50%;

        animation: pj-spin 0.8s linear infinite; margin: 0 auto 20px;

    }

    @keyframes pj-spin { to { transform: rotate(360deg); } }

    .pj-setup-loading-text { font-size: 17px; font-weight: 600; margin-bottom: 8px; color: var(--pj-text); }

    .pj-setup-loading-sub { font-size: 14px; color: var(--pj-text-muted); }

    .pj-progress-bar {

        width: 100%; max-width: 320px; height: 6px;

        background: var(--admin-primary-lighter, var(--pj-primary-light));

        border-radius: 3px; margin: 20px auto 0; overflow: hidden;

    }

    .pj-progress-bar-fill { height: 100%; background: var(--pj-primary); width: 0%; transition: width 0.5s ease; }

    .pj-success-icon {

        width: 72px; height: 72px; border-radius: 50%; background: var(--pj-success);

        display: flex; align-items: center; justify-content: center; margin: 0 auto 24px;

    }

    .pj-success-icon svg { width: 36px; height: 36px; stroke: #fff; }

    .pj-setup-check-icon { color: var(--pj-primary); margin-right: 8px; }

    .pj-setup-admin-spinner { font-size: 24px; color: var(--pj-primary); margin-bottom: 15px; }

    </style>

</head>

<body>

    <?php require $content_tpl; ?>

    <?php

    foreach ($controller->getJs() as $js) {

        echo '<script src="' . (isset($js['remote']) && $js['remote'] ? '' : PJ_INSTALL_URL) . $js['path'] . $js['file'] . '"></script>' . "\n";

    }

    ?>

</body>

</html>

