/* Persian / RTL overrides for WHMCS 9 (twenty-one client area + blend admin).
 *
 * WHMCS 9.0.6 ships no RTL support: templates/twenty-one/header.tpl and the blend
 * admin template hardcode <html lang="en"> with no dir attribute, and neither
 * template has an RTL stylesheet. The `dir` attribute itself is set by the hook in
 * includes/hooks/rtl_persian.php -- this file handles what the attribute alone
 * cannot (Bootstrap's directional floats, paddings and text alignment).
 *
 * Scoped under [dir="rtl"] so English sessions are unaffected.
 */

/* The typeface lives in yekanbakh.css, which loads regardless of direction. This
 * file is direction only, so it can be switched off without losing the font. */

[dir="rtl"] body { direction: rtl; text-align: right; }

/* --- Bootstrap grid / float flips -------------------------------------- */
[dir="rtl"] .pull-left,  [dir="rtl"] .float-left  { float: right !important; }
[dir="rtl"] .pull-right, [dir="rtl"] .float-right { float: left  !important; }
[dir="rtl"] .text-left  { text-align: right !important; }
[dir="rtl"] .text-right { text-align: left  !important; }

[dir="rtl"] [class*="col-"] { float: right; }

/* --- lists, menus, dropdowns ------------------------------------------- */
[dir="rtl"] .nav,
[dir="rtl"] .navbar-nav,
[dir="rtl"] .list-unstyled,
[dir="rtl"] .breadcrumb { padding-right: 0; }

[dir="rtl"] .navbar-nav > li { float: right; }
[dir="rtl"] .navbar-right { float: left !important; margin-left: 0; }
[dir="rtl"] .navbar-left  { float: right !important; }

[dir="rtl"] .dropdown-menu { right: 0; left: auto; text-align: right; }
[dir="rtl"] .dropdown-menu-right { right: auto; left: 0; }
[dir="rtl"] .caret { margin-right: 2px; margin-left: 0; }

/* --- tables ------------------------------------------------------------ */
[dir="rtl"] table { text-align: right; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] .table > thead > tr > th { text-align: right; }
/* Numeric and currency cells read better left-aligned even in RTL. */
[dir="rtl"] td.text-center, [dir="rtl"] th.text-center { text-align: center !important; }

/* --- forms ------------------------------------------------------------- */
[dir="rtl"] .control-label,
[dir="rtl"] label { text-align: right; }
[dir="rtl"] .form-horizontal .control-label { text-align: left; }
[dir="rtl"] .input-group-addon:first-child { border-right: 1px solid #ccc; border-left: 0; }
[dir="rtl"] .checkbox, [dir="rtl"] .radio { padding-right: 20px; padding-left: 0; }
[dir="rtl"] .checkbox input, [dir="rtl"] .radio input { margin-right: -20px; margin-left: 0; }

/* Keep inherently LTR values readable: emails, URLs, IPs, money, code. */
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="password"],
[dir="rtl"] code, [dir="rtl"] pre, [dir="rtl"] kbd, [dir="rtl"] samp,
[dir="rtl"] .text-ltr {
  direction: ltr;
  text-align: left;
  unicode-bidi: embed;
}

/* --- spacing utilities ------------------------------------------------- */
[dir="rtl"] .ml-1,[dir="rtl"] .ml-2,[dir="rtl"] .ml-3 { margin-left: 0; }
[dir="rtl"] .mr-1,[dir="rtl"] .mr-2,[dir="rtl"] .mr-3 { margin-right: 0; }

/* --- blend admin chrome ------------------------------------------------ */
[dir="rtl"] #header .logo { float: right; }
[dir="rtl"] #nav, [dir="rtl"] #main-menu { direction: rtl; text-align: right; }
[dir="rtl"] #main-menu li { float: right; }
[dir="rtl"] #content, [dir="rtl"] .contentinner { direction: rtl; text-align: right; }
[dir="rtl"] .sidebar, [dir="rtl"] #sidebar { float: right; }
[dir="rtl"] .panel-heading, [dir="rtl"] .widget-header { text-align: right; }

/* Icons that imply direction should mirror. */
[dir="rtl"] .fa-chevron-left:before  { content: "\f054"; }
[dir="rtl"] .fa-chevron-right:before { content: "\f053"; }
[dir="rtl"] .fa-angle-left:before    { content: "\f105"; }
[dir="rtl"] .fa-angle-right:before   { content: "\f104"; }
