/* R6 component-scoped RTL, responsive, keyboard, and accessibility corrections. */

/* D04B-03: the expanded Desk sidebar body uses the available inline size. */
html.scriptye-arabic-r6[dir="rtl"] .body-sidebar {
	padding-inline: 2px;
}

html.scriptye-arabic-r6[dir="rtl"] .body-sidebar .body-sidebar-top,
html.scriptye-arabic-r6[dir="rtl"] .body-sidebar .sidebar-items {
	inline-size: 100%;
	min-inline-size: 0;
}

/* D05F-01: isolate linked Latin identifiers inside the Arabic Credit Note message. */
html.scriptye-arabic-r6[dir="rtl"] .msgprint-dialog .msgprint {
	direction: rtl;
	text-align: start;
	overflow-wrap: anywhere;
}

html.scriptye-arabic-r6[dir="rtl"] .msgprint-dialog .msgprint a {
	direction: ltr;
	unicode-bidi: isolate;
	display: inline-block;
}

/* D09-01: retain an unmistakable keyboard focus indicator on the app-enhanced control. */
.scriptye-arabic-r6-web .toggle-password[role="button"] {
	cursor: pointer;
}

.scriptye-arabic-r6-web .toggle-password[role="button"]:focus-visible {
	outline: 2px solid var(--primary, #2490ef);
	outline-offset: 3px;
}


/* M-03: the PFB renderer's native tooltip opens on keyboard focus.
   Expose a visible ring on its app-labelled, Arabic-only info note. */
html.scriptye-arabic-r6 .pfb-settings .pfb-hint-icon[role="note"]:focus-visible {
    outline: 2px solid var(--primary, #2490ef);
    outline-offset: 3px;
    border-radius: 3px;
}

@media (max-width: 991.98px) {
    /* M03-PFB-NARROW: the native 260px+300px side panels otherwise
       collapse the Vue builder canvas to zero below 992px. Keep all panels,
       stack them vertically, and retain the canvas's own horizontal scroll. */
    html.scriptye-arabic-r6 .page-container[data-page-route="print-format-builder-beta"] .builder-root {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        min-width: 0;
    }
    html.scriptye-arabic-r6 .page-container[data-page-route="print-format-builder-beta"] .builder-root > .pfb-sidebar {
        width: 100%;
        height: 220px;
        flex: 0 0 220px;
    }
    html.scriptye-arabic-r6 .page-container[data-page-route="print-format-builder-beta"] .builder-root > .canvas-area {
        width: 100%;
        min-width: 0;
        height: 500px;
        flex: 0 0 500px;
    }
    html.scriptye-arabic-r6 .page-container[data-page-route="print-format-builder-beta"] .builder-root > .pfb-inspector {
        width: 100%;
        height: 260px;
        flex: 0 0 260px;
    }
}

@media (max-width: 575.98px) {
	/* D03H2-01: preserve a usable field palette without creating root overflow. */
	html.scriptye-arabic-r6 .layout-main:has(.print-format-builder-sidebar) {
		align-items: flex-start;
		min-inline-size: 0;
	}

	html.scriptye-arabic-r6 .layout-side-section:has(.print-format-builder-sidebar) {
		flex: 0 0 181px;
		inline-size: 181px;
		min-inline-size: 181px;
		max-inline-size: 181px;
	}

	html.scriptye-arabic-r6 .print-format-builder-sidebar {
		inline-size: 180px;
		min-inline-size: 180px;
	}

	html.scriptye-arabic-r6 .layout-main:has(.print-format-builder-sidebar) > .layout-main-section {
		flex: 1 1 auto;
		inline-size: auto;
		min-inline-size: 0;
	}

	/* D04A-01: replace the desktop inline height after either resize direction. */
	html.scriptye-arabic-r6 .body-sidebar {
		block-size: 100dvh !important;
		max-block-size: 100dvh;
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	/* D04D-02: the Assignment dialog scrolls internally and stays in the viewport. */
	html.scriptye-arabic-r6 .scriptye-r6-assignment-dialog .modal-dialog {
		block-size: calc(100dvh - 16px);
		max-block-size: calc(100dvh - 16px);
		margin-block: 8px;
		margin-inline: auto;
	}

	html.scriptye-arabic-r6 .scriptye-r6-assignment-dialog .modal-content {
		display: flex;
		block-size: 100%;
		max-block-size: 100%;
		overflow: hidden;
	}

	html.scriptye-arabic-r6 .scriptye-r6-assignment-dialog .modal-body {
		flex: 1 1 auto;
		min-block-size: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	/* D05F-01: keep the message reachable during both dynamic resize directions. */
	html.scriptye-arabic-r6 .msgprint-dialog .modal-dialog {
		max-inline-size: calc(100vw - 16px);
		margin-inline: auto;
	}
}
