/* Travian SS — Arabic / RTL override layer.
 *
 * Loaded from Templates/head_assets.tpl AFTER travian-responsive.css, so it is
 * the last word on direction.
 *
 * WHY THIS FILE EXISTS
 * gpack/travian_default/lang/ar/compact.css is a byte-for-byte copy of
 * lang/en/compact.css (identical MD5), so every rule it ships is hardcoded
 * left-to-right: ~660 declarations using float, text-align, physical
 * margin/padding and physical insets. Forking 223 KB of generated CSS was
 * rejected in favour of this targeted layer.
 *
 * SCOPE RULE
 * Everything is scoped to html[dir="rtl"]. That single attribute selector also
 * buys the specificity needed to beat the equally-specific compact.css rule it
 * mirrors, which is why almost nothing here needs !important.
 *
 * DELIBERATELY LEFT LTR — DO NOT "FIX"
 * div#mbig, div.map and the village_map graphics place tiles with absolute
 * pixel coordinates computed by PHP/JS. Mirroring them would scramble the map.
 * gpack/travian_default/lang/ar/lang.css already forces direction:ltr on those
 * containers; nothing in this file may undo it.
 *
 * PAIRED-PROPERTY RULE
 * When mirroring a physical margin or padding, always zero the original side.
 * Setting only the opposite side leaves both in effect and doubles the gap.
 */

/* ==========================================================================
   1. Shared table patterns
   compact.css left-aligns the label/name column of nearly every table and
   right-aligns the numeric one. In RTL those roles swap.
   ========================================================================== */

html[dir="rtl"] div#content tbody th,
html[dir="rtl"] div#content table td.nam,
html[dir="rtl"] div#content table td.vil,
html[dir="rtl"] div#content table td.pla,
html[dir="rtl"] div#content table td.hero,
html[dir="rtl"] div#content table td.typ,
html[dir="rtl"] div#content table td.desc,
html[dir="rtl"] div#content table td.event,
html[dir="rtl"] div#content table td.sub,
html[dir="rtl"] div#content table td.top,
html[dir="rtl"] div#content table td.note,
html[dir="rtl"] div#content table td.flags,
html[dir="rtl"] div#content table td.al {
    text-align: right;
}

/* ==========================================================================
   2. Build pages (dorf2 → build.php, all gid variants)
   ========================================================================== */

html[dir="rtl"] div#build p.switch {
    text-align: left;
}

/* Absolute building crest: compact.css pins it to the physical right. */
html[dir="rtl"] div#build a.build_logo img {
    right: auto;
    left: 13px;
    margin-left: 0;
    margin-right: 5px;
}

html[dir="rtl"] div#build p.build_desc {
    padding-right: 0;
    padding-left: 70px;
}

html[dir="rtl"] div#build.gid40 p.build_desc {
    padding-right: 0;
    padding-left: 200px;
}

html[dir="rtl"] div#build.gid15 input#btn_demolish {
    margin-left: 0;
    margin-right: 15px;
}

html[dir="rtl"] div#build table#build_value th {
    padding-right: 0;
    padding-left: 35px;
}

html[dir="rtl"] div#build table#build_value td {
    text-align: left;
}

html[dir="rtl"] div#build table.build_details td.desc div.details {
    padding-left: 0;
    padding-right: 30px;
}

/* gid24 / gid35 zero this out again; keep that intent in RTL. */
html[dir="rtl"] div#build.gid24 table.build_details td.desc div.details,
html[dir="rtl"] div#build.gid35 table.build_details td.desc div.details {
    padding-right: 0;
}

html[dir="rtl"] div#build table.under_progress td.desc {
    text-align: right;
}

html[dir="rtl"] div#build table.under_progress div.val {
    float: right;
    padding-left: 0;
    padding-right: 5px;
    text-align: left;
}

html[dir="rtl"] div#build table#expansion td.ra {
    text-align: left;
}

html[dir="rtl"] div#build table#expansion td.vil {
    text-align: right;
}

html[dir="rtl"] div#build.gid0 table.new_building td.bimg {
    padding-left: 5px;
    padding-right: 15px;
}

/* ---- gid16 Rally point: troop movement + farm list ---- */

html[dir="rtl"] div#build.gid16 table.troop_details tbody.goods div.res,
html[dir="rtl"] div#build.gid16 table.troop_details div.sup {
    text-align: right;
}

