<?xml version="1.0" encoding="UTF-8"?>
<window>
    <defaultcontrol always="true">8001</defaultcontrol>
    <controls>
        <!-- Background -->
        <control type="image">
            <include>FullscreenDimensions</include>
            <texture colordiffuse="FF121212">special://home/addons/plugin.video.milionar/resources/media/white.png</texture>
        </control>
        
        <!-- Sidebar Background -->
        <control type="image">
            <left>0</left>
            <top>0</top>
            <width>400</width>
            <height>1080</height>
            <texture colordiffuse="FF1A1A1A">special://home/addons/plugin.video.milionar/resources/media/white.png</texture>
        </control>
        
        <!-- Sidebar Title -->
        <control type="label">
            <left>20</left>
            <top>40</top>
            <width>360</width>
            <height>40</height>
            <font>font14</font>
            <label>AI COMMAND CENTER</label>
            <textcolor>FFCCCCCC</textcolor>
        </control>
        
        <!-- Metadata Info (Top Right) -->
        <control type="group">
            <left>420</left>
            <top>20</top>
            <width>1480</width>
            <height>60</height>
            <control type="label">
                <left>0</left>
                <top>0</top>
                <width>1480</width>
                <height>30</height>
                <align>right</align>
                <label>$INFO[Window.Property(Provider)] :: $INFO[Window.Property(Model)] :: $INFO[Window.Property(Mode)]</label>
                <textcolor>FF666666</textcolor>
                <font>font12</font>
            </control>
        </control>

        <!-- Sidebar Menu (Top List) -->
        <control type="grouplist" id="9000">
            <left>0</left>
            <top>120</top>
            <width>400</width>
            <height>600</height> <!-- Reduced height for menu only -->
            <itemgap>0</itemgap>
            <!-- Navigation Links: Explicitly target edge items -->
            <onup>8002</onup>   <!-- Wrap to Bottom (Cancel) -->
            <ondown>8001</ondown> <!-- Jump to Top of Actions (Send) -->
            <orientation>vertical</orientation>


            <!-- 9002: Raw JSON -->
            <control type="button" id="9002">
                <width>400</width>
                <height>80</height>
                <font>font13</font>
                <label>  RAW JSON DATA</label>
                 <textcolor>FF888888</textcolor>
                <focusedcolor>FFFFFFFF</focusedcolor>
                <texturenofocus colordiffuse="00FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturenofocus>
                <texturefocus colordiffuse="10FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturefocus>
                <align>left</align>
                <aligny>center</aligny>
                <onclick>noop</onclick>
                <onright>7102</onright>
            </control>

            <!-- 9003: System Context -->
             <control type="button" id="9003">
                <width>400</width>
                <height>80</height>
                <font>font13</font>
                <label>  SYSTEM CONTEXT</label>
                 <textcolor>FF888888</textcolor>
                <focusedcolor>FFFFFFFF</focusedcolor>
                <texturenofocus colordiffuse="00FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturenofocus>
                <texturefocus colordiffuse="10FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturefocus>
                <align>left</align>
                <aligny>center</aligny>
                 <onclick>noop</onclick>
                 <onright>7103</onright>
            </control>

            <!-- 9004: Metrics -->
            <control type="button" id="9004">
                <width>400</width>
                <height>80</height>
                <font>font13</font>
                <label>  METRICS &amp; STATS</label>
                 <textcolor>FF888888</textcolor>
                <focusedcolor>FFFFFFFF</focusedcolor>
                <texturenofocus colordiffuse="00FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturenofocus>
                <texturefocus colordiffuse="10FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturefocus>
                <align>left</align>
                <aligny>center</aligny>
                 <onclick>noop</onclick>
            </control>
            
            <!-- 9005: Context Titles -->
            <control type="button" id="9005">
                <width>400</width>
                <height>80</height>
                <font>font13</font>
                <label>  CONTEXT TITLES</label>
                <textcolor>FF888888</textcolor>
                <focusedcolor>FFFFFFFF</focusedcolor>
                <texturenofocus colordiffuse="00FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturenofocus>
                <texturefocus colordiffuse="2000FF00">special://home/addons/plugin.video.milionar/resources/media/white.png</texturefocus> <!-- Green Glow -->
                <align>left</align>
                <aligny>center</aligny>
                <onright>7105</onright>
                 <onclick>noop</onclick>
            </control>
        </control>

        <!-- Spacer Gap Logic is handled by positioning the next grouplist at bottom -->

        <!-- Actions (Bottom List) -->
        <control type="grouplist" id="9999">
             <left>0</left>
             <top>900</top> <!-- Positioned to align at bottom -->
             <width>400</width>
             <height>180</height>
             <itemgap>0</itemgap>
             <orientation>vertical</orientation>
             <align>bottom</align>
             <!-- Navigation Links: Explicitly target edge items -->
             <onup>9005</onup>   <!-- Jump Back to Menu (Context Titles) -->
             <ondown>9002</ondown> <!-- Wrap to Top Menu (Raw JSON) -->

             <!-- 8001: ODESLAT (Send) -->
             <control type="button" id="8001">
                 <width>400</width>
                 <height>80</height>
                 <font>font13</font>
                 <label>  ODESLAT</label>
                 <textcolor>FFFFFFFF</textcolor>
                 <focusedcolor>FFFFFFFF</focusedcolor>
                 <texturenofocus colordiffuse="00FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturenofocus>
                 <texturefocus colordiffuse="FF00FF00">special://home/addons/plugin.video.milionar/resources/media/white.png</texturefocus> <!-- Green Highlight -->
                 <align>left</align>
                 <aligny>center</aligny>
                 <onclick>noop</onclick>
                 <onright>7106</onright>
             </control>
             
             <!-- 8002: ZRUSIT (Cancel) -->
             <control type="button" id="8002">
                 <width>400</width>
                 <height>80</height>
                 <font>font13</font>
                 <label>  ZRUŠIT</label>
                 <textcolor>FFFFFFFF</textcolor>
                 <focusedcolor>FFFFFFFF</focusedcolor>
                 <texturenofocus colordiffuse="00FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturenofocus>
                 <texturefocus colordiffuse="FFFF0000">special://home/addons/plugin.video.milionar/resources/media/white.png</texturefocus> <!-- Red Highlight -->
                 <align>left</align>
                 <aligny>center</aligny>
                 <onclick>noop</onclick>
                 <onright>7106</onright>
             </control>
        </control>
        
        <!-- ================= VIEWS ================= -->
        
        <!-- VIEW 1: Visualizer (for Action Buttons OK/ODESLAT/ZRUŠIT) -->
        <control type="group">
            <left>420</left>
            <top>100</top>
            <width>1480</width>
            <height>960</height>
            <visible>String.IsEqual(Window.Property(CurrentView),visualizer) | String.IsEmpty(Window.Property(CurrentView))</visible>
            
            <control type="textbox" id="7106">
                <left>0</left>
                <top>0</top>
                <width>1460</width>
                <height>960</height>
                <font>font13</font>
                <textcolor>FFEEEEEE</textcolor>
                <label>$INFO[Window.Property(Data.Visualizer)]</label>
                <pagecontrol>7206</pagecontrol>
                <onleft>8001</onleft>
                <onright>7206</onright>
            </control>
             <control type="scrollbar" id="7206">
                <left>1460</left>
                <top>0</top>
                <width>20</width>
                <height>960</height>
                <onleft>7106</onleft>
            </control>
        </control>

        <!-- VIEW 2: Raw JSON -->
        <control type="group">
            <left>420</left>
            <top>100</top>
            <width>1480</width>
            <height>960</height>
            <visible>String.IsEqual(Window.Property(CurrentView),raw)</visible>
            
            <control type="textbox" id="7102">
                <left>0</left>
                <top>0</top>
                <width>1460</width>
                <height>960</height>
                <font>font12</font>
                <textcolor>FFCCCCCC</textcolor>
                <label>$INFO[Window.Property(Data.Raw)]</label>
                <pagecontrol>7202</pagecontrol>
                <onleft>9002</onleft>
                <onright>7202</onright>
            </control>
             <control type="scrollbar" id="7202">
                <left>1460</left>
                <top>0</top>
                <width>20</width>
                <height>960</height>
                <onleft>7102</onleft>
            </control>
        </control>
        
        <!-- VIEW 3: System Context -->
        <control type="group">
            <left>420</left>
            <top>100</top>
            <width>1480</width>
            <height>960</height>
            <visible>String.IsEqual(Window.Property(CurrentView),context)</visible>
            
            <control type="textbox" id="7103">
                <left>0</left>
                <top>0</top>
                <width>1460</width>
                <height>960</height>
                <font>font12</font>
                <textcolor>FFCCCCCC</textcolor>
                <label>$INFO[Window.Property(Data.Context)]</label>
                <pagecontrol>7203</pagecontrol>
                <onleft>9003</onleft>
                <onright>7203</onright>
            </control>
             <control type="scrollbar" id="7203">
                <left>1460</left>
                <top>0</top>
                <width>20</width>
                <height>960</height>
                <onleft>7103</onleft>
            </control>
        </control>

        <!-- VIEW 4: Metrics & Stats -->
        <control type="group">
            <left>420</left>
            <top>100</top>
            <width>1480</width>
            <height>960</height>
            <visible>String.IsEqual(Window.Property(CurrentView),stats)</visible>
            
            <!-- CARD LAYOUT for Stats -->
            
            <!-- ROW 1: TOKENS -->
            <control type="group">
                <left>0</left><top>0</top><width>1480</width><height>150</height>
                
                <!-- Card 1: Input -->
                <control type="group">
                    <left>0</left><top>0</top><width>350</width><height>140</height>
                    <control type="image"><width>350</width><height>140</height><texture colordiffuse="20FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control>
                    <control type="label"><left>20</left><top>10</top><width>310</width><label>INPUT TOKENS</label><font>font10</font><textcolor>FF888888</textcolor></control>
                    <control type="label"><left>20</left><top>50</top><width>310</width><label>$INFO[Window.Property(Stats.InputTokens)]</label><font>font14</font><textcolor>FFFFFFFF</textcolor></control>
                </control>
                
                <!-- Card 2: Cached (Highlighted) -->
                <control type="group">
                    <left>370</left><top>0</top><width>350</width><height>140</height>
                    <control type="image"><width>350</width><height>140</height><texture colordiffuse="3000FF00">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control>
                    <control type="label"><left>20</left><top>10</top><width>310</width><label>CACHED TOKENS</label><font>font10</font><textcolor>FF88FF88</textcolor></control>
                    <control type="label"><left>20</left><top>50</top><width>310</width><label>$INFO[Window.Property(Stats.CachedTokens)]</label><font>font14</font><textcolor>FF00FF00</textcolor></control>
                </control>
                
                <!-- Card 3: Output -->
                <control type="group">
                    <left>740</left><top>0</top><width>350</width><height>140</height>
                    <control type="image"><width>350</width><height>140</height><texture colordiffuse="20FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control>
                    <control type="label"><left>20</left><top>10</top><width>310</width><label>OUTPUT TOKENS</label><font>font10</font><textcolor>FF888888</textcolor></control>
                    <control type="label"><left>20</left><top>50</top><width>310</width><label>$INFO[Window.Property(Stats.OutputTokens)]</label><font>font14</font><textcolor>FFFFFFFF</textcolor></control>
                </control>
                
                 <!-- Card 4: Total -->
                <control type="group">
                    <left>1110</left><top>0</top><width>350</width><height>140</height>
                    <control type="image"><width>350</width><height>140</height><texture colordiffuse="20FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control>
                    <control type="label"><left>20</left><top>10</top><width>310</width><label>TOTAL TOKENS</label><font>font10</font><textcolor>FF888888</textcolor></control>
                    <control type="label"><left>20</left><top>50</top><width>310</width><label>$INFO[Window.Property(Stats.TotalTokens)]</label><font>font14</font><textcolor>FFFFFFFF</textcolor></control>
                </control>
            </control>

            <!-- ROW 2: COSTS -->
            <control type="group">
                <left>0</left><top>160</top><width>1480</width><height>150</height>
                
                <control type="group">
                    <left>0</left><top>0</top><width>350</width><height>140</height>
                    <control type="image"><width>350</width><height>140</height><texture colordiffuse="10FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control>
                    <control type="label"><left>20</left><top>10</top><width>310</width><label>INPUT COST</label><font>font10</font><textcolor>FF888888</textcolor></control>
                    <control type="label"><left>20</left><top>50</top><width>310</width><label>$INFO[Window.Property(Stats.InputCost)]</label><font>font13</font><textcolor>FFCCCCCC</textcolor></control>
                </control>
                
                 <control type="group">
                    <left>370</left><top>0</top><width>350</width><height>140</height>
                    <control type="image"><width>350</width><height>140</height><texture colordiffuse="1500FF00">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control> <!-- Green tint -->
                    <control type="label"><left>20</left><top>10</top><width>310</width><label>CACHED COST</label><font>font10</font><textcolor>FF88AA88</textcolor></control>
                    <control type="label"><left>20</left><top>50</top><width>310</width><label>$INFO[Window.Property(Stats.CachedCost)]</label><font>font13</font><textcolor>FF00FF00</textcolor></control>
                </control>
                
                 <control type="group">
                    <left>740</left><top>0</top><width>350</width><height>140</height>
                    <control type="image"><width>350</width><height>140</height><texture colordiffuse="10FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control>
                    <control type="label"><left>20</left><top>10</top><width>310</width><label>OUTPUT COST</label><font>font10</font><textcolor>FF888888</textcolor></control>
                    <control type="label"><left>20</left><top>50</top><width>310</width><label>$INFO[Window.Property(Stats.OutputCost)]</label><font>font13</font><textcolor>FFCCCCCC</textcolor></control>
                </control>
                
                 <control type="group">
                    <left>1110</left><top>0</top><width>350</width><height>140</height>
                    <control type="image"><width>350</width><height>140</height><texture colordiffuse="10FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control>
                    <control type="label"><left>20</left><top>10</top><width>310</width><label>TOTAL COST</label><font>font10</font><textcolor>FF888888</textcolor></control>
                    <control type="label"><left>20</left><top>50</top><width>310</width><label>$INFO[Window.Property(Stats.TotalCost)]</label><font>font13</font><textcolor>FFFF0000</textcolor></control>
                </control>
            </control>

            <!-- ROW 3: SAVINGS & PERFORMANCE -->
            <control type="group">
                <left>0</left><top>320</top><width>1480</width><height>150</height>
                
                <!-- SAVINGS CARD (Big Green) -->
                <control type="group">
                    <left>0</left><top>0</top><width>720</width><height>140</height>
                     <control type="image"><width>720</width><height>140</height><texture colordiffuse="2000FF00">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control>
                     <control type="label"><left>20</left><top>10</top><width>600</width><label>CACHING SAVINGS</label><font>font12</font><textcolor>FF00FF00</textcolor></control>
                     <!-- Two Value Labels: Percent and Cost -->
                     <control type="label"><left>20</left><top>50</top><width>300</width><label>$INFO[Window.Property(Stats.SavingsPercent)]</label><font>font16</font><textcolor>FFFFFFFF</textcolor></control>
                     <control type="label"><left>250</left><top>55</top><width>400</width><label>(Ušetřeno: $INFO[Window.Property(Stats.SavingsCost)])</label><font>font13</font><textcolor>FFCCCCCC</textcolor></control>
                </control>
                
                <!-- PERFORMANCE CARD -->
                <control type="group">
                    <left>740</left><top>0</top><width>720</width><height>140</height>
                     <control type="image"><width>720</width><height>140</height><texture colordiffuse="20FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texture></control>
                     <control type="label"><left>20</left><top>10</top><width>600</width><label>PERFORMANCE</label><font>font12</font><textcolor>FF888888</textcolor></control>
                     
                     <!-- Latency -->
                     <control type="label"><left>20</left><top>50</top><width>300</width><label>$INFO[Window.Property(Stats.Latency)]</label><font>font14</font><textcolor>FFFFFFFF</textcolor></control>
                     <control type="label"><left>20</left><top>90</top><width>300</width><label>Latency</label><font>font10</font><textcolor>FF888888</textcolor></control>
                     
                     <!-- Speed -->
                     <control type="label"><left>200</left><top>50</top><width>300</width><label>$INFO[Window.Property(Stats.Speed)]</label><font>font14</font><textcolor>FFFFFFFF</textcolor></control>
                     <control type="label"><left>200</left><top>90</top><width>300</width><label>Speed</label><font>font10</font><textcolor>FF888888</textcolor></control>
                     
                      <!-- Finish Reason -->
                     <control type="label"><left>450</left><top>50</top><width>250</width><label>$INFO[Window.Property(Stats.FinishReason)]</label><font>font14</font><textcolor>FFFFFFFF</textcolor></control>
                     <control type="label"><left>450</left><top>90</top><width>250</width><label>Finish Reason</label><font>font10</font><textcolor>FF888888</textcolor></control>
                </control>
            </control>

        </control>

        <!-- VIEW 5: Context Titles (My New View) -->
        <control type="group">
            <left>420</left>
            <top>100</top>
            <width>1480</width>
            <height>960</height>
            <visible>String.IsEqual(Window.Property(CurrentView),context_titles)</visible>
            <animation effect="fade" time="150">Visible</animation>
            
            <!-- Header -->
            <control type="group">
                <left>20</left>
                <top>20</top>
                <control type="label">
                    <width>400</width>
                    <height>35</height>
                    <font>font14</font>
                    <label>CONTEXT TITLES</label>
                    <textcolor>FFAAAAAA</textcolor>
                </control>
                <control type="label">
                    <top>35</top>
                    <width>800</width>
                    <height>25</height>
                    <font>font11</font>
                    <label>Tituly odeslané do AI jako kontext (Limit: $INFO[Window.Property(ContextLimit)])</label>
                    <textcolor>FF666666</textcolor>
                </control>
            </control>
            
            <!-- Header line separator -->
            <control type="image">
                <left>20</left>
                <top>110</top>
                <width>1440</width>
                <height>1</height>
                <texture colordiffuse="25FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texture>
            </control>
            
            <!-- Content Textbox -->
            <control type="textbox" id="7105">
                <left>20</left>
                <top>130</top>
                <width>1420</width>
                <height>830</height>
                <font>font12</font>
                <textcolor>FFCCCCCC</textcolor>
                <label>$INFO[Window.Property(Data.ContextList)]</label>
                <pagecontrol>7205</pagecontrol>
                <onleft>9005</onleft>
                <onright>7205</onright>
            </control>
            
            <!-- Scrollbar -->
            <control type="scrollbar" id="7205">
                <left>1450</left>
                <top>60</top>
                <width>20</width>
                <height>895</height>
                <orientation>vertical</orientation>
                <showonepage>false</showonepage>
                <onleft>7105</onleft>
                <texturesliderbackground colordiffuse="20FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturesliderbackground>
                <texturesliderbar colordiffuse="80FFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturesliderbar>
                <texturesliderbarfocus colordiffuse="FFFFFFFF">special://home/addons/plugin.video.milionar/resources/media/white.png</texturesliderbarfocus>
            </control>
        </control>

    </controls>
</window>
