<?php
/**
 * Finances Sidebar Navigation
 * 
 * Shared navigation partial for all Finances sub-pages.
 * Include this at the top of each Finances view, inside <div class="wrap fs-wrap">.
 * Close with </div></div> at the end of the view (for fs-settings-content and fs-settings-layout).
 *
 * @package Freelance_Studio
 */

if (!defined('ABSPATH')) {
    exit;
}

$finance_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'invoices';

// Recurring invoices PRO badge
$recurring_label = esc_html__('Recurring Invoices', 'freelance-studio');
$recurring_is_pro = function_exists('fs_studio_is_free_plan') && fs_studio_is_free_plan();
?>

<!-- Mobile Tab Dropdown Navigation (auto-converted by JS) -->
<div class="fs-tab-nav fs-finances-tab-nav fs-mobile-only">
    <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=invoices')); ?>" class="fs-tab <?php echo esc_attr($finance_tab === 'invoices' ? 'active' : ''); ?>">
        <?php esc_html_e('Invoices', 'freelance-studio'); ?>
    </a>
    <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=recurring')); ?>" class="fs-tab <?php echo esc_attr($finance_tab === 'recurring' ? 'active' : ''); ?>">
        <?php echo $recurring_is_pro ? wp_kses_post($recurring_label . ' <span class="fs-pro-badge-sm">PRO</span>') : esc_html($recurring_label); ?>
    </a>
    <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=income')); ?>" class="fs-tab <?php echo esc_attr($finance_tab === 'income' ? 'active' : ''); ?>">
        <?php esc_html_e('Other Income', 'freelance-studio'); ?>
    </a>
    <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=expenses')); ?>" class="fs-tab <?php echo esc_attr($finance_tab === 'expenses' ? 'active' : ''); ?>">
        <?php esc_html_e('Expenses', 'freelance-studio'); ?>
    </a>
    <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=reporting')); ?>" class="fs-tab <?php echo esc_attr($finance_tab === 'reporting' ? 'active' : ''); ?>">
        <?php esc_html_e('Reporting', 'freelance-studio'); ?>
    </a>
    <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=tax')); ?>" class="fs-tab <?php echo esc_attr($finance_tab === 'tax' ? 'active' : ''); ?>">
        <?php esc_html_e('Tax', 'freelance-studio'); ?>
    </a>
    <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=transactions')); ?>" class="fs-tab <?php echo esc_attr($finance_tab === 'transactions' ? 'active' : ''); ?>">
        <?php esc_html_e('Bank Transactions', 'freelance-studio'); ?>
    </a>
</div>

<!-- Vertical Tab Layout (same as Settings/Bookings) -->
<div class="fs-settings-layout">
    <nav class="fs-settings-sidebar">
        <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=invoices')); ?>" class="fs-settings-nav-item <?php echo esc_attr($finance_tab === 'invoices' ? 'active' : ''); ?>">
            <span class="dashicons dashicons-media-text"></span> <?php esc_html_e('Invoices', 'freelance-studio'); ?>
        </a>
        <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=recurring')); ?>" class="fs-settings-nav-item <?php echo esc_attr($finance_tab === 'recurring' ? 'active' : ''); ?>">
            <span class="dashicons dashicons-update"></span> <?php echo $recurring_is_pro ? wp_kses_post($recurring_label . ' <span class="fs-pro-badge-sm">PRO</span>') : esc_html($recurring_label); ?>
        </a>
        <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=income')); ?>" class="fs-settings-nav-item <?php echo esc_attr($finance_tab === 'income' ? 'active' : ''); ?>">
            <span class="dashicons dashicons-money-alt"></span> <?php esc_html_e('Other Income', 'freelance-studio'); ?>
        </a>

        <div class="fs-settings-nav-divider"></div>

        <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=expenses')); ?>" class="fs-settings-nav-item <?php echo esc_attr($finance_tab === 'expenses' ? 'active' : ''); ?>">
            <span class="dashicons dashicons-cart"></span> <?php esc_html_e('Expenses', 'freelance-studio'); ?>
        </a>

        <div class="fs-settings-nav-divider"></div>

        <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=reporting')); ?>" class="fs-settings-nav-item <?php echo esc_attr($finance_tab === 'reporting' ? 'active' : ''); ?>">
            <span class="dashicons dashicons-chart-bar"></span> <?php esc_html_e('Reporting', 'freelance-studio'); ?>
        </a>
        <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=tax')); ?>" class="fs-settings-nav-item <?php echo esc_attr($finance_tab === 'tax' ? 'active' : ''); ?>">
            <span class="dashicons dashicons-calculator"></span> <?php esc_html_e('Tax', 'freelance-studio'); ?>
        </a>

        <div class="fs-settings-nav-divider"></div>

        <a href="<?php echo esc_url(admin_url('admin.php?page=fs-finances&tab=transactions')); ?>" class="fs-settings-nav-item <?php echo esc_attr($finance_tab === 'transactions' ? 'active' : ''); ?>">
            <span class="dashicons dashicons-bank"></span> <?php esc_html_e('Bank Transactions', 'freelance-studio'); ?>
        </a>
    </nav>
    <div class="fs-settings-content">
