@import url("../fonts/vazirmatn/vazirmatn.css");

:root {
  --abrak-fa-font: "Vazirmatn", "IRANSans", "Tahoma", sans-serif;
}

/* Frappe/ERPNext ships its own css-rtl bundles. These rules are the small
   application-layer overrides needed for the Persian locale and custom
   workspace launcher. */
html[dir="rtl"],
html[dir="rtl"] body,
html[lang^="fa"] {
  direction: rtl;
}

html[dir="rtl"] body,
html[dir="rtl"] button,
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea,
html[dir="rtl"] .frappe-control,
html[dir="rtl"] .desk-container,
html[dir="rtl"] .page-container,
html[dir="rtl"] .layout-main,
html[dir="rtl"] .layout-main-section,
html[dir="rtl"] .form-layout,
html[dir="rtl"] .list-row-container,
html[dir="rtl"] .list-row,
html[dir="rtl"] .report-wrapper,
html[dir="rtl"] .workspace {
  font-family: var(--abrak-fa-font);
}

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

html[dir="rtl"] .navbar,
html[dir="rtl"] .page-head,
html[dir="rtl"] .layout-side-section,
html[dir="rtl"] .sidebar,
html[dir="rtl"] .layout-main,
html[dir="rtl"] .workspace {
  direction: rtl;
}

html[dir="rtl"] .navbar .navbar-brand,
html[dir="rtl"] .navbar .navbar-nav,
html[dir="rtl"] .page-head .page-head-content,
html[dir="rtl"] .form-page,
html[dir="rtl"] .list-row {
  text-align: right;
}

html[dir="rtl"] .form-control,
html[dir="rtl"] textarea,
html[dir="rtl"] .ql-editor,
html[dir="rtl"] .input-with-feedback,
html[dir="rtl"] .search-bar input,
html[dir="rtl"] .search-box input {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .form-control[type="number"],
html[dir="rtl"] input[data-fieldtype="Float"],
html[dir="rtl"] input[data-fieldtype="Currency"],
html[dir="rtl"] input[data-fieldtype="Int"] {
  direction: ltr;
  text-align: right;
}

html[dir="rtl"] code,
html[dir="rtl"] pre,
html[dir="rtl"] .font-monospace,
html[dir="rtl"] input[data-fieldtype="Data"]:has(+ .control-value[data-fieldtype="Link"]) {
  direction: ltr;
  text-align: left;
}

html[dir="rtl"] .text-left { text-align: right !important; }
html[dir="rtl"] .text-right { text-align: left !important; }

/* Workspace launcher labels: Persian names must remain readable in RTL. */
html[dir="rtl"] .desktop-icon,
html[dir="rtl"] .desktop-icon .icon-caption,
html[dir="rtl"] .desktop-icon .icon-title {
  overflow: visible !important;
}

html[dir="rtl"] .desktop-icon .icon-title {
  display: block;
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  height: auto !important;
  max-height: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: normal;
  text-overflow: clip !important;
  direction: rtl;
  text-align: center;
  line-height: 1.55;
  padding-inline: 2px;
}

html[dir="rtl"] .desktop-icon .icon-caption {
  height: auto !important;
  min-height: 1.55em;
  text-align: center;
}