html[dir="rtl"] div#build.gid16 table.troop_details tbody.goods div.carry,
html[dir="rtl"] div#build.gid16 table.troop_details div.sback,
html[dir="rtl"] div#build.gid16 table.troop_details div.free,
html[dir="rtl"] div#build.gid16 table.troop_details div.gback,
html[dir="rtl"] div#build.gid16 table.troop_details div.diss {
    text-align: left;
}

html[dir="rtl"] div#build.gid16 table.troop_details div {
    float: right;
}

html[dir="rtl"] div#build.gid16 table.troop_details div.abort {
    float: left;
    text-align: left;
}

html[dir="rtl"] div#build.gid16 table.troop_details a.attack_marker {
    float: left;
    right: auto;
    left: -1px;
}

html[dir="rtl"] div#build.gid16 table#raidList td.check img {
    float: right;
}

html[dir="rtl"] div#build.gid16 table#raidList td.rep img {
    float: right;
    margin-right: 0;
    margin-left: 3px;
}

html[dir="rtl"] div#build.gid16 table#raidList td.vil,
html[dir="rtl"] div#build.gid16 table#raidList td.rep,
html[dir="rtl"] div#build.gid16 table#troopEscape td.vil {
    text-align: right;
}

html[dir="rtl"] div#build.gid16 table#raidList td.vil img {
    float: left;
}

html[dir="rtl"] div#build.gid16 table#raidTroops td.column-first {
    padding-left: 0;
    padding-right: 8px;
}

html[dir="rtl"] div#build.gid16 table#raidTroops td.column-last {
    padding-right: 0;
    padding-left: 8px;
}

html[dir="rtl"] div#build.gid16 table#raidTroops img {
    margin-right: 0;
    margin-left: 2px;
}

/* ---- gid17 Marketplace ---- */

html[dir="rtl"] div#build.gid17 table.send_res,
html[dir="rtl"] div#build.gid17 table.buy_select,
html[dir="rtl"] div#build.gid17 table.traders div.in {
    float: right;
}

html[dir="rtl"] div#build.gid17 table.res_target {
    float: right;
    margin-left: 0;
    margin-right: 20px;
}

html[dir="rtl"] div#build.gid17 table#ratio_select,
html[dir="rtl"] div#build.gid17 table#bid_select {
    margin-left: 0;
    margin-right: 20px;
}

html[dir="rtl"] div#build.gid17 p.info img {
    margin-right: 0;
    margin-left: 2px;
}

html[dir="rtl"] div#build.gid17 table.send_res td {
    padding-right: 0;
    padding-left: 4px;
}

html[dir="rtl"] div#build.gid17 table#target_select td.vil *,
html[dir="rtl"] div#build.gid17 table#target_select td.coo * {
    float: right;
}

html[dir="rtl"] div#build.gid17 table#target_select td.vil input.text {
    margin-left: 0;
    margin-right: 10px;
}

html[dir="rtl"] div#build.gid17 table.traders div.at {
    float: left;
}

html[dir="rtl"] div#build.gid17 table.traders div.repeat {
    float: left;
    text-align: left;
}

html[dir="rtl"] div#build.gid17 table#range tfoot td {
    padding-right: 0;
    padding-left: 7px;
    text-align: left;
}

html[dir="rtl"] div#build.gid17 table#range td.val,
html[dir="rtl"] div#build.gid17 table#sell_overview td.val,
html[dir="rtl"] div#build.gid17 table#npc td.sum,
html[dir="rtl"] div#build.gid17 table#trading_routes tfoot th,
html[dir="rtl"] div#build.gid17 table#trading_routes td.desc {
    text-align: right;
}

html[dir="rtl"] div#build.gid17 table#summary td.ico {
    padding-right: 0;
    padding-left: 2px;
}

html[dir="rtl"] div#build.gid17 table#summary td.val {
    padding-left: 0;
    padding-right: 2px;
}

html[dir="rtl"] div#build.gid17 table#trading_edit select option {
    padding-right: 0;
    padding-left: 10px;
}

html[dir="rtl"] div#build.gid17 table#trading_edit td.res input {
    margin-right: 0;
    margin-left: 5px;
}

html[dir="rtl"] div#build.gid17 table#trading_edit td.res img {
    margin-right: 0;
    margin-left: 3px;
}

/* ---- gid27 / gid37 unit tables ---- */

html[dir="rtl"] div#build.gid27 table td.nam,
html[dir="rtl"] div#build.gid37 table td.nam {
    text-align: right;
}

html[dir="rtl"] div#build.gid27 table div.man {
    float: left;
}

/* ==========================================================================
   3. Player profile / settings (spieler.php)
   ========================================================================== */

html[dir="rtl"] div.player div#gpack_popup img.logo {
    float: right;
    margin-right: 0;
    margin-left: 20px;
}

