/* tackhost_rtl - fixes for what dir="rtl" does not mirror by itself on the elastic skin.
   Only loaded for RTL languages. Elastic hard-codes direction:ltr, text-align:left and
   float:left icons on its lists, so those are mirrored here explicitly. */

/* Side menu: the dark-mode / about / logout group is absolutely positioned at left:0 of the page */
html[dir=rtl] #layout-menu .special-buttons { left: auto; right: 0; }

/* Lists (settings menu, settings sections, folders, contacts, identities, filters) */
html[dir=rtl] .listing li,
html[dir=rtl] .listing li a,
html[dir=rtl] table.listing td,
html[dir=rtl] table.listing td a,
html[dir=rtl] .treelist li a { direction: rtl; text-align: right; }
html[dir=rtl] .listing li a:before,
html[dir=rtl] .listing li > a:before,
html[dir=rtl] table.listing td:before,
html[dir=rtl] table.listing td a:before,
html[dir=rtl] .treelist li a:before { float: right; margin-right: 0; margin-left: 7px; }
/* folder list with the subscription switch: swap the reserved side */
html[dir=rtl] #subscription-table li a { padding-right: 7px; padding-left: 35px; }
html[dir=rtl] #subscription-table li input.form-check-input,
html[dir=rtl] #subscription-table li .custom-switch { right: auto; left: 7px; }
/* English labels inside an RTL page ("2-Factor Authentication") keep their own order */
html[dir=rtl] .listing li a,
html[dir=rtl] table.listing td a { unicode-bidi: plaintext; }

/* Plain-text mail bodies and subjects: each paragraph takes the direction of its own first strong
   letter, so Arabic reads right-to-left and English stays left-to-right (also fixes "Re: <Arabic>") */
html[dir=rtl] .message-part div.pre,
html[dir=rtl] .message-part pre,
html[dir=rtl] #messagebody div.pre,
html[dir=rtl] table.messagelist td.subject span.subject a,
html[dir=rtl] table.messagelist td.subject a,
html[dir=rtl] .header .subject,
html[dir=rtl] h2.subject { unicode-bidi: plaintext; text-align: start; }

/* Message list (2026-12-04, owner: Arabic subjects sat on the left): only the subject TEXT takes its own direction
   (rule above). The box around it starts with the status icon, which has no letters, so "plaintext" on the box made
   it left-to-right and every subject lined up on the left. The box follows the page: rows start from the right. */
html[dir=rtl] table.messagelist td.subject span.subject { direction: rtl; text-align: right; }

/* Compose: the plain-text editor follows what is typed */
html[dir=rtl] textarea#composebody { unicode-bidi: plaintext; text-align: start; }

/* Popup menus: the phone side menu and the message actions menu (QA TH-071, 2026-11-22). Elastic floats every
   icon left with its gap on the right, so in Arabic the icon sat on the wrong side and, on the submenu rows
   (flex), touched or overlapped its label; the submenu arrow pointed into the text. */
html[dir=rtl] .popover .menu li,
html[dir=rtl] .popover .menu li a { text-align: right; }
html[dir=rtl] .popover .menu li a:before { float: right !important; margin-right: 0 !important; margin-left: .5rem !important; }
html[dir=rtl] .popover .menu li a[aria-haspopup]:after { content: "\f053"; margin: 0 .2em 0 0; }

/* Column resizing: in RTL a column's neighbour is on its left, so the border to drag is its left edge
   (a right-hand sidebar: its right edge). rtl.js does the matching width sum. */
html[dir=rtl] .column-resizer { right: auto; left: -3px; }
html[dir=rtl] .column-resizer.inverted { left: auto; right: -3px; }
