<?php

namespace VulnTitan\Admin\Pages;

class Dashboard extends TemplateParts
{
    public static function render() { ?>
        <div class="wrap vulntitan-wrapper vulntitan-wrapper--dashboard">
            <div class="vulntitan-layout">
                <div class="vulntitan-main">
                    <?php self::header(); ?>

                    <div class="vulntitan-dashboard-section-wrapper vulntitan-elite-dashboard">
                        <section class="vulntitan-elite-hero">
                            <div class="vulntitan-elite-hero-content">
                                <span class="vulntitan-elite-kicker"><?php esc_html_e('Security Command Center', 'vulntitan'); ?></span>
                                <h2 class="vulntitan-elite-title"><?php esc_html_e('Elite Threat Scanner', 'vulntitan'); ?></h2>
                                <p class="vulntitan-elite-subtitle">
                                    <?php esc_html_e('Run precision scans across your WordPress stack with real-time intelligence, forensic previews, and safe remediation workflows.', 'vulntitan'); ?>
                                </p>
                                <div class="vulntitan-elite-metrics">
                                    <span class="vulntitan-metric-pill"><?php esc_html_e('Realtime Intelligence', 'vulntitan'); ?></span>
                                    <span class="vulntitan-metric-pill"><?php esc_html_e('Safe Fix Engine', 'vulntitan'); ?></span>
                                    <span class="vulntitan-metric-pill"><?php esc_html_e('Integrity Baselines', 'vulntitan'); ?></span>
                                </div>
                            </div>
                            <div class="vulntitan-elite-hero-panel">
                                <div class="vulntitan-panel-title"><?php esc_html_e('Scanner Status', 'vulntitan'); ?></div>
                                <div class="vulntitan-elite-status">
                                    <span class="vulntitan-status-pill is-ready"><?php esc_html_e('Ready', 'vulntitan'); ?></span>
                                    <span class="vulntitan-status-meta"><?php esc_html_e('Engine: VulnTitan', 'vulntitan'); ?></span>
                                </div>
                                <div class="vulntitan-elite-status-grid">
                                    <div class="vulntitan-status-card">
                                        <div class="vulntitan-status-label"><?php esc_html_e('Detection Layers', 'vulntitan'); ?></div>
                                        <div class="vulntitan-status-value"><?php esc_html_e('Malware, Vulnerabilities, Integrity', 'vulntitan'); ?></div>
                                    </div>
                                    <div class="vulntitan-status-card">
                                        <div class="vulntitan-status-label"><?php esc_html_e('Coverage', 'vulntitan'); ?></div>
                                        <div class="vulntitan-status-value"><?php esc_html_e('Core, Plugins, Themes', 'vulntitan'); ?></div>
                                    </div>
                                    <div class="vulntitan-status-card">
                                        <div class="vulntitan-status-label"><?php esc_html_e('Workflow', 'vulntitan'); ?></div>
                                        <div class="vulntitan-status-value"><?php esc_html_e('Scan -> Review -> Resolve', 'vulntitan'); ?></div>
                                    </div>
                                </div>
                            </div>
                        </section>

                        <section class="vulntitan-elite-scan-grid">
                            <article class="vulntitan-dashboard-card vulntitan-scan-card">
                                <div class="vulntitan-scan-card-head">
                                    <div class="vulntitan-card-icon">
                                        <img src="<?php echo esc_url( VULNTITAN_PLUGIN_URL ); ?>/assets/img/vulnerability-icon.png" alt="">
                                    </div>
                                    <div class="vulntitan-scan-card-head-text">
                                        <h3 class="vulntitan-scan-card-title"><?php esc_html_e('Vulnerability', 'vulntitan'); ?></h3>
                                        <div class="vulntitan-scan-card-meta"><?php esc_html_e('Realtime threat intelligence', 'vulntitan'); ?></div>
                                    </div>
                                    <span class="vulntitan-scan-chip"><?php esc_html_e('Coverage: Full Stack', 'vulntitan'); ?></span>
                                </div>

                                <p class="vulntitan-scan-card-desc">
                                    <?php esc_html_e('Detects known vulnerabilities in installed plugins, themes, and core by comparing against live intelligence feeds.', 'vulntitan'); ?>
                                </p>

                                <div class="vulntitan-scan-card-actions">
                                    <button type="button" class="vulntitan-scan-button" id="vulntitan-start-vulnerability-scan">
                                        <?php esc_html_e('Start Scan', 'vulntitan'); ?>
                                    </button>
                                </div>
                            </article>

                            <article class="vulntitan-dashboard-card vulntitan-scan-card vulntitan-scan-card--accent">
                                <div class="vulntitan-scan-card-head">
                                    <div class="vulntitan-card-icon">
                                        <img src="<?php echo esc_url( VULNTITAN_PLUGIN_URL ); ?>/assets/img/malware-icon.png" alt="">
                                    </div>
                                    <div class="vulntitan-scan-card-head-text">
                                        <h3 class="vulntitan-scan-card-title"><?php esc_html_e('Malware', 'vulntitan'); ?></h3>
                                        <div class="vulntitan-scan-card-meta"><?php esc_html_e('Behavioral + signature analysis', 'vulntitan'); ?></div>
                                    </div>
                                    <span class="vulntitan-scan-chip"><?php esc_html_e('Signal: High', 'vulntitan'); ?></span>
                                </div>

                                <p class="vulntitan-scan-card-desc">
                                    <?php esc_html_e('Scans your WordPress files for malicious patterns, obfuscated payloads, and backdoor behaviors.', 'vulntitan'); ?>
                                </p>

                                <div class="vulntitan-scan-card-actions">
                                    <button type="button" class="vulntitan-scan-button" id="vulntitan-start-malware-scan">
                                        <?php esc_html_e('Start Scan', 'vulntitan'); ?>
                                    </button>
                                </div>
                            </article>

                            <article class="vulntitan-dashboard-card vulntitan-scan-card">
                                <div class="vulntitan-scan-card-head">
                                    <div class="vulntitan-card-icon">
                                        <img src="<?php echo esc_url( VULNTITAN_PLUGIN_URL ); ?>/assets/img/integrity-icon.png" alt="">
                                    </div>
                                    <div class="vulntitan-scan-card-head-text">
                                        <h3 class="vulntitan-scan-card-title"><?php esc_html_e('Integrity', 'vulntitan'); ?></h3>
                                        <div class="vulntitan-scan-card-meta"><?php esc_html_e('Baseline verification', 'vulntitan'); ?></div>
                                    </div>
                                    <span class="vulntitan-scan-chip"><?php esc_html_e('Zero Trust', 'vulntitan'); ?></span>
                                </div>

                                <p class="vulntitan-scan-card-desc">
                                    <?php esc_html_e('Verifies core, plugin, and theme files against trusted baselines and official checksums.', 'vulntitan'); ?>
                                </p>

                                <div class="vulntitan-scan-card-actions">
                                    <button type="button" class="vulntitan-scan-button" id="vulntitan-start-integrity-scan">
                                        <?php esc_html_e('Start Scan', 'vulntitan'); ?>
                                    </button>
                                </div>
                            </article>
                        </section>

                        <section class="vulntitan-elite-output">
                            <div id="vulntitan-scan-progress-bar-container" class="vulntitan-panel vulntitan-panel--progress is-hidden">
                                <div class="vulntitan-panel-title"><?php esc_html_e('Scan Progress', 'vulntitan'); ?></div>
                                <div id="vulntitan-scan-progress">
                                    <div id="vulntitan-scan-progress-bar"></div>
                                    <span id="vulntitan-scan-progress-text">0%</span>
                                </div>
                                <div class="vulntitan-scan-progress-actions">
                                    <button type="button" class="vulntitan-scan-control-btn" id="vulntitan-stop-vulnerability-scan" disabled>
                                        <?php esc_html_e('Stop scan', 'vulntitan'); ?>
                                    </button>
                                    <button type="button" class="vulntitan-scan-control-btn" id="vulntitan-retry-vulnerability-failed" disabled>
                                        <?php esc_html_e('Retry failed', 'vulntitan'); ?>
                                    </button>
                                </div>
                                <div id="vulntitan-scan-progress-note" class="vulntitan-scan-progress-note" aria-live="polite"></div>
                            </div>

                            <div id="vulntitan-integrity-legend-container" class="vulntitan-panel vulntitan-panel--legend is-hidden">
                                <div class="vulntitan-panel-title"><?php esc_html_e('Integrity Status Legend', 'vulntitan'); ?></div>
                                <div class="vulntitan-panel-subtitle">
                                    <?php esc_html_e('Quick guide: each status color explains what the scanner found for that file.', 'vulntitan'); ?>
                                </div>
                                <div id="vulntitan-integrity-legend-grid" class="vulntitan-integrity-legend-grid">
                                    <div class="vulntitan-integrity-legend-item">
                                        <span class="vulntitan-integrity-legend-dot" style="background:#10b981;"></span>
                                        <span class="vulntitan-integrity-legend-text"><strong>OK</strong> - <?php esc_html_e('File hash matches expected baseline/checksum.', 'vulntitan'); ?></span>
                                    </div>
                                    <div class="vulntitan-integrity-legend-item">
                                        <span class="vulntitan-integrity-legend-dot" style="background:#f59e0b;"></span>
                                        <span class="vulntitan-integrity-legend-text"><strong>MODIFIED</strong> - <?php esc_html_e('File exists, but hash differs from expected value.', 'vulntitan'); ?></span>
                                    </div>
                                    <div class="vulntitan-integrity-legend-item">
                                        <span class="vulntitan-integrity-legend-dot" style="background:#ef4444;"></span>
                                        <span class="vulntitan-integrity-legend-text"><strong>MISSING</strong> - <?php esc_html_e('File is expected but not present on disk.', 'vulntitan'); ?></span>
                                    </div>
                                    <div class="vulntitan-integrity-legend-item">
                                        <span class="vulntitan-integrity-legend-dot" style="background:#38bdf8;"></span>
                                        <span class="vulntitan-integrity-legend-text"><strong>UNEXPECTED</strong> - <?php esc_html_e('File was found, but no expected hash exists in baseline/checksum.', 'vulntitan'); ?></span>
                                    </div>
                                </div>
                                <div id="vulntitan-integrity-legend-extra" class="vulntitan-integrity-legend-extra">
                                    <span class="vulntitan-integrity-legend-dot" style="background:#a78bfa;"></span>
                                    <span class="vulntitan-integrity-legend-text"><strong>ERROR</strong> - <?php esc_html_e('Scanner could not process this file due to a runtime/read issue.', 'vulntitan'); ?></span>
                                </div>
                            </div>

                            <div id="vulntitan-malware-overview-container" class="vulntitan-panel is-hidden">
                                <div id="vulntitan-malware-overview-content"></div>
                            </div>

                            <div id="vulntitan-vuln-overview-container" class="vulntitan-panel vulntitan-panel--vuln-overview is-hidden">
                                <div id="vulntitan-vuln-overview-content"></div>
                            </div>

                            <div id="vulntitan-malware-problematic-container" class="vulntitan-panel vulntitan-panel--danger is-hidden">
                                <div class="vulntitan-panel-title is-danger">
                                    <?php esc_html_e('Problematic Malware Files', 'vulntitan'); ?>
                                </div>
                                <div class="vulntitan-panel-subtitle">
                                    <?php esc_html_e('Review infected files and inspect suspicious code preview before taking action.', 'vulntitan'); ?>
                                </div>
                                <div id="vulntitan-malware-problematic-summary" class="vulntitan-panel-summary"></div>
                                <div id="vulntitan-malware-problematic-list" class="vulntitan-panel-grid"></div>
                            </div>

                            <div id="vulntitan-scan-results-container" class="vulntitan-panel vulntitan-panel--results is-hidden">
                                <div class="vulntitan-panel-title"><?php esc_html_e('Scan Output', 'vulntitan'); ?></div>
                                <div id="vulntitan-scan-results"></div>
                            </div>

                            <div id="vulntitan-integrity-problematic-container" class="vulntitan-panel vulntitan-panel--danger is-hidden">
                                <div class="vulntitan-panel-title is-danger">
                                    <?php esc_html_e('Problematic Integrity Files', 'vulntitan'); ?>
                                </div>
                                <div class="vulntitan-panel-subtitle">
                                    <?php esc_html_e('Files listed below require review because they differ from expected integrity state.', 'vulntitan'); ?>
                                </div>
                                <div id="vulntitan-integrity-problematic-summary" class="vulntitan-panel-summary"></div>
                                <div id="vulntitan-integrity-problematic-list" class="vulntitan-panel-grid is-scrollable"></div>
                            </div>

                            <div id="vulntitan-integrity-next-steps-container" class="vulntitan-panel vulntitan-panel--info is-hidden">
                                <div class="vulntitan-panel-title is-info">
                                    <?php esc_html_e('Recommended Next Steps', 'vulntitan'); ?>
                                </div>
                                <div class="vulntitan-panel-subtitle">
                                    <?php esc_html_e('Follow these actions before deleting or replacing files.', 'vulntitan'); ?>
                                </div>
                                <ol id="vulntitan-integrity-next-steps-list" class="vulntitan-panel-list"></ol>
                            </div>
                        </section>
                    </div>
                </div>
            </div>
            <?php self::footer(); ?>
        </div>
       <?php
    }
}
