<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2026, Jiri Eischmann <jiri@eischmann.cz> and the meshy contributors -->
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
<interface>
  <requires lib="gtk" version="4.0"/>
  <requires lib="libadwaita" version="1.0"/>

  <object class="AdwClamp" id="clamp">
    <property name="maximum-size">600</property>
    <property name="child">
      <object class="GtkBox" id="outer">
        <property name="orientation">vertical</property>

        <!-- Content: avatar + message bubble -->
        <child>
          <object class="GtkBox" id="content_box">
            <property name="orientation">horizontal</property>
            <property name="spacing">8</property>
            <property name="margin-start">12</property>

            <!-- Avatar stack (room messages only) -->
            <child>
              <object class="GtkStack" id="avatar_stack">
                <property name="transition-type">none</property>
                <property name="visible">false</property>

                <child>
                  <object class="GtkStackPage">
                    <property name="name">initials</property>
                    <property name="child">
                      <object class="AdwAvatar" id="avatar">
                        <property name="size">32</property>
                        <property name="show-initials">true</property>
                        <property name="valign">start</property>
                      </object>
                    </property>
                  </object>
                </child>

                <child>
                  <object class="GtkStackPage">
                    <property name="name">emoji</property>
                    <property name="child">
                      <object class="GtkLabel" id="emoji_lbl">
                        <property name="valign">start</property>
                        <style>
                          <class name="emoji-avatar"/>
                        </style>
                      </object>
                    </property>
                  </object>
                </child>
              </object>
            </child>

            <!-- Message box -->
            <child>
              <object class="GtkBox" id="msg_box">
                <property name="orientation">vertical</property>
                <property name="spacing">2</property>
                <property name="margin-end">12</property>
                <property name="margin-top">2</property>
                <property name="margin-bottom">2</property>

                <!-- Sender name (for room messages) -->
                <child>
                  <object class="GtkLabel" id="sender_lbl">
                    <property name="xalign">0</property>
                    <property name="max-width-chars">40</property>
                    <property name="visible">false</property>
                    <style>
                      <class name="dim-label"/>
                      <class name="caption"/>
                    </style>
                  </object>
                </child>

                <!-- Card frame with content stack -->
                <child>
                  <object class="GtkFrame" id="frame">
                    <style>
                      <class name="card"/>
                    </style>
                    <property name="child">
                      <object class="GtkStack" id="content_stack">
                        <property name="transition-type">none</property>
                        <property name="vhomogeneous">false</property>
                        <property name="hhomogeneous">false</property>

                        <!-- Text page -->
                        <child>
                          <object class="GtkStackPage">
                            <property name="name">text</property>
                            <property name="child">
                              <object class="GtkLabel" id="text_lbl">
                                <property name="wrap">true</property>
                                <property name="wrap-mode">word-char</property>
                                <property name="xalign">0</property>
                                <property name="selectable">true</property>
                                <property name="max-width-chars">40</property>
                                <property name="margin-start">12</property>
                                <property name="margin-end">12</property>
                                <property name="margin-top">8</property>
                                <property name="margin-bottom">8</property>
                              </object>
                            </property>
                          </object>
                        </child>

                        <!-- Shared contact page -->
                        <child>
                          <object class="GtkStackPage">
                            <property name="name">contact</property>
                            <property name="child">
                              <object class="GtkBox" id="sc_box">
                                <property name="orientation">vertical</property>
                                <property name="spacing">6</property>
                                <property name="margin-start">12</property>
                                <property name="margin-end">12</property>
                                <property name="margin-top">8</property>
                                <property name="margin-bottom">8</property>

                                <child>
                                  <object class="GtkLabel" id="sc_header_lbl">
                                    <property name="xalign">0</property>
                                    <property name="wrap">true</property>
                                    <style>
                                      <class name="dim-label"/>
                                      <class name="caption"/>
                                    </style>
                                  </object>
                                </child>

                                <child>
                                  <object class="GtkBox" id="sc_name_box">
                                    <property name="spacing">6</property>

                                    <child>
                                      <object class="GtkImage" id="sc_icon">
                                        <property name="icon-name">avatar-default-symbolic</property>
                                      </object>
                                    </child>

                                    <child>
                                      <object class="GtkLabel" id="sc_name_lbl">
                                        <property name="xalign">0</property>
                                        <attributes>
                                          <attribute name="weight" value="bold"/>
                                        </attributes>
                                      </object>
                                    </child>
                                  </object>
                                </child>

                                <child>
                                  <object class="GtkLabel" id="sc_key_lbl">
                                    <property name="xalign">0</property>
                                    <style>
                                      <class name="dim-label"/>
                                      <class name="caption"/>
                                    </style>
                                  </object>
                                </child>

                                <child>
                                  <object class="GtkButton" id="sc_add_btn">
                                    <property name="label" translatable="yes">Add Contact</property>
                                    <property name="halign">start</property>
                                    <property name="margin-top">4</property>
                                    <style>
                                      <class name="suggested-action"/>
                                    </style>
                                  </object>
                                </child>
                              </object>
                            </property>
                          </object>
                        </child>

                        <!-- Shared location page -->
                        <child>
                          <object class="GtkStackPage">
                            <property name="name">location</property>
                            <property name="child">
                              <object class="GtkBox" id="loc_box">
                                <property name="orientation">vertical</property>
                                <property name="spacing">6</property>
                                <property name="margin-start">12</property>
                                <property name="margin-end">12</property>
                                <property name="margin-top">8</property>
                                <property name="margin-bottom">8</property>

                                <child>
                                  <object class="GtkLabel" id="loc_header_lbl">
                                    <property name="xalign">0</property>
                                    <property name="wrap">true</property>
                                    <style>
                                      <class name="dim-label"/>
                                      <class name="caption"/>
                                    </style>
                                  </object>
                                </child>

                                <child>
                                  <object class="GtkLabel" id="loc_coords_lbl">
                                    <property name="xalign">0</property>
                                    <property name="selectable">true</property>
                                    <style>
                                      <class name="caption"/>
                                    </style>
                                  </object>
                                </child>

                                <child>
                                  <object class="GtkFrame" id="loc_map_frame">
                                    <property name="overflow">hidden</property>
                                    <style>
                                      <class name="card"/>
                                    </style>
                                  </object>
                                </child>

                                <child>
                                  <object class="GtkButton" id="loc_open_btn">
                                    <property name="label" translatable="yes">Open in Maps App</property>
                                    <property name="margin-top">4</property>
                                  </object>
                                </child>
                              </object>
                            </property>
                          </object>
                        </child>
                      </object>
                    </property>
                  </object>
                </child>

                <!-- Meta line: time + status -->
                <child>
                  <object class="GtkBox" id="meta_box">
                    <property name="spacing">4</property>

                    <child>
                      <object class="GtkLabel" id="time_lbl">
                        <style>
                          <class name="dim-label"/>
                          <class name="caption"/>
                        </style>
                      </object>
                    </child>

                    <child>
                      <object class="GtkLabel" id="status_lbl">
                        <property name="visible">false</property>
                        <style>
                          <class name="caption"/>
                        </style>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
            </child>
          </object>
        </child>

        <!-- Divider -->
        <child>
          <object class="GtkBox" id="div_box">
            <property name="spacing">8</property>
            <property name="margin-start">12</property>
            <property name="margin-end">12</property>
            <property name="margin-top">8</property>
            <property name="margin-bottom">8</property>
            <property name="visible">false</property>

            <child>
              <object class="GtkSeparator" id="line_left">
                <property name="hexpand">true</property>
                <property name="valign">center</property>
              </object>
            </child>

            <child>
              <object class="GtkLabel" id="div_lbl"/>
            </child>

            <child>
              <object class="GtkSeparator" id="line_right">
                <property name="hexpand">true</property>
                <property name="valign">center</property>
              </object>
            </child>
          </object>
        </child>
      </object>
    </property>
  </object>
</interface>
