<?xml version="1.0" encoding="utf-8"?>
<odoo>

    <!-- ================================================================== -->
    <!--  Fino Luxury B2B Header                                            -->
    <!--  Mirrors the .topbar design from Website/index.html                 -->
    <!--  Selectable in the website editor alongside Default / Stretch / etc. -->
    <!-- ================================================================== -->
    <template id="template_header_fino"
              inherit_id="website.layout"
              name="Template Header Fino"
              active="False">

        <xpath expr="//header//nav" position="replace">

            <t t-call="website.navbar">
                <!--
                    _navbar_classes: d-none d-lg-block hides the desktop bar
                    on mobile (mobile fallback rendered by template_header_mobile below).
                    o_fino_navbar is our custom hook for SCSS.
                -->
                <t t-set="_navbar_classes" t-valuef="d-none d-lg-block shadow-sm o_fino_navbar"/>

                <div id="o_main_nav" class="o_main_nav o_fino_nav_inner">

                    <!-- ── Left: brand logo + portal label ───────────────── -->
                    <div class="o_fino_brand_wrap">
                        <t t-call="website.placeholder_header_brand">
                            <t t-set="_link_class" t-valuef="o_fino_brand_link"/>
                        </t>
                        <span class="o_fino_portal_label">B2B<br/>Partner Portal</span>
                    </div>

                    <!-- ── Centre: website menu items ────────────────────── -->
                    <t t-call="website.navbar_nav">
                        <t t-set="_nav_class" t-valuef="ms-auto o_fino_nav_links"/>

                        <t t-foreach="website.menu_id.child_id" t-as="submenu">
                            <t t-call="website.submenu">
                                <t t-set="item_class" t-valuef="nav-item"/>
                                <t t-set="link_class" t-valuef="nav-link o_fino_nav_link"/>
                            </t>
                        </t>
                    </t>

                    <!-- ── Right: language + sign-in / user dropdown ─────── -->
                    <ul class="navbar-nav align-items-center gap-3 flex-shrink-0 ms-3 o_fino_nav_actions">

                        <!-- Language selector (hidden when only one language) -->
                        <t t-call="website.placeholder_header_language_selector">
                            <t t-set="_btn_class" t-valuef="nav-link o_fino_nav_link px-0"/>
                            <t t-set="_dropdown_menu_class" t-valuef="dropdown-menu-end"/>
                        </t>

                        <!-- Sign In (shown when logged-out) -->
                        <t t-call="portal.placeholder_user_sign_in">
                            <t t-set="_link_class" t-valuef="o_fino_btn_signin"/>
                        </t>

                        <!-- User dropdown (shown when logged-in) -->
                        <t t-call="portal.user_dropdown">
                            <t t-set="_user_name" t-value="True"/>
                            <t t-set="_item_class" t-valuef="dropdown"/>
                            <t t-set="_link_class" t-valuef="nav-link border-0 o_fino_nav_link"/>
                            <t t-set="_dropdown_menu_class" t-valuef="dropdown-menu-end"/>
                        </t>

                    </ul>

                </div>
            </t>

            <!-- Mobile header (Odoo standard offcanvas) -->
            <t t-call="website.template_header_mobile"/>

        </xpath>
    </template>

</odoo>
