/* TCLMS bilingual direction authority — must load after all theme/page CSS. */
html[dir="rtl"] body{direction:rtl;text-align:right}
html[dir="ltr"] body{direction:ltr;text-align:left}
html[dir="rtl"] :where(input,select,textarea,button){direction:rtl}
html[dir="ltr"] :where(input,select,textarea,button){direction:ltr}
html[dir="ltr"] :where(.tclms-admin-shell,.tclms-student-shell,.tclms-public-shell,.tclms-auth-shell) :where(th,td,label,.form-label,.tclms-page-head,.card,.lms-panel){text-align:left!important}
html[dir="rtl"] :where(.tclms-admin-shell,.tclms-student-shell,.tclms-public-shell,.tclms-auth-shell) :where(th,td,label,.form-label){text-align:right!important}

/* Admin/student shell physical mirroring. */
html[dir="ltr"] .tclms-sidebar{left:0!important;right:auto!important;border-right:1px solid var(--lms-border)!important;border-left:0!important;box-shadow:18px 0 40px rgba(0,0,0,.15)!important}
html[dir="ltr"] .tclms-topbar{left:var(--lms-sidebar-width)!important;right:0!important;transition:left .2s ease!important}
html[dir="ltr"] .tclms-main{margin-left:var(--lms-sidebar-width)!important;margin-right:0!important;transition:margin-left .2s ease!important}
html[dir="ltr"] body.tclms-sidebar-collapsed .tclms-topbar{left:var(--lms-sidebar-collapsed-width)!important;right:0!important}
html[dir="ltr"] body.tclms-sidebar-collapsed .tclms-main{margin-left:var(--lms-sidebar-collapsed-width)!important;margin-right:0!important}
html[dir="ltr"] .tclms-nav a,html[dir="ltr"] .tclms-nav button{text-align:left!important}
html[dir="ltr"] .tclms-nav a.active{box-shadow:inset 3px 0 var(--lms-primary)!important}
html[dir="ltr"] .tclms-nav .badge,html[dir="ltr"] .tclms-nav-caret{margin-left:auto!important;margin-right:0!important}
html[dir="ltr"] .tclms-subnav{padding:2px 0 5px 12px!important}
html[dir="ltr"] .tclms-subnav a{border-left:1px solid color-mix(in srgb,var(--lms-border) 70%,transparent)!important;border-right:0!important;border-radius:9px 0 0 9px!important}
html[dir="ltr"] .tclms-search input{padding:0 12px 0 38px!important}
html[dir="ltr"] .tclms-search i{left:13px!important;right:auto!important}
html[dir="ltr"] .tclms-breadcrumbs .icofont-rounded-left{transform:scaleX(-1)}
html[dir="ltr"] .tclms-auth-back i,html[dir="ltr"] .tclms-auth-submit i{transform:scaleX(-1)}

/* Logical alignment for reusable components and legacy-compatible grids. */
html[dir="ltr"] :where(.tclms-page-actions,.actions,.btn-row,.action-row){justify-content:flex-start}
html[dir="rtl"] :where(.tclms-page-actions,.actions,.btn-row,.action-row){justify-content:flex-start}
html[dir="ltr"] :where(.dropdown-menu,.modal-content,.alert,.pagination){direction:ltr}
html[dir="rtl"] :where(.dropdown-menu,.modal-content,.alert,.pagination){direction:rtl}
html[dir="ltr"] :where(.form-check,.form-switch){padding-left:1.5em;padding-right:0}
html[dir="rtl"] :where(.form-check,.form-switch){padding-right:1.5em;padding-left:0}
html[dir="ltr"] .form-check .form-check-input{float:left;margin-left:-1.5em;margin-right:0}
html[dir="rtl"] .form-check .form-check-input{float:right;margin-right:-1.5em;margin-left:0}

/* Public surface: mirror asymmetric artwork and keep navigation natural. */
html[dir="ltr"] .p80-links,html[dir="ltr"] .p80-actions,html[dir="ltr"] .p80-utility-inner{direction:ltr}
html[dir="rtl"] .p80-links,html[dir="rtl"] .p80-actions,html[dir="rtl"] .p80-utility-inner{direction:rtl}
html[dir="ltr"] .tclms-about-media-stack .main{left:0!important;right:auto!important}
html[dir="ltr"] .tclms-about-media-stack .small{right:0!important;left:auto!important}
html[dir="ltr"] .tclms-quote{right:18px!important;left:auto!important}
html[dir="rtl"] .tclms-theme-principles{padding-right:18px!important;padding-left:0!important}
html[dir="ltr"] .tclms-theme-principles{padding-left:18px!important;padding-right:0!important}

/* Language controls are intentionally neutral and compact. */
.tclms-language-quick{display:inline-flex;align-items:center;gap:6px;margin:0}
.tclms-language-quick select{min-height:36px!important;height:36px!important;min-width:92px;width:auto!important;padding-block:4px!important;font-size:11px!important;font-weight:700}
.p80-actions .tclms-language-quick select{min-width:86px;background:var(--front-surface,rgba(255,255,255,.9))!important;color:var(--front-text,#18212a)!important;border-color:var(--front-border,rgba(0,0,0,.12))!important}
.tclms-auth-language{position:fixed;z-index:20;top:18px;inset-inline-end:18px}
.tclms-auth-language select{min-width:105px}

/* Preserve numbers, URLs, emails and technical identifiers in their natural direction. */
:where([type="email"],[type="url"],.tclms-ltr-value,.code,.mono,code,pre){direction:ltr!important;text-align:left!important;unicode-bidi:embed}

@media(max-width:900px){
 html[dir="ltr"] .tclms-sidebar{transform:translateX(-105%)!important}
 html[dir="ltr"] body.tclms-mobile-nav .tclms-sidebar{transform:none!important}
 html[dir="ltr"] .tclms-topbar{left:0!important;right:0!important}
 html[dir="ltr"] .tclms-main{margin-left:0!important;margin-right:0!important}
 html[dir="ltr"] body.tclms-sidebar-collapsed .tclms-topbar{left:0!important}
 html[dir="ltr"] body.tclms-sidebar-collapsed .tclms-main{margin-left:0!important}
 .tclms-language-quick select{min-width:78px!important}
}
@media(max-width:620px){
 .tclms-top-actions .tclms-language-quick{display:flex}
 .tclms-top-actions .tclms-language-quick select{min-width:72px!important;padding-inline:7px!important}
 .tclms-auth-language{top:10px;inset-inline-end:10px}
}