html[dir="rtl"] div.player div#gpack_popup ul {
    margin-left: 0;
    padding-left: 0;
    padding-right: 25px;
}

html[dir="rtl"] div.player tbody th,
html[dir="rtl"] div.player table#profile td.details table td,
html[dir="rtl"] div.player table#villages td.nam,
html[dir="rtl"] div.player table#edit td.gend,
html[dir="rtl"] div.player table#medals td.typ,
html[dir="rtl"] div.player table.set td,
html[dir="rtl"] div.player table#change_pass td.note,
html[dir="rtl"] div.player table.account table.sitter td.flags,
html[dir="rtl"] div.player table#del_acc td.del_selection,
html[dir="rtl"] div.player table#gpack td,
html[dir="rtl"] div.player table#download td.nam {
    text-align: right;
}

html[dir="rtl"] div.player table#edit td.birth input.day,
html[dir="rtl"] div.player table#edit td.birth select.dropdown,
html[dir="rtl"] div.player table#edit td.birth input.year {
    float: right;
}

html[dir="rtl"] div.player table#edit td.gend input.radio {
    margin-right: 0;
    margin-left: 2px;
}

html[dir="rtl"] div.player table#adsettings span.note {
    margin-left: 0;
    margin-right: 10px;
}

html[dir="rtl"] div.player table#gpack td input.text {
    margin-left: 0;
    margin-right: 15px;
}

html[dir="rtl"] div.player table.account span.count,
html[dir="rtl"] div.player table.account span.max {
    margin-left: 0;
    margin-right: 5px;
}

html[dir="rtl"] div.player table#gpack td div.example {
    margin-left: 0;
    margin-right: 22px;
}

/* ==========================================================================
   4. Statistics (statistiken.php)
   ========================================================================== */

/* Absolute submenu tab strip, pinned to the physical right by compact.css. */
html[dir="rtl"] div.statistics div#submenu,
html[dir="rtl"] div.alliance div#submenu {
    right: auto;
    left: 29px;
}

html[dir="rtl"] div.statistics div#submenu img,
html[dir="rtl"] div.alliance div#submenu img {
    float: left;
    margin-left: 0;
    margin-right: 5px;
}

html[dir="rtl"] div.statistics div#submenu2 img {
    float: right;
    margin-right: 0;
    margin-left: 5px;
}

html[dir="rtl"] div.statistics div.graph {
    padding-left: 0;
    padding-right: 60px;
}

html[dir="rtl"] div.statistics div.legende,
html[dir="rtl"] div.statistics div.legende div.box {
    float: right;
}

html[dir="rtl"] div.statistics td.ra {
    text-align: left;
}

html[dir="rtl"] div.statistics td.al,
html[dir="rtl"] div.statistics table#player td.pla,
html[dir="rtl"] div.statistics table#player_off td.pla,
html[dir="rtl"] div.statistics table#player_def td.pla,
html[dir="rtl"] div.statistics table.top10 td.pla,
html[dir="rtl"] div.statistics table#villages td.vil,
html[dir="rtl"] div.statistics table#villages td.pla,
html[dir="rtl"] div.statistics table#heroes td.hero,
html[dir="rtl"] div.statistics table#heroes td.pla {
    text-align: right;
}

/* Top-10 pairs sit side by side; swap so the first reads from the right. */
html[dir="rtl"] div.statistics table#top10_offs,
html[dir="rtl"] div.statistics table#top10_climbers {
    float: right;
}

html[dir="rtl"] div.statistics table#top10_defs,
html[dir="rtl"] div.statistics table#top10_raiders {
    float: left;
}

html[dir="rtl"] div.statistics table#search_navi div.search {
    float: right;
    text-align: right;
}

html[dir="rtl"] div.statistics table#search_navi div.search input.ra,
html[dir="rtl"] div.statistics table#search_navi div.search input.name {
    margin-left: 0;
    margin-right: 4px;
}

html[dir="rtl"] div.statistics table#search_navi div.navi {
    float: left;
    text-align: left;
}

/* ==========================================================================
   5. Alliance (allianz.php)
   ========================================================================== */

html[dir="rtl"] div.alliance span.roomselector,
html[dir="rtl"] div.alliance span.roomselectorActive,
html[dir="rtl"] div.alliance table.dipl,
html[dir="rtl"] div.alliance div#box {
    float: right;
}

html[dir="rtl"] div.alliance table.infos {
    float: left;
}

