<?php
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
defined( 'ABSPATH' ) || exit;
?>
<div class="wrap naseo-wrap">
    <h1>📋 <?php esc_html_e( 'Логи', 'nemynai-seo-autopilot' ); ?></h1>

    <button id="naseo-clear-logs" class="naseo-btn naseo-btn--danger" style="margin-bottom:16px;">
        🗑 <?php esc_html_e( 'Очистити логи', 'nemynai-seo-autopilot' ); ?>
    </button>

    <?php if ( empty( $logs ) ) : ?>
    <p><?php esc_html_e( 'Логів немає.', 'nemynai-seo-autopilot' ); ?></p>
    <?php else : ?>
    <table class="wp-list-table widefat fixed striped">
        <thead>
            <tr>
                <th width="160"><?php esc_html_e( 'Час', 'nemynai-seo-autopilot' ); ?></th>
                <th width="80"><?php esc_html_e( 'Тип', 'nemynai-seo-autopilot' ); ?></th>
                <th><?php esc_html_e( 'Повідомлення', 'nemynai-seo-autopilot' ); ?></th>
            </tr>
        </thead>
        <tbody>
        <?php foreach ( $logs as $log ) : ?>
            <tr>
                <td><?php echo esc_html( $log['time'] ); ?></td>
                <td><span class="naseo-status naseo-status--<?php echo esc_attr( $log['type'] ); ?>"><?php echo esc_html( $log['type'] ); ?></span></td>
                <td><?php echo esc_html( $log['message'] ); ?></td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
    <?php endif; ?>
</div>
