<header class="neurogenesis-theme-admin-header">
    <div class="neurogenesis-theme-admin-header__brand">
        <img
            src="<?php echo esc_url( neurogenesis_theme_admin_icon_url( 'neurogenesis-styler-logo.svg' ) ); ?>"
            alt=""
            class="neurogenesis-theme-admin-header__logo"
            width="30"
            height="30"
            decoding="async" />
        <div class="neurogenesis-theme-admin-header__brand-text">
            <span class="neurogenesis-theme-admin-header__brand-title">
                <?php esc_html_e( 'Thinko', 'thinko' ); ?>
            </span>
            <span class="neurogenesis-theme-admin-header__brand-subtitle">
                <?php esc_html_e( 'Theme Admin', 'thinko' ); ?>
            </span>
        </div>
    </div>

    <nav class="neurogenesis-theme-admin-header__nav" aria-label="<?php esc_attr_e( 'Thinko navigation', 'thinko' ); ?>">
        <?php
        $neurogenesis_theme_header_tabs = ( isset( $tabs ) && is_array( $tabs ) )
            ? $tabs
            : NeurogenesisTheme\Controllers\Admin\PageTabs::general();
        ?>
        <?php foreach ( $neurogenesis_theme_header_tabs as $section => $tab ) : ?>
            <?php
            if ( ! is_array( $tab ) ) {
                continue;
            }
            $href        = isset( $tab['href'] ) ? $tab['href'] : neurogenesis_theme_generate_page_url( $section );
            $is_external = ! empty( $tab['external'] );
            $is_active   = ! isset( $tab['href'] ) && neurogenesis_theme_active_page( $section );
            $link_class  = 'neurogenesis-theme-admin-header__nav-link';
            if ( $is_active ) {
                $link_class .= ' neurogenesis-theme-admin-header__nav-link--active';
            }
            $icon = isset( $tab['icon'] ) ? (string) $tab['icon'] : '';
            ?>
            <a
                href="<?php echo esc_url( $href ); ?>"
                class="<?php echo esc_attr( $link_class ); ?>"
                <?php echo $is_external ? ' target="_blank" rel="noopener noreferrer"' : ''; ?>>
                <span class="neurogenesis-theme-admin-header__nav-icon">
                    <?php echo neurogenesis_theme_svg_icon( $icon ); ?>
                </span>
                <span><?php echo esc_html( (string) ( $tab['title'] ?? $section ) ); ?></span>
            </a>
        <?php endforeach; ?>
    </nav>

    <div class="neurogenesis-theme-admin-header__status">
        <span class="neurogenesis-theme-admin-header__pill neurogenesis-theme-admin-header__pill--version">
            <span class="neurogenesis-theme-admin-header__pill-icon">
                <?php echo neurogenesis_theme_svg_icon( 'branch' ); ?>
            </span>
            v<?php echo esc_html( NEUROGENESIS_THEME_THEME_VERSION ); ?>
        </span>
        <?php if ( NeurogenesisTheme\QuickSetup\QuickSetup::license_is_enabled() && NeurogenesisTheme\QuickSetup\QuickSetup::license_is_active() ) : ?>
            <span class="neurogenesis-theme-admin-header__pill neurogenesis-theme-admin-header__pill--license">
                <span class="neurogenesis-theme-admin-header__pill-icon">
                    <?php echo neurogenesis_theme_svg_icon( 'shield-check' ); ?>
                </span>
                <?php esc_html_e( 'License Active', 'thinko' ); ?>
            </span>
        <?php endif; ?>
        <span class="neurogenesis-theme-admin-header__pill neurogenesis-theme-admin-header__pill--wp">
            <span class="neurogenesis-theme-admin-header__pill-icon">
                <?php echo neurogenesis_theme_svg_icon( 'globe' ); ?>
            </span>
            <?php esc_html_e( 'WP 7 Ready', 'thinko' ); ?>
        </span>
    </div>
</header>