html[dir="rtl"] div.alliance tbody th,
html[dir="rtl"] div.alliance table#profile td.details table td,
html[dir="rtl"] div.alliance table#member td.pla,
html[dir="rtl"] div.alliance table#offs td.sub,
html[dir="rtl"] div.alliance table#events td.event,
html[dir="rtl"] div.alliance table#options td.val,
html[dir="rtl"] div.alliance table#name td,
html[dir="rtl"] div.alliance table#edit tbody td,
html[dir="rtl"] div.alliance table#medals td.typ,
html[dir="rtl"] div.alliance table#invitations td,
html[dir="rtl"] div.alliance table.dipl td {
    text-align: right;
}

html[dir="rtl"] div.alliance table#member td.ra {
    text-align: left;
}

html[dir="rtl"] div.alliance table#offs td.sub img {
    float: right;
}

html[dir="rtl"] div.alliance table#offs td.sub div {
    padding-left: 0;
    padding-right: 24px;
}

/* ==========================================================================
   6. Messages (nachrichten.php)
   ========================================================================== */

html[dir="rtl"] div.messages div.msg_content img#label {
    float: right;
    margin-left: 0;
    margin-right: 12px;
}

html[dir="rtl"] div.messages div.msg_content div#heading {
    float: right;
    padding-left: 0;
    padding-right: 8px;
}

html[dir="rtl"] div.messages div#read_content div#time {
    float: left;
    padding-right: 0;
    padding-left: 12px;
}

html[dir="rtl"] div.messages div#read_content div#time div {
    text-align: left;
}

html[dir="rtl"] div.messages div.message,
html[dir="rtl"] div.messages #write_content textarea {
    margin-left: 0;
    margin-right: 12px;
}

html[dir="rtl"] div.messages #write_content a#adbook {
    float: left;
}

html[dir="rtl"] div.messages table#overview td.top,
html[dir="rtl"] div.messages table#overview th.buttons {
    text-align: right;
}

html[dir="rtl"] div.messages table#overview th.navi {
    text-align: left;
}

/* Absolute address-book popup (405px wide) and its close button. */
html[dir="rtl"] div.messages div#adressbook {
    left: auto;
    right: 1px;
}

html[dir="rtl"] div.messages div#adressbook img#close {
    left: auto;
    right: 404px;
}

html[dir="rtl"] div.messages div#block textarea {
    left: auto;
    right: 80px;
}

/* BBCode toolbar */
html[dir="rtl"] div.messages div#message_container div.bbButton,
html[dir="rtl"] div#text_container div.bbButton {
    float: right;
}

html[dir="rtl"] div.messages div#message_container div.bbPreview,
html[dir="rtl"] div#text_container div.bbPreview {
    float: left;
}

html[dir="rtl"] div.messages div#message_container div.bbAlliance,
html[dir="rtl"] div#text_container div.bbAlliance,
html[dir="rtl"] div.messages div#message_container div.bbResource,
html[dir="rtl"] div#text_container div.bbResource {
    margin-left: 0;
    margin-right: 8px;
}

html[dir="rtl"] div.messages div#message_container div#message_toolbarWindows div,
html[dir="rtl"] div#text_container div#text_toolbarWindows div {
    left: auto;
    right: 180px;
}

/* ==========================================================================
   7. Alliance forum
   ========================================================================== */

/* Relative centring hack: margin pushes to the middle, inset trims it back. */
html[dir="rtl"] div.forum a.mad {
    left: auto;
    right: -15px;
    margin-left: 0;
    margin-right: 50%;
}

html[dir="rtl"] div.forum img.switch_admin {
    margin-left: 0;
    margin-right: 5px;
}

html[dir="rtl"] div.forum table td.last,
html[dir="rtl"] div.forum table#poll td.sel {
    text-align: left;
}

html[dir="rtl"] div.forum table td.navi_top,
html[dir="rtl"] div.forum table td.navi_btm {
    float: left;
    margin-right: 0;
    margin-left: 20px;
    text-align: left;
}

html[dir="rtl"] div.forum table#posts td.pcontent div.posted,
html[dir="rtl"] div.forum table#poll td.stat img {
    float: right;
}

html[dir="rtl"] div.forum table#posts td.pcontent div.admin {
    float: left;
}

html[dir="rtl"] div.forum table#posts td.pcontent div.admin img {
    margin-left: 0;
    margin-right: 3px;
}

html[dir="rtl"] div.forum table#new_topic select.dropdown {
    margin-right: 0;
    margin-left: 1px;
}

html[dir="rtl"] div.forum table#poll td.stat {
    text-align: right;
}

/* ==========================================================================
   8. Plus / shop (plus.php)
   The gamepack ships a table.lang_rtl variant, but the templates under
   Templates/Plus hardcode class="lang_ltr lang_de", so the RTL variant never
   applies. Override the LTR class instead of editing every template.
   ========================================================================== */

html[dir="rtl"] div.plus p.btn,
html[dir="rtl"] div.plus table.plusFunctions td.desc,
html[dir="rtl"] div.plus div#payment table tr.s7 td,
html[dir="rtl"] div.plus table.lang_ltr th,
html[dir="rtl"] div.plus table.lang_ltr td {
    text-align: right;
}

html[dir="rtl"] div.plus p#product_selection,
html[dir="rtl"] div.plus p#orders_link {
    text-align: left;
}

html[dir="rtl"] div.plus img.gold {
    margin-right: 0;
    margin-left: 2px;
}

html[dir="rtl"] div.plus div#products {
    margin-left: 0;
    margin-right: -6px;
}

html[dir="rtl"] div.plus div#products table.lang_ltr {
    float: right;
}

/* ==========================================================================
   9. Reports (berichte.php)
   ========================================================================== */

html[dir="rtl"] div.reports table#overview td.sub img,
html[dir="rtl"] div.reports td.report_content table#attacker tbody.goods div.res {
    float: right;
}

html[dir="rtl"] div.reports table#overview td.sub div {
    padding-left: 0;
    padding-right: 24px;
}

html[dir="rtl"] div.reports table#overview tfoot th.buttons,
html[dir="rtl"] div.reports table#report_surround thead th,
html[dir="rtl"] div.reports table#report_surround thead td,
html[dir="rtl"] div.reports table#report_surround td.report_content table tbody th {
    text-align: right;
}

html[dir="rtl"] div.reports table#overview tfoot th.navi {
    text-align: left;
}

html[dir="rtl"] div.reports table#report_surround td.report_content table tbody.infos td img {
    margin-right: 0;
    margin-left: 2px;
}

html[dir="rtl"] div.reports td.report_content table#attacker tbody.goods div.carry {
    float: left;
    margin-left: 0;
    margin-right: 20px;
}

/* ==========================================================================
   10. Send troops (a2b.php / a2b2.php)
   ========================================================================== */

html[dir="rtl"] div.a2b p.btn {
    text-align: right;
}

html[dir="rtl"] div.a2b table#troops td.column-first {
    padding-left: 0;
    padding-right: 8px;
}

html[dir="rtl"] div.a2b table#troops td.column-last {
    padding-right: 0;
    padding-left: 8px;
}

html[dir="rtl"] div.a2b table#troops img,
html[dir="rtl"] div.a2b table.troop_details tbody.options input.radio {
    margin-right: 0;
    margin-left: 2px;
}

html[dir="rtl"] div.a2b table.troop_details tbody.infos div.in {
    float: right;
}

html[dir="rtl"] div.a2b table#coords td.vil *,
html[dir="rtl"] div.a2b table#coords td.target * {
    float: right;
    margin-right: 0;
    margin-left: 10px;
}

html[dir="rtl"] div.a2b table.troop_details tbody.infos div.at {
    float: left;
}

/* ==========================================================================
   11. Registration / activation (anmelden.php, activate.php)
   ========================================================================== */

html[dir="rtl"] div.signup img.roman,
html[dir="rtl"] div.signup div#no_mail {
    float: left;
}

html[dir="rtl"] div.signup div#activation {
    float: right;
}

html[dir="rtl"] div.signup input.radio {
    float: right;
    margin-left: 0;
    margin-right: 5px;
}

html[dir="rtl"] div.signup input.check {
    float: right;
    margin-right: 0;
    margin-left: 5px;
}

html[dir="rtl"] div.signup table#sign_input th {
    padding-left: 0;
    padding-right: 20px;
}

html[dir="rtl"] div.signup table#sign_select th,
html[dir="rtl"] .signup #sign_select td {
    padding-left: 0;
    padding-right: 10px;
}

/* ==========================================================================
   12. Quest dialog
   ========================================================================== */

html[dir="rtl"] div.quest div#qstd span#qst_accpt a.qle {
    float: right;
    text-align: right;
}

html[dir="rtl"] div.quest div#qstd span#qst_accpt a.qri {
    float: left;
    text-align: left;
}

/* ==========================================================================
   13. Footer
   compact.css forces direction:ltr on the copyright line, which is correct for
   the Latin studio credit, but it must still sit inside an RTL footer.
   ========================================================================== */

html[dir="rtl"] div#footer div#mfoot div.copyright {
    text-align: center;
}
